Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
#include "cascoda_btn.h"
#include "cascoda-bm/cascoda_evbme.h"
#include "cascoda-bm/cascoda_interface.h"
#include "cascoda-bm/cascoda_wait.h"
#include "cascoda-util/cascoda_time.h"
#include <stdint.h>
Functions | |
ca_error | Btn_RegisterLEDOutput (uint8_t ledBtn) |
Register LED output (open drain) More... | |
ca_error | Btn_RegisterButtonInput (uint8_t ledBtn) |
Register button input. More... | |
ca_error | Btn_RegisterButtonIRQInput (uint8_t ledBtn) |
Register button input with interrupt (for sleepy devices) More... | |
ca_error | Btn_RegisterSharedButtonLED (uint8_t ledBtn) |
Register button as shared input/output. More... | |
ca_error | Btn_RegisterSharedIRQButtonLED (uint8_t ledBtn) |
Register button as shared input/output with interrupt (for sleepy devices) More... | |
ca_error | Btn_DeRegister (uint8_t ledBtn) |
De-Register an LED or Button Pin. More... | |
ca_error | Btn_SetButtonShortPressCallback (uint8_t ledBtn, btn_callback callback, void *context, uint8_t shortPressMode) |
Set a callback function to a button when it is short pressed. More... | |
ca_error | Btn_SetButtonLongPressCallback (uint8_t ledBtn, btn_callback callback, void *context, uint32_t timeThreshold) |
Set a callback function to a button when it is long pressed. More... | |
ca_error | Btn_SetButtonHoldCallback (uint8_t ledBtn, btn_callback callback, void *context, uint32_t TimeInterval) |
Set a callback function to a button when it is held. More... | |
ca_error | Btn_SetLED (uint8_t ledBtn, uint8_t val) |
Set the state of the LED. More... | |
ca_error | Btn_Sense (uint8_t ledBtn, uint8_t *val) |
Get the state of the LED/Button. More... | |
ca_error | Btn_SenseOutput (uint8_t ledBtn, uint8_t *val) |
Get the output state of the LED. More... | |
ca_error | Btn_PollButtons (void) |
Main polling function to activate callbacks for any buttons that are currently being pressed. More... | |
ca_error | Btn_HandleButtonCallbacks (btn_callback_info *callback, uint8_t pressed) |
Process the button callbacks and timing. More... | |
void | Btn_IncrementGPIOWakeup (void) |
One additional GPIO is now being used for wakeup. More... | |
ca_error | Btn_DecrementGPIOWakeup (void) |
One fewer GPIO is now being used for wakeup. More... | |
void | Btn_SetSleepPermanently (void) |
Register that the device will be put to sleep permanently. More... | |
bool | Btn_CanSleep (void) |
Check if all buttons have been handled. More... | |
ca_error | Btn_DevboardSleep (uint32_t aSleepTime, struct ca821x_dev *pDeviceRef) |
Put board to sleep / powerdown. More... | |
Variables | |
uint8_t | registeredPinMappings [NUM_LEDBTN] |
bool Btn_CanSleep | ( | void | ) |
Check if all buttons have been handled.
ca_error Btn_DecrementGPIOWakeup | ( | void | ) |
One fewer GPIO is now being used for wakeup.
ca_error Btn_DeRegister | ( | uint8_t | ledBtn | ) |
De-Register an LED or Button Pin.
ledBtn | - reference to LED/Button |
ca_error Btn_DevboardSleep | ( | uint32_t | aSleepTime, |
struct ca821x_dev * | pDeviceRef | ||
) |
Put board to sleep / powerdown.
ca_error Btn_HandleButtonCallbacks | ( | btn_callback_info * | callback, |
uint8_t | pressed | ||
) |
Process the button callbacks and timing.
callback | - callback info struct for button |
pressed | - the state of the Button |
void Btn_IncrementGPIOWakeup | ( | void | ) |
One additional GPIO is now being used for wakeup.
ca_error Btn_PollButtons | ( | void | ) |
Main polling function to activate callbacks for any buttons that are currently being pressed.
ca_error Btn_RegisterButtonInput | ( | uint8_t | ledBtn | ) |
Register button input.
ledBtn | - reference to button |
ca_error Btn_RegisterButtonIRQInput | ( | uint8_t | ledBtn | ) |
Register button input with interrupt (for sleepy devices)
ledBtn | - reference to button |
ca_error Btn_RegisterLEDOutput | ( | uint8_t | ledBtn | ) |
Register LED output (open drain)
ledBtn | - reference to LED |
ca_error Btn_RegisterSharedButtonLED | ( | uint8_t | ledBtn | ) |
Register button as shared input/output.
ledBtn | - reference to button |
ca_error Btn_RegisterSharedIRQButtonLED | ( | uint8_t | ledBtn | ) |
Register button as shared input/output with interrupt (for sleepy devices)
ledBtn | - reference to button |
ca_error Btn_Sense | ( | uint8_t | ledBtn, |
uint8_t * | val | ||
) |
Get the state of the LED/Button.
ledBtn | - reference to LED/Button |
val | - the state of the LED/Button |
ca_error Btn_SenseOutput | ( | uint8_t | ledBtn, |
uint8_t * | val | ||
) |
Get the output state of the LED.
ledBtn | - reference to LED |
val | - the state of the LED |
ca_error Btn_SetButtonHoldCallback | ( | uint8_t | ledBtn, |
btn_callback | callback, | ||
void * | context, | ||
uint32_t | TimeInterval | ||
) |
Set a callback function to a button when it is held.
ledBtn | - reference to LED/Button |
callback | - function to call |
context | - context for the callback, should be set to NULL if not context is needed. |
TimeInterval | - time interval in [ms] in which callback function is called |
ca_error Btn_SetButtonLongPressCallback | ( | uint8_t | ledBtn, |
btn_callback | callback, | ||
void * | context, | ||
uint32_t | timeThreshold | ||
) |
Set a callback function to a button when it is long pressed.
ledBtn | - reference to LED/Button |
callback | - function to call |
context | - context for the callback, should be set to NULL if not context is needed. |
timeThreshold | - time above which a button press is considered a long press |
ca_error Btn_SetButtonShortPressCallback | ( | uint8_t | ledBtn, |
btn_callback | callback, | ||
void * | context, | ||
uint8_t | shortPressMode | ||
) |
Set a callback function to a button when it is short pressed.
ledBtn | - reference to LED/Button |
callback | - function to call |
context | - context for the callback, should be set to NULL if no context is needed. |
shortPressMode | - short press mode (when pressed or when released). |
ca_error Btn_SetLED | ( | uint8_t | ledBtn, |
uint8_t | val | ||
) |
Set the state of the LED.
ledBtn | - reference to LED |
val | - the state of the LED |
void Btn_SetSleepPermanently | ( | void | ) |
Register that the device will be put to sleep permanently.
uint8_t registeredPinMappings[NUM_LEDBTN] |