Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
#include "cascoda_btn_ext.h"
#include "cascoda-bm/cascoda_evbme.h"
#include "cascoda-bm/cascoda_interface.h"
#include "cascoda-util/cascoda_time.h"
Macros | |
#define | IS_INP(pin) ((extpin_is_inp >> pin) & 0x01) |
#define | IS_BTN(pin) ((extpin_is_btn >> pin) & 0x01) |
#define | IS_OUT(pin) ((extpin_is_out >> pin) & 0x01) |
#define | SET_INP(pin) (extpin_is_inp |= (0x01 << pin)) |
#define | SET_BTN(pin) (extpin_is_btn |= (0x01 << pin)) |
#define | SET_OUT(pin) (extpin_is_out |= (0x01 << pin)) |
#define | CLR_INP(pin) (extpin_is_inp &= ~(0x01 << pin)) |
#define | CLR_BTN(pin) (extpin_is_btn &= ~(0x01 << pin)) |
#define | CLR_OUT(pin) (extpin_is_out &= ~(0x01 << pin)) |
Functions | |
ca_error | Btn_RegisterOutputExt (uint8_t ledBtn) |
Set the functionality as output/LED. More... | |
ca_error | Btn_RegisterButtonInputExt (uint8_t ledBtn) |
Set the functionality of a button to be an input. More... | |
ca_error | Btn_RegisterGeneralInputExt (uint8_t ledBtn) |
Set the functionality to be a general input (no interrupt, polling only) More... | |
ca_error | Btn_DeRegisterExt (uint8_t ledBtn) |
De-Register an LED or Button Pin. More... | |
ca_error | Btn_CheckOutputExt (uint8_t ledBtn) |
check if valid output/LED More... | |
ca_error | Btn_CheckInputOrButtonExt (uint8_t ledBtn) |
check if valid input/Button More... | |
bool | Btn_HasButtonExt (void) |
Check if any button declared. More... | |
ca_error | Btn_SetButtonShortPressCallbackExt (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_SetButtonLongPressCallbackExt (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_SetButtonHoldCallbackExt (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_PollButtonsExt (uint8_t port) |
Main polling function to activate callbacks for any buttons that are currently being pressed. More... | |
bool | Btn_CanSleepExt (void) |
Check if all buttons have been handled. More... | |
#define CLR_BTN | ( | pin | ) | (extpin_is_btn &= ~(0x01 << pin)) |
#define CLR_INP | ( | pin | ) | (extpin_is_inp &= ~(0x01 << pin)) |
#define CLR_OUT | ( | pin | ) | (extpin_is_out &= ~(0x01 << pin)) |
#define IS_BTN | ( | pin | ) | ((extpin_is_btn >> pin) & 0x01) |
#define IS_INP | ( | pin | ) | ((extpin_is_inp >> pin) & 0x01) |
#define IS_OUT | ( | pin | ) | ((extpin_is_out >> pin) & 0x01) |
#define SET_BTN | ( | pin | ) | (extpin_is_btn |= (0x01 << pin)) |
#define SET_INP | ( | pin | ) | (extpin_is_inp |= (0x01 << pin)) |
#define SET_OUT | ( | pin | ) | (extpin_is_out |= (0x01 << pin)) |
bool Btn_CanSleepExt | ( | void | ) |
Check if all buttons have been handled.
ca_error Btn_CheckInputOrButtonExt | ( | uint8_t | ledBtn | ) |
check if valid input/Button
ionr | - I/O number |
val | - the state of the input/Button |
ca_error Btn_CheckOutputExt | ( | uint8_t | ledBtn | ) |
check if valid output/LED
ledBtn | - reference to output/LED |
val | - the state of the output/LED |
ca_error Btn_DeRegisterExt | ( | uint8_t | ledBtn | ) |
De-Register an LED or Button Pin.
ledBtn | - reference to LED/Button |
bool Btn_HasButtonExt | ( | void | ) |
Check if any button declared.
values | - the state of all buttons |
ca_error Btn_PollButtonsExt | ( | uint8_t | port | ) |
Main polling function to activate callbacks for any buttons that are currently being pressed.
port | - gpio values read from extender chip |
ca_error Btn_RegisterButtonInputExt | ( | uint8_t | ledBtn | ) |
Set the functionality of a button to be an input.
ledBtn | - reference to button |
ca_error Btn_RegisterGeneralInputExt | ( | uint8_t | ledBtn | ) |
Set the functionality to be a general input (no interrupt, polling only)
ledBtn | - reference number to input |
ca_error Btn_RegisterOutputExt | ( | uint8_t | ledBtn | ) |
Set the functionality as output/LED.
ledBtn | - reference to output/LED |
ca_error Btn_SetButtonHoldCallbackExt | ( | 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 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_SetButtonLongPressCallbackExt | ( | 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 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_SetButtonShortPressCallbackExt | ( | 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 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). |