Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
devboard_btn.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, 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 #ifndef DEVBOARD_BTN_H
30 #define DEVBOARD_BTN_H
31 
33 #include "ca821x_api.h"
34 #include "ca821x_error.h"
35 #include "cascoda_btn.h"
36 
39 {
41  JUMPER_POS_2 = 1
43 
45 typedef enum dvbd_led_btn
46 {
50  DEV_SWITCH_4 = 3
52 
53 /* re-mapping for functions that have 1-to-1 functionality */
54 #define DVBD_SetLED Btn_SetLED
55 #define DVBD_SetGPIOWakeup Btn_IncrementGPIOWakeup
56 #define DVBD_SetSleepPermanently Btn_SetSleepPermanently
57 #define DVBD_Sense Btn_Sense
58 #define DVBD_SenseOutput Btn_SenseOutput
59 #define DVBD_SetButtonShortPressCallback Btn_SetButtonShortPressCallback
60 #define DVBD_SetButtonLongPressCallback Btn_SetButtonLongPressCallback
61 #define DVBD_SetButtonHoldCallback Btn_SetButtonHoldCallback
62 #define DVBD_PollButtons Btn_PollButtons
63 #define DVBD_CanSleep Btn_CanSleep
64 #define DVBD_DevboardSleep Btn_DevboardSleep
65 
74 
83 
92 
101 
110 
119 
126 
127 #endif // DEVBOARD_BTN_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 DVBD_RegisterSharedIRQButtonLED(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos)
Set the functionality of a button to be shared interrupt input/output.
Definition: devboard_btn.c:90
dvbd_led_btn_jumper_position
Jumper position controls which module pin is used for the LED/Button.
Definition: devboard_btn.h:39
@ JUMPER_POS_1
Jumper connects pins 1 and 2.
Definition: devboard_btn.h:40
@ JUMPER_POS_2
Jumper connects pins 2 and 3.
Definition: devboard_btn.h:41
ca_error DVBD_RegisterButtonIRQInput(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos)
Register button input with interrupt (for sleepy devices)
Definition: devboard_btn.c:70
dvbd_led_btn
Number of the LED/Button.
Definition: devboard_btn.h:46
@ DEV_SWITCH_3
Definition: devboard_btn.h:49
@ DEV_SWITCH_4
Definition: devboard_btn.h:50
@ DEV_SWITCH_1
Definition: devboard_btn.h:47
@ DEV_SWITCH_2
Definition: devboard_btn.h:48
ca_error DVBD_RegisterButtonInput(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos)
Register button input.
Definition: devboard_btn.c:62
ca_error DVBD_DeRegister(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos)
De-Register an LED or Button Pin.
Definition: devboard_btn.c:101
ca_error DVBD_modifyPinMappings(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos, u8_t new_pin)
Modify possible pin mappings.
Definition: devboard_btn.c:110
ca_error DVBD_RegisterSharedButtonLED(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos)
Register button as shared input/output.
Definition: devboard_btn.c:81
ca_error DVBD_RegisterLEDOutput(dvbd_led_btn ledBtn, dvbd_led_btn_jumper_position jumperPos)
Register LED output (open drain)
Definition: devboard_btn.c:54
ca_error
Cascoda error type.
Definition: ca821x_error.h:51