ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_task_led.h
Go to the documentation of this file.
1 #ifndef RUUVI_TASK_LED_H
2 #define RUUVI_TASK_LED_H
3 
45 #include "ruuvi_driver_error.h"
46 #include "ruuvi_interface_gpio.h"
47 #include <stdbool.h>
48 #include <stdlib.h>
49 
51 #define RT_LED_ON (true)
53 #define RT_LED_OFF (false)
54 
73 rd_status_t rt_led_init (const ri_gpio_id_t * const leds,
74  const ri_gpio_state_t * const active_states,
75  const size_t num_leds);
76 
87 
98 rd_status_t rt_led_write (const ri_gpio_id_t led, const bool state);
99 
109 void rt_led_activity_indicate (const bool state);
110 
123 
129 uint16_t rt_led_activity_led_get (void);
130 
147 rd_status_t rt_led_blink_start (const ri_gpio_id_t led, const uint16_t interval_ms);
148 
168 rd_status_t rt_led_blink_once (const ri_gpio_id_t led, const uint16_t interval_ms);
169 
180 
187 bool rt_led_is_init (void);
188 
189 #ifdef CEEDLING
190 int8_t is_led (const ri_gpio_id_t led);
191 void rt_led_blink_isr (void * const p_context);
192 void rt_led_blink_once_isr (void * const p_context);
193 #endif
194 
196 #endif
uint32_t rd_status_t
bitfield for representing errors
Ruuvi error codes and error check function.
uint16_t ri_gpio_id_t
port<<8 + pin
ri_gpio_state_t
States of GPIO pins.
rd_status_t rt_led_init(const ri_gpio_id_t *const leds, const ri_gpio_state_t *const active_states, const size_t num_leds)
LED initialization function.
rd_status_t rt_led_blink_once(const ri_gpio_id_t led, const uint16_t interval_ms)
Function to blink led once.
rd_status_t rt_led_activity_led_set(const ri_gpio_id_t led)
Set LED which is used to indicate activity.
uint16_t rt_led_activity_led_get(void)
Get LED which is used to indicate activity.
bool rt_led_is_init(void)
Check if LED task has been initialized.
rd_status_t rt_led_blink_start(const ri_gpio_id_t led, const uint16_t interval_ms)
Start blinking led at 50 % duty cycle at given interval.
rd_status_t rt_led_blink_stop(const ri_gpio_id_t led)
Stop blinking led and leave the pin as high-drive output in inactive state.
rd_status_t rt_led_write(const ri_gpio_id_t led, const bool state)
LED write function. Set given LED ON or OFF.
void rt_led_activity_indicate(const bool state)
Function to indicate activity in program. Led is turned on while program is active and off while in s...
rd_status_t rt_led_uninit(void)
LED uninitialization function.