Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
cascoda_btn_ext.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023, Cascoda Ltd.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of the copyright holder nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28/*
29 * Extended button/input/output Functions for Cascoda UI
30*/
31
32#ifndef CASCODA_BTN_EXT_H
33#define CASCODA_BTN_EXT_H
34
35#include "cascoda_btn.h"
36
37/* Number of extended I/Os supported */
38#define NUM_LEDBTN_EXT 8
39
40/* functions */
41
48ca_error Btn_RegisterOutputExt(uint8_t ledBtn);
49
57
65
72ca_error Btn_DeRegisterExt(uint8_t ledBtn);
73
81ca_error Btn_CheckOutputExt(uint8_t ledBtn);
82
91
98bool Btn_HasButtonExt(void);
99
110 btn_callback callback,
111 void* context,
112 uint8_t shortPressMode);
113
124 btn_callback callback,
125 void* context,
126 uint32_t timeThreshold);
127
137ca_error Btn_SetButtonHoldCallbackExt(uint8_t ledBtn, btn_callback callback, void* context, uint32_t TimeInterval);
138
145ca_error Btn_PollButtonsExt(uint8_t port);
146
152bool Btn_CanSleepExt(void);
153
154#endif // CASCODA_BTN_EXT_H
void(* btn_callback)(void *context)
Definition cascoda_btn.h:84
ca_error Btn_DeRegisterExt(uint8_t ledBtn)
De-Register an LED or Button Pin.
Definition cascoda_btn_ext.c:114
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.
Definition cascoda_btn_ext.c:197
bool Btn_CanSleepExt(void)
Check if all buttons have been handled.
Definition cascoda_btn_ext.c:262
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.
Definition cascoda_btn_ext.c:215
ca_error Btn_CheckInputOrButtonExt(uint8_t ledBtn)
check if valid input/Button
Definition cascoda_btn_ext.c:152
ca_error Btn_PollButtonsExt(uint8_t port)
Main polling function to activate callbacks for any buttons that are currently being pressed.
Definition cascoda_btn_ext.c:233
ca_error Btn_RegisterGeneralInputExt(uint8_t ledBtn)
Set the functionality to be a general input (no interrupt, polling only)
Definition cascoda_btn_ext.c:97
ca_error Btn_CheckOutputExt(uint8_t ledBtn)
check if valid output/LED
Definition cascoda_btn_ext.c:138
bool Btn_HasButtonExt(void)
Check if any button declared.
Definition cascoda_btn_ext.c:166
ca_error Btn_RegisterButtonInputExt(uint8_t ledBtn)
Set the functionality of a button to be an input.
Definition cascoda_btn_ext.c:77
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.
Definition cascoda_btn_ext.c:176
ca_error Btn_RegisterOutputExt(uint8_t ledBtn)
Set the functionality as output/LED.
Definition cascoda_btn_ext.c:57
ca_error
Cascoda error type.
Definition ca821x_error.h:51