Skip to content

Commit 23e3684

Browse files
authored
Cppcheck unused functions (#247)
* Skip cppcheck on unused functions that are consumed in large headers we can't pass to cppcheck
1 parent c97d60b commit 23e3684

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

board/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ bool is_gpio_started(void) {
6969
return (GPIOA->IDR & (1U << 1)) == 0;
7070
}
7171

72+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
7273
void EXTI1_IRQHandler(void) {
7374
volatile unsigned int pr = EXTI->PR & (1U << 1);
7475
if ((pr & (1U << 1)) != 0U) {
@@ -524,6 +525,7 @@ int spi_cb_rx(uint8_t *data, int len, uint8_t *data_out) {
524525

525526
// ***************************** main code *****************************
526527

528+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
527529
void __initialize_hardware_early(void) {
528530
early();
529531
}
@@ -537,6 +539,7 @@ uint64_t tcnt = 0;
537539
uint64_t marker = 0;
538540

539541
// called once per second
542+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
540543
void TIM3_IRQHandler(void) {
541544
#define CURRENT_THRESHOLD 0xF00U
542545
#define CLICKS 5U // 5 seconds to switch modes

board/pedal/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define ENTER_BOOTLOADER_MAGIC 0xdeadbeef
3131
uint32_t enter_bootloader_mode;
3232

33+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
3334
void __initialize_hardware_early(void) {
3435
early();
3536
}
@@ -122,6 +123,7 @@ uint8_t pedal_checksum(uint8_t *dat, int len) {
122123
#define CAN_GAS_SIZE 6
123124
#define COUNTER_CYCLE 0xFU
124125

126+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
125127
void CAN1_TX_IRQHandler(void) {
126128
// clear interrupt
127129
CAN->TSR |= CAN_TSR_RQCP0;
@@ -144,6 +146,7 @@ uint32_t current_index = 0;
144146
#define FAULT_INVALID 6U
145147
uint8_t state = FAULT_STARTUP;
146148

149+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
147150
void CAN1_RX0_IRQHandler(void) {
148151
while ((CAN->RF0R & CAN_RF0R_FMP0) != 0) {
149152
#ifdef DEBUG
@@ -210,6 +213,7 @@ void CAN1_RX0_IRQHandler(void) {
210213
}
211214
}
212215

216+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
213217
void CAN1_SCE_IRQHandler(void) {
214218
state = FAULT_SCE;
215219
llcan_clear_send(CAN);
@@ -221,6 +225,7 @@ unsigned int pkt_idx = 0;
221225

222226
int led_value = 0;
223227

228+
// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck
224229
void TIM3_IRQHandler(void) {
225230
#ifdef DEBUG
226231
puth(TIM3->CNT);

0 commit comments

Comments
 (0)