Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
sif_btn_ext_pi4ioe5v96248.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 Functions using a GPIO extender chip.
30  * Implemented for PI4IOE5V96248.
31 */
32 
33 #ifndef SIF_BTN_EXT_PI4IOE5V96248_H
34 #define SIF_BTN_EXT_PI4IOE5V96248_H
35 
37 #include "ca821x_api.h"
38 #include "ca821x_error.h"
39 #include "cascoda_btn_ext.h"
40 
41 /* re-mapping for functions that have 1-to-1 functionality */
42 #define SIF_SetButtonShortPressCallbackExt Btn_SetButtonShortPressCallbackExt
43 #define SIF_SetButtonLongPressCallbackExt Btn_SetButtonLongPressCallbackExt
44 #define SIF_SetButtonHoldCallbackExt Btn_SetButtonHoldCallbackExt
45 
52 
59 ca_error SIF_RegisterOutputExt(uint8_t ledBtn);
60 
68 ca_error SIF_SetOutputExt(uint8_t ledBtn, u8_t val);
69 
76 ca_error SIF_RegisterButtonInputExt(uint8_t ledBtn);
77 
85 ca_error SIF_RegisterGeneralInputExt(uint8_t ledBtn, uint8_t pullup_on);
86 
93 ca_error SIF_DeRegisterExt(uint8_t ledBtn);
94 
102 ca_error SIF_SenseExt(uint8_t ledBtn, u8_t* val);
103 
111 ca_error SIF_SenseOutputExt(uint8_t ledBtn, u8_t* val);
112 
119 ca_error SIF_SenseAllExt(u8_t* values);
120 
127 
133 bool SIF_CanSleepExt(void);
134 
135 #endif // SIF_BTN_EXT_PI4IOE5V96248_H
The main ca821x-api include file.
Global error declarations for use across the Cascoda SDK.
Type definitions used by Cascoda baremetal drivers.
unsigned char u8_t
Definition: cascoda_types.h:46
ca_error
Cascoda error type.
Definition: ca821x_error.h:51
ca_error SIF_SenseOutputExt(uint8_t ledBtn, u8_t *val)
Get the state of the output/LED.
Definition: sif_btn_ext_pi4ioe5v96248.c:109
bool SIF_CanSleepExt(void)
Check if all buttons have been handled.
Definition: sif_btn_ext_pi4ioe5v6408.c:192
ca_error SIF_SenseAllExt(u8_t *values)
Get the state all buttons.
Definition: sif_btn_ext_pi4ioe5v96248.c:123
ca_error SIF_RegisterOutputExt(uint8_t ledBtn)
Set the functionality of an output/LED to be an output.
Definition: sif_btn_ext_pi4ioe5v6408.c:54
ca_error SIF_InitialiseGPIOExt(void)
Initialise GPIO extender.
Definition: sif_btn_ext_pi4ioe5v6408.c:39
ca_error SIF_SetOutputExt(uint8_t ledBtn, u8_t val)
Set the state of the output/LED.
Definition: sif_btn_ext_pi4ioe5v96248.c:81
ca_error SIF_PollButtonsExt(void)
Main polling function to activate callbacks for any buttons that are currently being pressed.
Definition: sif_btn_ext_pi4ioe5v6408.c:176
ca_error SIF_DeRegisterExt(uint8_t ledBtn)
De-Register an LED or Button Pin.
Definition: sif_btn_ext_pi4ioe5v6408.c:107
ca_error SIF_RegisterButtonInputExt(uint8_t ledBtn)
Set the functionality of a button to be an input.
Definition: sif_btn_ext_pi4ioe5v6408.c:71
ca_error SIF_SenseExt(uint8_t ledBtn, u8_t *val)
Get the state of the input/Button.
Definition: sif_btn_ext_pi4ioe5v96248.c:95
ca_error SIF_RegisterGeneralInputExt(uint8_t ledBtn, uint8_t pullup_on)
Set the functionality to be a general input (no interrupt, polling only)
Definition: sif_btn_ext_pi4ioe5v6408.c:90