diff --git a/left/src/i2c_watchdog.c b/left/src/i2c_watchdog.c index ae7f20e..40718a6 100644 --- a/left/src/i2c_watchdog.c +++ b/left/src/i2c_watchdog.c @@ -21,7 +21,7 @@ void RunWatchdog(void) cntr++; if (cntr==100) { /* we get called from KEY_SCANNER_HANDLER() which runs at 1ms, thus scaling down by 100 here to get 100 ms period */ cntr=0; - TEST_LED_TOGGLE(); + TestLed_Toggle(); I2cWatchdog_WatchCounter++; if (I2cWatchdog_WatchCounter>10) { /* do not check within the first 1000 ms, as I2C might not be running yet */ diff --git a/left/src/slave_protocol_handler.c b/left/src/slave_protocol_handler.c index c52edc0..4ceb40f 100644 --- a/left/src/slave_protocol_handler.c +++ b/left/src/slave_protocol_handler.c @@ -42,7 +42,7 @@ void SlaveRxHandler(void) case SlaveCommand_SetTestLed: TxMessage.length = 0; bool isLedOn = RxMessage.data[1]; - TEST_LED_SET(isLedOn); + TestLed_Set(isLedOn); break; case SlaveCommand_SetLedPwmBrightness: TxMessage.length = 0; diff --git a/left/src/test_led.c b/left/src/test_led.c index a3bd5d1..0f084d3 100644 --- a/left/src/test_led.c +++ b/left/src/test_led.c @@ -6,5 +6,5 @@ extern void TestLed_Init(void) CLOCK_EnableClock(TEST_LED_CLOCK); PORT_SetPinMux(TEST_LED_PORT, TEST_LED_PIN, kPORT_MuxAsGpio); GPIO_PinInit(TEST_LED_GPIO, TEST_LED_PIN, &(gpio_pin_config_t){kGPIO_DigitalOutput, 0}); - TEST_LED_ON(); + TestLed_On(); } diff --git a/left/src/test_led.h b/left/src/test_led.h index 0ca7fd3..444e4d4 100644 --- a/left/src/test_led.h +++ b/left/src/test_led.h @@ -15,10 +15,21 @@ #define TEST_LED_CLOCK kCLOCK_PortB #define TEST_LED_PIN 13 - #define TEST_LED_ON() GPIO_SetPinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN) - #define TEST_LED_OFF() GPIO_ClearPinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN) - #define TEST_LED_SET(state) GPIO_WritePinOutput(TEST_LED_GPIO, TEST_LED_PIN, (state)) - #define TEST_LED_TOGGLE() GPIO_TogglePinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN) + static inline void TestLed_On(void) { + GPIO_SetPinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN); + } + + static inline void TestLed_Off(void) { + GPIO_ClearPinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN); + } + + static inline void TestLed_Set(bool state) { + GPIO_WritePinOutput(TEST_LED_GPIO, TEST_LED_PIN, state); + } + + static inline void TestLed_Toggle(void) { + GPIO_TogglePinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN); + } // Functions: diff --git a/right/src/key_debouncer.c b/right/src/key_debouncer.c index 8a85eb3..1ca0002 100644 --- a/right/src/key_debouncer.c +++ b/right/src/key_debouncer.c @@ -7,7 +7,7 @@ void PIT_KEY_DEBOUNCER_HANDLER(void) { - TEST_LED_TOGGLE(); + TestLed_Toggle(); for (uint8_t slotId=0; slotId