diff --git a/components/badge23/captouch.c b/components/badge23/captouch.c index 79b8e1a01d262caae408ad5b9b1ba03b63782d86..465feccd6bc85f38bf86fbbc404f31d279b48266 100644 --- a/components/badge23/captouch.c +++ b/components/badge23/captouch.c @@ -83,7 +83,7 @@ typedef struct{ static petal_t petals[10]; struct ad714x_chip { - flow3r_i2c_address *addr; + const flow3r_i2c_address *addr; uint8_t gpio; int pos_afe_offsets[13]; int neg_afe_offsets[13]; @@ -551,6 +551,8 @@ static void captouch_print_debug_info_chip(const struct ad714x_chip* chip) ambient = cdc_ambient[1]; } + // Appease clang-tidy. + (void)data; (void)ambient; ESP_LOGI(TAG, "CDC results: %X %X %X %X %X %X %X %X %X %X %X %X", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11]); for(int stage=0; stage<stages; stage++) { diff --git a/components/bl00mbox/buds/tinysynth/tinysynth.c b/components/bl00mbox/buds/tinysynth/tinysynth.c index dee441eb6e408dc22248480e3069342ebc0fec60..c7ac1415f0c53fed2d90d8953a7a6306ce36e336 100644 --- a/components/bl00mbox/buds/tinysynth/tinysynth.c +++ b/components/bl00mbox/buds/tinysynth/tinysynth.c @@ -162,7 +162,8 @@ void trad_osc_set_freq_semitone(trad_osc_t * osc, float tone){ } void trad_osc_set_freq_Hz(trad_osc_t * osc, float freq){ - osc->freq = (freq/(SYNTH_SAMPLE_RATE)) * (~((uint64_t) 0)); + uint64_t max = ~((uint64_t)0); + osc->freq = (freq/(SYNTH_SAMPLE_RATE)) * max; } void trad_osc_set_waveform(trad_osc_t * osc, uint8_t waveform){ @@ -178,7 +179,8 @@ void trad_osc_set_decay_ms(trad_osc_t * osc, float ms){ } void trad_osc_set_sustain(trad_osc_t * osc, float sus){ - osc->env.sustain = (~((uint32_t) 0)) * sus; + uint32_t max = ~((uint32_t)0); + osc->env.sustain = max * sus; } void trad_osc_set_release_ms(trad_osc_t * osc, float ms){ diff --git a/components/flow3r_bsp/flow3r_bsp_audio.c b/components/flow3r_bsp/flow3r_bsp_audio.c index d6fa6bd6b7895bc702dec02156ba08a5bc0f2241..0940d5d5e3ab7f239f85b30bb1749668653d986f 100644 --- a/components/flow3r_bsp/flow3r_bsp_audio.c +++ b/components/flow3r_bsp/flow3r_bsp_audio.c @@ -5,8 +5,6 @@ #include "driver/i2s.h" #include "esp_log.h" -static const char *TAG = "flow3r-bsp-audio"; - esp_err_t flow3r_bsp_audio_write(const void *src, size_t size, size_t *bytes_written, TickType_t ticks_to_wait) { return i2s_write(0, src, size, bytes_written, ticks_to_wait); } @@ -163,4 +161,4 @@ esp_err_t flow3r_bsp_audio_read(void *dest, size_t size, size_t *bytes_read, Tic #else #error "audio not implemented for this badge generation" -#endif \ No newline at end of file +#endif diff --git a/components/micropython/vendor/ports/esp32/mpconfigport.h b/components/micropython/vendor/ports/esp32/mpconfigport.h index 75ebdd1cab58ff1126a36f5eb94912c15845db86..5d35429c47410a8d0e9e5dab759f3546432860c7 100644 --- a/components/micropython/vendor/ports/esp32/mpconfigport.h +++ b/components/micropython/vendor/ports/esp32/mpconfigport.h @@ -5,7 +5,6 @@ #include "mpconfigboard.h" #include <stdint.h> -#include <alloca.h> #include "esp_system.h" #include "esp_random.h" #include "freertos/FreeRTOS.h" diff --git a/components/micropython/vendor/ports/esp32/mphalport.h b/components/micropython/vendor/ports/esp32/mphalport.h index 5543b7c39bd8e2a55664250e56e89deacdd7459b..abf08fa4206c03c3b2c7c55f2ecf68df2f056c3b 100644 --- a/components/micropython/vendor/ports/esp32/mphalport.h +++ b/components/micropython/vendor/ports/esp32/mphalport.h @@ -103,7 +103,7 @@ static inline void mp_hal_pin_od_high(mp_hal_pin_obj_t pin) { } static inline int mp_hal_pin_read(mp_hal_pin_obj_t pin) { mp_raise_NotImplementedError(MP_ERROR_TEXT("low-level GPIO not supported")); - return mp_const_none; + return 0; } static inline void mp_hal_pin_write(mp_hal_pin_obj_t pin, int v) { mp_raise_NotImplementedError(MP_ERROR_TEXT("low-level GPIO not supported")); diff --git a/components/st3m/st3m_board_startup.c b/components/st3m/st3m_board_startup.c index b63dd9f2bc16aa592969eb4cf9e1038476a4c227..6159a9da9dda6471f97e2bc3fa42320d622a2b76 100644 --- a/components/st3m/st3m_board_startup.c +++ b/components/st3m/st3m_board_startup.c @@ -14,8 +14,6 @@ #include "freertos/task.h" #include "esp_log.h" -static const char *TAG = "st3m-board-startup"; - // Called by micropython via MICROPY_BOARD_STARTUP. void st3m_board_startup(void) { // Initialize display first as that gives us a nice splash screen. diff --git a/components/st3m/st3m_colors.c b/components/st3m/st3m_colors.c index 8049b9390b69b9f20a1a1ef3f93158862e03703f..7d4cb9b7da8baa80c4aff2c4c3810c56b228c031 100644 --- a/components/st3m/st3m_colors.c +++ b/components/st3m/st3m_colors.c @@ -70,9 +70,9 @@ st3m_rgb_t st3m_hsv_to_rgb(st3m_hsv_t hsv) { } st3m_rgb_t rgb = { - r = r * 255, - g = g * 255, - b = b * 255, + .r = r * 255, + .g = g * 255, + .b = b * 255, }; return rgb; } diff --git a/components/st3m/st3m_console.c b/components/st3m/st3m_console.c index 6062eb8d616a0ac91ec7472984bfbddb03536e73..d1f61e8a310e93ab628422811c7041005f47d35e 100644 --- a/components/st3m/st3m_console.c +++ b/components/st3m/st3m_console.c @@ -118,9 +118,9 @@ void mp_sched_keyboard_interrupt(); extern int mp_interrupt_char; // Called by st3m_usb_cdc when it receives some data from the host. -void st3m_console_cdc_on_rx(void *buffer, size_t bufsize) { +void st3m_console_cdc_on_rx(const uint8_t *buffer, size_t bufsize) { bool interrupted = false; - uint8_t *bufbytes = buffer; + const uint8_t *bufbytes = buffer; for (size_t i = 0; i < bufsize; i++) { if (bufbytes[i] == mp_interrupt_char) { interrupted = true; @@ -142,7 +142,7 @@ void st3m_gfx_splash(const char *c); // Called by st3m_usb_cdc when it has the opportunity to send some data to the // host. -size_t st3m_console_cdc_on_txpoll(void *buffer, size_t bufsize) { +size_t st3m_console_cdc_on_txpoll(uint8_t *buffer, size_t bufsize) { // I have no idea why this is needed, but it is. Otherwise a large backlog // of data cuases the IN endpoint to get stuck. // diff --git a/components/st3m/st3m_console.h b/components/st3m/st3m_console.h index 7f04ca48ba2514cf46399a30a01fc5a6e0a9afeb..4b873c98950191fb4fcca0ee4838b0759a5b7277 100644 --- a/components/st3m/st3m_console.h +++ b/components/st3m/st3m_console.h @@ -2,6 +2,7 @@ #include <stdbool.h> #include <stddef.h> +#include <stdint.h> // Initialize st3m console, taking over whatever stdio is currently being used // by the ESP-IDF codebase. After calling this, a CDC-ACM console will be @@ -14,6 +15,6 @@ void st3m_console_init(void); bool st3m_console_active(void); // Private. -void st3m_console_cdc_on_rx(void *buffer, size_t bufsize); -size_t st3m_console_cdc_on_txpoll(void *buffer, size_t bufsize); +void st3m_console_cdc_on_rx(const uint8_t *buffer, size_t bufsize); +size_t st3m_console_cdc_on_txpoll(uint8_t *buffer, size_t bufsize); void st3m_console_cdc_on_detach(void); \ No newline at end of file diff --git a/components/st3m/st3m_gfx.c b/components/st3m/st3m_gfx.c index e785579d751b4235c362da746b518d2b680acccd..61db39bb791a0dd54fc0b4a4606e27e342252795 100644 --- a/components/st3m/st3m_gfx.c +++ b/components/st3m/st3m_gfx.c @@ -91,7 +91,9 @@ static void st3m_gfx_crtc_task(void *_arg) { float read = st3m_counter_timer_average(&blit_read_time) / 1000.0; float work = st3m_counter_timer_average(&blit_work_time) / 1000.0; float write = st3m_counter_timer_average(&blit_write_time) / 1000.0; - //ESP_LOGI(TAG, "blitting: %.3f/sec, read %.3fms, work %.3fms, write %.3fms", rate, read, work, write); + // Mark variables as used even if debug is disabled. + (void)rate; (void)read; (void)work; (void)write; + ESP_LOGD(TAG, "blitting: %.3f/sec, read %.3fms, work %.3fms, write %.3fms", rate, read, work, write); } } } @@ -128,13 +130,16 @@ static void st3m_gfx_rast_task(void *_arg) { st3m_counter_rate_sample(&rast_rate); + if (st3m_counter_rate_report(&rast_rate, 1)) { float rate = 1000000.0 / st3m_counter_rate_average(&rast_rate); float read_fb = st3m_counter_timer_average(&rast_read_fb_time) / 1000.0; float read_dctx = st3m_counter_timer_average(&rast_read_dctx_time) / 1000.0; float work = st3m_counter_timer_average(&rast_work_time) / 1000.0; float write = st3m_counter_timer_average(&rast_write_time) / 1000.0; - //ESP_LOGI(TAG, "rasterization: %.3f/sec, read fb %.3fms, read dctx %.3fms, work %.3fms, write %.3fms", rate, read_fb, read_dctx, work, write); + // Mark variables as used even if debug is disabled. + (void)rate; (void)read_fb; (void)read_dctx; (void)work; (void)write; + ESP_LOGD(TAG, "rasterization: %.3f/sec, read fb %.3fms, read dctx %.3fms, work %.3fms, write %.3fms", rate, read_fb, read_dctx, work, write); } } } diff --git a/components/st3m/st3m_scope.c b/components/st3m/st3m_scope.c index 0693e1083126f69b9f2c5cbb46769680a7786adc..a59e55070a5572946814a15b87332e97d4384eb6 100644 --- a/components/st3m/st3m_scope.c +++ b/components/st3m/st3m_scope.c @@ -70,7 +70,7 @@ void st3m_scope_write(int16_t value){ } if (scope.write_head_position >= scope.buffer_size) { - scope.write_buffer = Atomic_SwapPointers_p32(&scope.exchange_buffer, scope.write_buffer); + scope.write_buffer = Atomic_SwapPointers_p32((void *volatile *)&scope.exchange_buffer, scope.write_buffer); scope.write_head_position = 0; } else { scope.write_buffer[scope.write_head_position] = value; @@ -83,7 +83,7 @@ void st3m_scope_draw(Ctx *ctx){ return; } - scope.read_buffer = Atomic_SwapPointers_p32(&scope.exchange_buffer, scope.read_buffer); + scope.read_buffer = Atomic_SwapPointers_p32((void *volatile *)&scope.exchange_buffer, scope.read_buffer); // How much to divide the values persisted in the buffer to scale to diff --git a/components/st3m/st3m_usb.c b/components/st3m/st3m_usb.c index dc4c51fb83608c59adcb68fdbf503e72603fce5c..1727351547565d91acb9186eec21d770ed91c6da 100644 --- a/components/st3m/st3m_usb.c +++ b/components/st3m/st3m_usb.c @@ -77,7 +77,9 @@ void st3m_usb_mode_switch(st3m_usb_mode_t *mode) { case st3m_usb_mode_kind_app: case st3m_usb_mode_kind_disk: running = true; + break; default: + break; } bool should_run = false; @@ -85,7 +87,9 @@ void st3m_usb_mode_switch(st3m_usb_mode_t *mode) { case st3m_usb_mode_kind_app: case st3m_usb_mode_kind_disk: should_run = true; + break; default: + break; } if (running) { diff --git a/components/st3m/st3m_usb.h b/components/st3m/st3m_usb.h index a13f7e41e37e0458c9b316d19b7efca63abdf62b..0095a8927c52ca5bf8182302e4835b2e7f85b64f 100644 --- a/components/st3m/st3m_usb.h +++ b/components/st3m/st3m_usb.h @@ -75,12 +75,12 @@ typedef struct { typedef struct { // Required. Called whenever the host wrote some bytes. All bytes must be // processed. - void (*fn_rx)(uint8_t *buffer, size_t bufsize); + void (*fn_rx)(const uint8_t *buffer, size_t bufsize); // Required. Called whenever the host requests bytes to read. Must return // how many bytes are actually available to transmit to the host. size_t (*fn_txpoll)(uint8_t *buffer, size_t bufsize); // Optional. Called whenever the host has detached from the device. - size_t (*fn_detach)(void); + void (*fn_detach)(void); } st3m_usb_app_conf_t; // Main configuration structure, passed by pointer to st3m_usb_mode_switch. diff --git a/components/st3m/st3m_usb_cdc.c b/components/st3m/st3m_usb_cdc.c index 6773d0a67bbeabbe3537fd1f0cfa092d424897e5..b4495d35e6371e34fec0498f59bc4e69eb2359bd 100644 --- a/components/st3m/st3m_usb_cdc.c +++ b/components/st3m/st3m_usb_cdc.c @@ -7,8 +7,6 @@ #include "esp_log.h" -static const char *TAG = "st3m-usb-cdc"; - static st3m_usb_app_conf_t _conf = { 0 }; static SemaphoreHandle_t _write_mu; @@ -73,4 +71,4 @@ void st3m_usb_cdc_detached(void) { return; } conf->fn_detach(); -} \ No newline at end of file +} diff --git a/components/st3m/st3m_usb_descriptors.c b/components/st3m/st3m_usb_descriptors.c index 983405f0711168aa308762cbd3d1c1e2b2f7fb81..1785010c59702f1a5b13fecdbf959bb8c4f5118d 100644 --- a/components/st3m/st3m_usb_descriptors.c +++ b/components/st3m/st3m_usb_descriptors.c @@ -161,6 +161,7 @@ void st3m_usb_descriptors_switch(st3m_usb_mode_t *mode) { _descset_current = &_descset_disk; break; default: + break; } } diff --git a/components/st3m/st3m_usb_msc.c b/components/st3m/st3m_usb_msc.c index 3d84e6d73b36cacd5377e3199f51fdc1b7ead576..7167c630c0c6b100d3310756bfdf1bd94825253f 100644 --- a/components/st3m/st3m_usb_msc.c +++ b/components/st3m/st3m_usb_msc.c @@ -7,8 +7,6 @@ #include "tusb.h" #include "esp_log.h" -static const char *TAG = "st3m-usb-msc"; - static st3m_usb_msc_conf_t _conf = { 0 }; void st3m_usb_msc_set_conf(st3m_usb_msc_conf_t *conf) { diff --git a/usermodule/mp_audio.c b/usermodule/mp_audio.c index 076e9e70a60f1eece88fa0168c4b21d5869be09c..24e2b934ad7c1f42735d6d9f2238266525c68de8 100644 --- a/usermodule/mp_audio.c +++ b/usermodule/mp_audio.c @@ -209,7 +209,7 @@ STATIC mp_obj_t mp_input_set_source(mp_obj_t enable) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_input_set_source_obj, mp_input_set_source); -STATIC mp_obj_t mp_input_get_source(mp_obj_t enable) { +STATIC mp_obj_t mp_input_get_source(void) { return mp_obj_new_int(st3m_audio_input_get_source()); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_input_get_source_obj, mp_input_get_source); @@ -222,7 +222,7 @@ STATIC mp_obj_t mp_headset_set_gain_dB(mp_obj_t gain_dB) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_headset_set_gain_dB_obj, mp_headset_set_gain_dB); -STATIC mp_obj_t mp_headset_get_gain_dB(mp_obj_t enable) { +STATIC mp_obj_t mp_headset_get_gain_dB(void) { return mp_obj_new_int(st3m_audio_headset_get_gain_dB()); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_headset_get_gain_dB_obj, mp_headset_get_gain_dB); diff --git a/usermodule/mp_captouch.c b/usermodule/mp_captouch.c index e92fdc115a629c6330faeb00294d28d43807a9d1..9e27c595ea9997f528c0d8106ad7307db19ace65 100644 --- a/usermodule/mp_captouch.c +++ b/usermodule/mp_captouch.c @@ -135,7 +135,7 @@ STATIC mp_obj_t mp_captouch_state_new(const captouch_state_t *underlying) { } STATIC mp_obj_t mp_captouch_read(void) { - mp_captouch_state_t st; + captouch_state_t st; read_captouch_ex(&st); return mp_captouch_state_new(&st); }