Developing with ZBOSS for Zigbee
|
Data Structures | |
struct | zb_button_ctl_s |
struct | zb_buttons_global_s |
LED | |
enum | zb_led_blink_frequency_e { ZB_LED_BLINK_QUATER_SEC = 1, ZB_LED_BLINK_HALF_SEC = 2, ZB_LED_BLINK_PER_SEC = 4, ZB_LED_BLINK_PER_2SEC = 8 } |
typedef enum zb_led_blink_frequency_e | zb_led_blink_frequency_t |
void | zb_led_init (void) ZB_DEPRECATED |
void | zb_led_blink_off (zb_uint8_t led_arg) |
void | zb_led_blink_on (zb_uint8_t led_arg) |
#define | ZB_LED_PERIOD_MULTIPLIER ZB_MILLISECONDS_TO_BEACON_INTERVAL(250U) |
#define | ZB_LED_ARG_PERIOD(led_arg) (((led_arg) >> 4U) * ZB_LED_PERIOD_MULTIPLIER) |
get period argument value (in beacon intervals) from led_arg. To be used in ZBOSS led functions | |
#define | ZB_LED_ARG_NUMBER(led_arg) ((led_arg) & 0xfU) |
get LED number from led_arg To be used in ZBOSS led functions | |
#define | ZB_LED_ARG_CREATE(num, period) ((zb_uint8_t)((num) | (((zb_uint8_t)(period)) << 4U))) |
Construct argument to pass to LEd functions line zb_led_blink_on() More... | |
Buttons | |
typedef struct zb_button_ctl_s | zb_button_ctl_t |
typedef struct zb_buttons_global_s | zb_buttons_global_t |
void | zb_button_on_cb (zb_uint8_t butt_no) |
Set state of given button to on. More... | |
void | zb_button_off_cb (zb_uint8_t butt_no) |
Set state of given button to off and invoke button handler. More... | |
void | zb_button_register_handler (zb_uint8_t butt_no, zb_uint8_t pressed_sec_pow2, zb_callback_t cb) |
Register handler to be called on button release. More... | |
void | zb_osif_led_button_init (void) |
void | zb_osif_led_on (zb_uint8_t led_no) |
void | zb_osif_led_off (zb_uint8_t led_no) |
void | zb_osif_led_toggle (zb_uint8_t led_no) |
zb_bool_t | zb_osif_button_state (zb_uint8_t arg) |
zb_bool_t | zb_setup_buttons_cb (zb_callback_t cb) |
void | zb_osif_button_cb (zb_uint8_t arg) |
#define | ZB_BOARD_BUTTON_0 0U |
#define | ZB_BOARD_BUTTON_1 1U |
#define | ZB_BOARD_BUTTON_2 2U |
#define | ZB_BOARD_BUTTON_3 3U |
#define | ZB_BUTT_N_CBS 5U |
#define | ZB_N_BUTTONS 1U |
#define | ZB_N_LEDS 1U |
LED/Button API consists of platform-independent logic and platform API. If LEDs/Buttons are supported in particular ZBOSS build, both layers are included. If LEDs/Buttons support is not included into ZBOSS HAL, higher level is also absent. A user cannot modify low level LED/Button access API.
An application can register callbacks for button ON and off. Use zb_button_register_handler() to register callbacks.
LEDs can be switched on and off using zb_osif_led_on()/zb_osif_led_off() calls.
LED blinking is a popular function used by a final application. To simplify its implementation, ZBOSS provides it as part of the SDK. It is possible to control LED blinking using zb_led_blink_on() and zb_led_blink_off() API calls. LED blinking functionality utilizes ZBOSS multitasking, so it can be used only after zboss_startxxx() call is done and ZBOSS main loop is started.
#define ZB_BUTT_N_CBS 5U |
Number of handler that can be associated with a button.
Each of those handlers corresponds to its own press duration
#define ZB_LED_ARG_CREATE | ( | num, | |
period | |||
) | ((zb_uint8_t)((num) | (((zb_uint8_t)(period)) << 4U))) |
Construct argument to pass to LEd functions line zb_led_blink_on()
num | - number of LED for which command is meant |
period | - interval between LED state changes. see ZB_LED_PERIOD_MULTIPLIER for quant size. |
#define ZB_LED_PERIOD_MULTIPLIER ZB_MILLISECONDS_TO_BEACON_INTERVAL(250U) |
Quant size for intervals passed to ZBOSS LED functions.
#define ZB_N_BUTTONS 1U |
Number of button utilized by application
#define ZB_N_LEDS 1U |
Number of leds utilized by application
typedef enum zb_led_blink_frequency_e zb_led_blink_frequency_t |
Conveniency constants to be used with ZB_LED_ARG_CREATE() macro
Conveniency constants to be used with ZB_LED_ARG_CREATE() macro
Enumerator | |
---|---|
ZB_LED_BLINK_QUATER_SEC | Blink four times per second |
ZB_LED_BLINK_HALF_SEC | Blink twice per second |
ZB_LED_BLINK_PER_SEC | Blink every second |
ZB_LED_BLINK_PER_2SEC | Blink every two seconds |
void zb_button_off_cb | ( | zb_uint8_t | butt_no | ) |
Set state of given button to off and invoke button handler.
Handler to invoke is chosen by button and duration of button press. See zb_button_register_handler() for how to setup button handlers
butt_no | - number of button being released |
void zb_button_on_cb | ( | zb_uint8_t | butt_no | ) |
Set state of given button to on.
butt_no | - number of button being pressed |
void zb_button_register_handler | ( | zb_uint8_t | butt_no, |
zb_uint8_t | pressed_sec_pow2, | ||
zb_callback_t | cb | ||
) |
Register handler to be called on button release.
Several handlers can be set for one button (see ZB_BUTT_N_CBS for maximum number of callbacks) Each handler is associated with handler press duration, and only one will be called, it depends on how long button was pressed which one.
butt_no | - number of button with which handler is associated |
pressed_sec_pow2 | - duration with which handler is associated. calculated as given power of 2 (in sec): 1-2-4-8... sec |
cb | - pointer to handler functions |
void zb_led_blink_off | ( | zb_uint8_t | led_arg | ) |
Stop blinking on given LED
See ZB_LED_ARG_CREATE() for constructing led_arg
void zb_led_blink_on | ( | zb_uint8_t | led_arg | ) |
Start blinking on given LED
See ZB_LED_ARG_CREATE() for constructing led_arg
void zb_led_init | ( | void | ) |
Prepare LEDs for usage