BV: add specific function to switch blue and red LED on
This commit is contained in:
parent
216557b99e
commit
5dc9ad0286
14
global.c
14
global.c
|
@ -124,6 +124,20 @@ void led_blink(double period, double duty)
|
|||
timer_enable_counter(TIM1); // enable timer to start blinking
|
||||
}
|
||||
}
|
||||
|
||||
void led_blue(void)
|
||||
{
|
||||
timer_disable_counter(TIM1); // disable timer for PWM
|
||||
gpio_set_mode(GPIO(LED_PORT), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO(LED_PIN)); // set LED pin to 'output push-pull'
|
||||
gpio_set(GPIO(LED_PORT), GPIO(LED_PIN));
|
||||
}
|
||||
|
||||
void led_red(void)
|
||||
{
|
||||
timer_disable_counter(TIM1); // disable timer for PWM
|
||||
gpio_set_mode(GPIO(LED_PORT), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO(LED_PIN)); // set LED pin to 'output push-pull'
|
||||
gpio_clear(GPIO(LED_PORT), GPIO(LED_PIN));
|
||||
}
|
||||
#endif
|
||||
|
||||
void sleep_us(uint32_t duration)
|
||||
|
|
4
global.h
4
global.h
|
@ -463,6 +463,10 @@ void led_toggle(void);
|
|||
* @param[in] duty blue LED on duty cycle, before switching to red (0-1)
|
||||
*/
|
||||
void led_blink(double period, double duty);
|
||||
/** switch on blue LED */
|
||||
void led_blue(void);
|
||||
/** switch on red LED */
|
||||
void led_red(void);
|
||||
#endif
|
||||
/** go to sleep for some microseconds
|
||||
* @param[in] duration sleep duration in us
|
||||
|
|
Loading…
Reference in New Issue