rename board_led_control to board_led_write

This commit is contained in:
hathach 2019-04-02 18:16:04 +07:00
parent 6564580c3d
commit 5f3ab2afe1
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
16 changed files with 19 additions and 19 deletions

View File

@ -44,7 +44,7 @@ One useful clock debugging technique is to set up a PWM output at a known value
Setup your USB in a crystal-less mode when available. That makes the code easier to port across boards. Setup your USB in a crystal-less mode when available. That makes the code easier to port across boards.
#### board_led_control #### board_led_write
Feel free to skip this until you want to verify your demo code is running. To implement, set the pin corresponding to the led to output a value that lights the LED when `state` is true. Feel free to skip this until you want to verify your demo code is running. To implement, set the pin corresponding to the led to output a value that lights the LED when `state` is true.
### OS Abstraction Layer (OSAL) ### OS Abstraction Layer (OSAL)

View File

@ -245,6 +245,6 @@ void led_blinking_task(void)
if ( board_millis() < start_ms + blink_interval_ms) return; // not enough time if ( board_millis() < start_ms + blink_interval_ms) return; // not enough time
start_ms += blink_interval_ms; start_ms += blink_interval_ms;
board_led_control(led_state); board_led_write(led_state);
led_state = 1 - led_state; // toggle led_state = 1 - led_state; // toggle
} }

View File

@ -230,6 +230,6 @@ void led_blinky_cb(TimerHandle_t xTimer)
(void) xTimer; (void) xTimer;
static bool led_state = false; static bool led_state = false;
board_led_control(led_state); board_led_write(led_state);
led_state = 1 - led_state; // toggle led_state = 1 - led_state; // toggle
} }

View File

@ -173,7 +173,7 @@ void led_blinking_task(void)
if ( board_millis() < start_ms + interval_ms) return; // not enough time if ( board_millis() < start_ms + interval_ms) return; // not enough time
start_ms += interval_ms; start_ms += interval_ms;
board_led_control(led_state); board_led_write(led_state);
led_state = 1 - led_state; // toggle led_state = 1 - led_state; // toggle
} }

View File

@ -53,7 +53,7 @@
void board_init(void); void board_init(void);
// Turn LED on or off // Turn LED on or off
void board_led_control(bool state); void board_led_write(bool state);
// Get the current state of button // Get the current state of button
// a '1' means active (pressed), a '0' means inactive. // a '1' means active (pressed), a '0' means inactive.
@ -87,12 +87,12 @@ int board_uart_write(void const * buf, int len);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
static inline void board_led_on(void) static inline void board_led_on(void)
{ {
board_led_control(true); board_led_write(true);
} }
static inline void board_led_off(void) static inline void board_led_off(void)
{ {
board_led_control(false); board_led_write(false);
} }
static inline int8_t board_uart_getchar(void) static inline int8_t board_uart_getchar(void)

View File

@ -114,7 +114,7 @@ void board_init(void)
//------------- LED -------------// //------------- LED -------------//
void board_led_control(bool state) void board_led_write(bool state)
{ {
Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state); Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state);
} }

View File

@ -248,7 +248,7 @@ void board_init(void)
} }
// LED // LED
void board_led_control(bool state) void board_led_write(bool state)
{ {
if (state) if (state)
{ {

View File

@ -113,7 +113,7 @@ uint32_t board_millis(void)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// LEDS // LEDS
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void board_led_control(bool state) void board_led_write(bool state)
{ {
Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON)); Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
} }

View File

@ -126,7 +126,7 @@ uint32_t board_millis(void)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// LEDS // LEDS
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void board_led_control(bool state) void board_led_write(bool state)
{ {
Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state); Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state);
} }

View File

@ -164,7 +164,7 @@ uint32_t board_millis(void)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// LEDS // LEDS
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void board_led_control(bool state) void board_led_write(bool state)
{ {
Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state); Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state);
} }

View File

@ -178,7 +178,7 @@ void board_init(void)
} }
//------------- LED -------------// //------------- LED -------------//
void board_led_control(bool state) void board_led_write(bool state)
{ {
Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state); Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state);
} }

View File

@ -101,7 +101,7 @@ void board_init(void)
_gclk_enable_channel(TCC0_GCLK_ID, GCLK_CLKCTRL_GEN_GCLK0_Val); _gclk_enable_channel(TCC0_GCLK_ID, GCLK_CLKCTRL_GEN_GCLK0_Val);
} }
void board_led_control(bool state) void board_led_write(bool state)
{ {
gpio_set_pin_level(LED_PIN, state); gpio_set_pin_level(LED_PIN, state);
} }

View File

@ -90,7 +90,7 @@ void board_init(void)
gpio_set_pin_function(PIN_PA25, PINMUX_PA25H_USB_DP); gpio_set_pin_function(PIN_PA25, PINMUX_PA25H_USB_DP);
} }
void board_led_control(bool state) void board_led_write(bool state)
{ {
gpio_set_pin_level(LED_PIN, state); gpio_set_pin_level(LED_PIN, state);
} }

View File

@ -78,7 +78,7 @@ void board_init(void)
// LED // LED
nrf_gpio_cfg_output(LED_PIN); nrf_gpio_cfg_output(LED_PIN);
board_led_control(false); board_led_write(false);
// Button // Button
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
@ -126,7 +126,7 @@ void board_init(void)
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY); if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
} }
void board_led_control(bool state) void board_led_write(bool state)
{ {
nrf_gpio_pin_write(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON)); nrf_gpio_pin_write(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
} }

View File

@ -92,7 +92,7 @@ void board_init(void)
} }
void board_led_control(bool state) void board_led_write(bool state)
{ {
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_9, state); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_9, state);
} }

View File

@ -82,7 +82,7 @@ void board_init(void)
} }
void board_led_control(bool state) void board_led_write(bool state)
{ {
if (!state) { if (!state) {
GPIOD->BSRR = GPIO_BSRR_BR14; GPIOD->BSRR = GPIO_BSRR_BR14;