From afea7ca0d1d670bdee04cfe80a1d8c36efa4fca0 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 18 Dec 2022 19:14:36 +0200 Subject: Update clang-tidy configuration and fix some warnings (#1474) Don't enable coding conventions from unrelated projects. Only enable generic checks. --- src/main.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index ad7a07dc..b205f1e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,7 +45,6 @@ #include "drivers/Cst816s.h" #include "drivers/PinMap.h" #include "systemtask/SystemTask.h" -#include "drivers/PinMap.h" #include "touchhandler/TouchHandler.h" #include "buttonhandler/ButtonHandler.h" @@ -210,29 +209,29 @@ void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { } } -static void (*radio_isr_addr)(void); -static void (*rng_isr_addr)(void); -static void (*rtc0_isr_addr)(void); +static void (*radio_isr_addr)(); +static void (*rng_isr_addr)(); +static void (*rtc0_isr_addr)(); /* Some interrupt handlers required for NimBLE radio driver */ extern "C" { void RADIO_IRQHandler(void) { - ((void (*)(void)) radio_isr_addr)(); + ((void (*)()) radio_isr_addr)(); } void RNG_IRQHandler(void) { - ((void (*)(void)) rng_isr_addr)(); + ((void (*)()) rng_isr_addr)(); } void RTC0_IRQHandler(void) { - ((void (*)(void)) rtc0_isr_addr)(); + ((void (*)()) rtc0_isr_addr)(); } void WDT_IRQHandler(void) { nrf_wdt_event_clear(NRF_WDT_EVENT_TIMEOUT); } -void npl_freertos_hw_set_isr(int irqn, void (*addr)(void)) { +void npl_freertos_hw_set_isr(int irqn, void (*addr)()) { switch (irqn) { case RADIO_IRQn: radio_isr_addr = addr; @@ -243,6 +242,8 @@ void npl_freertos_hw_set_isr(int irqn, void (*addr)(void)) { case RTC0_IRQn: rtc0_isr_addr = addr; break; + default: + break; } } @@ -253,7 +254,7 @@ uint32_t npl_freertos_hw_enter_critical(void) { } void npl_freertos_hw_exit_critical(uint32_t ctx) { - if (!ctx) { + if (ctx == 0) { __enable_irq(); } } @@ -265,15 +266,14 @@ struct ble_npl_eventq* nimble_port_get_dflt_eventq(void) { } void nimble_port_run(void) { - struct ble_npl_event* ev; - - while (1) { - ev = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER); - ble_npl_event_run(ev); + struct ble_npl_event* event; + while (true) { + event = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER); + ble_npl_event_run(event); } } -void BleHost(void*) { +void BleHost(void* /*unused*/) { nimble_port_run(); } @@ -285,8 +285,7 @@ void nimble_port_init(void) { ble_hs_init(); ble_store_ram_init(); - int res; - res = hal_timer_init(5, NULL); + int res = hal_timer_init(5, nullptr); ASSERT(res == 0); res = os_cputime_init(32768); ASSERT(res == 0); @@ -301,17 +300,17 @@ void nimble_port_ll_task_func(void* args) { } } -void calibrate_lf_clock_rc(nrf_drv_clock_evt_type_t event) { +void calibrate_lf_clock_rc(nrf_drv_clock_evt_type_t /*event*/) { // 16 * 0.25s = 4s calibration cycle // Not recursive, call is deferred via internal calibration timer nrf_drv_clock_calibration_start(16, calibrate_lf_clock_rc); } -int main(void) { +int main() { logger.Init(); nrf_drv_clock_init(); - nrf_drv_clock_lfclk_request(NULL); + nrf_drv_clock_lfclk_request(nullptr); // When loading the firmware via the Wasp-OS reloader-factory, which uses the used internal LF RC oscillator, // the LF clock has to be explicitly restarted because InfiniTime uses the external crystal oscillator if available. -- cgit v1.2.3