CCAux  2.20.0.0
CCAux API reference
Button.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 2023 CrossControl AB
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; with
8  * version 2.1 of the License.
9  */
10 /*
11  * File description:
12  * Get status of the buttons on the side of the display and control their backlight.
13  *
14  * Use the function GetButton() to get a handle to pass on to the other functions.
15  * Use the method Button_release(BUTTONHANDLE) to return the handle.
16  *
17  * Example Usage:
18  * @include button_example.cpp
19  *
20  ************************************************/
21 
22 #ifndef CC_BUTTON_H_
23 #define CC_BUTTON_H_
24 
25 #include "CCAuxErrors.h"
26 #include "CCPlatform.h"
27 #include "CCAuxTypes.h"
28 
29 #ifdef __cplusplus
30 namespace CrossControl
31 {
32 #endif
33 
34 typedef enum
35 {
36  BTN_Button0 = 0x1,
37  BTN_Button1 = 0x2,
38  BTN_Button2 = 0x4,
39  BTN_Button3 = 0x8,
40  BTN_Button4 = 0x10,
41  BTN_Button5 = 0x20,
42  BTN_Button6 = 0x40,
43  BTN_Button7 = 0x80,
44  BTN_Button8 = 0x100,
45  BTN_Button9 = 0x200,
46  BTN_Button10 = 0x400,
47  BTN_Button11 = 0x800,
48  BTN_Button12 = 0x1000,
49  BTN_Button13 = 0x2000,
50  BTN_Button14 = 0x4000,
51  BTN_Button15 = 0x8000,
60  BTN_Button8_LONGPRESS = 0x1000000,
61  BTN_Button9_LONGPRESS = 0x2000000,
64  BTN_Button12_LONGPRESS = 0x10000000,
65  BTN_Button13_LONGPRESS = 0x20000000,
66  BTN_Button14_LONGPRESS = 0x40000000,
67  BTN_Button15_LONGPRESS = 0x80000000
69 
70 typedef void *BUTTONHANDLE;
71 
92 EXTERN_C
93 CCAUXDLL_API
95 CCAUXDLL_CALLING_CONV
96 GetButton(void);
97 
108 EXTERN_C
109 CCAUXDLL_API
110 void CCAUXDLL_CALLING_CONV Button_release(BUTTONHANDLE);
111 
124 EXTERN_C
125 CCAUXDLL_API
126 eErr CCAUXDLL_CALLING_CONV Button_getButtonDownStatus(BUTTONHANDLE, uint16_t *buttons);
127 
145 EXTERN_C
146 CCAUXDLL_API
147 eErr CCAUXDLL_CALLING_CONV Button_getBacklightPattern(BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime,
148  uint16_t *offTime, uint8_t *brightness);
149 
169 EXTERN_C
170 CCAUXDLL_API
171 eErr CCAUXDLL_CALLING_CONV Button_setBacklightPattern(BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime,
172  uint16_t offTime, uint8_t brightness);
173 
191 EXTERN_C
192 CCAUXDLL_API
193 eErr CCAUXDLL_CALLING_CONV Button_getBootBacklightPattern(BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime,
194  uint16_t *offTime, uint8_t *brightness);
195 
217 EXTERN_C
218 CCAUXDLL_API
219 eErr CCAUXDLL_CALLING_CONV Button_setBootBacklightPattern(BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime,
220  uint16_t offTime, uint8_t brightness);
221 
235 EXTERN_C
236 CCAUXDLL_API
237 eErr CCAUXDLL_CALLING_CONV Button_getStartupButtons(BUTTONHANDLE, uint32_t *buttons);
238 
252 EXTERN_C
253 CCAUXDLL_API
254 eErr CCAUXDLL_CALLING_CONV Button_setStartupButtons(BUTTONHANDLE, uint32_t buttons);
255 
268 EXTERN_C
269 CCAUXDLL_API
270 eErr CCAUXDLL_CALLING_CONV Button_getWakeupButtons(BUTTONHANDLE, uint32_t *buttons);
271 
284 EXTERN_C
285 CCAUXDLL_API
286 eErr CCAUXDLL_CALLING_CONV Button_setWakeupButtons(BUTTONHANDLE, uint32_t buttons);
287 
300 EXTERN_C
301 CCAUXDLL_API
302 eErr CCAUXDLL_CALLING_CONV Button_getSuspendButtons(BUTTONHANDLE, uint32_t *buttons);
303 
316 EXTERN_C
317 CCAUXDLL_API
318 eErr CCAUXDLL_CALLING_CONV Button_setSuspendButtons(BUTTONHANDLE, uint32_t buttons);
319 
332 EXTERN_C
333 CCAUXDLL_API
334 eErr CCAUXDLL_CALLING_CONV Button_getShutdownButtons(BUTTONHANDLE, uint32_t *buttons);
335 
348 EXTERN_C
349 CCAUXDLL_API
350 eErr CCAUXDLL_CALLING_CONV Button_setShutdownButtons(BUTTONHANDLE, uint32_t buttons);
351 
365 EXTERN_C
366 CCAUXDLL_API
367 eErr CCAUXDLL_CALLING_CONV Button_getLongPressTime(BUTTONHANDLE, uint16_t *time);
368 
382 EXTERN_C
383 CCAUXDLL_API
384 eErr CCAUXDLL_CALLING_CONV Button_setLongPressTime(BUTTONHANDLE, uint16_t time);
385 
387 #ifdef __cplusplus
388 } /* namespace CrossControl */
389 #endif
390 
391 #endif /* CC_SOFTKEY_H_ */
unsigned short uint16_t
Definition: CCAuxTypes.h:38
unsigned int uint32_t
Definition: CCAuxTypes.h:39
unsigned char uint8_t
Definition: CCAuxTypes.h:37
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getStartupButtons(BUTTONHANDLE, uint32_t *buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setBootBacklightPattern(BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime, uint16_t offTime, uint8_t brightness)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getShutdownButtons(BUTTONHANDLE, uint32_t *buttons)
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Button_release(BUTTONHANDLE)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getLongPressTime(BUTTONHANDLE, uint16_t *time)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getBootBacklightPattern(BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime, uint16_t *offTime, uint8_t *brightness)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setLongPressTime(BUTTONHANDLE, uint16_t time)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setStartupButtons(BUTTONHANDLE, uint32_t buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getSuspendButtons(BUTTONHANDLE, uint32_t *buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getButtonDownStatus(BUTTONHANDLE, uint16_t *buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setShutdownButtons(BUTTONHANDLE, uint32_t buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setWakeupButtons(BUTTONHANDLE, uint32_t buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setSuspendButtons(BUTTONHANDLE, uint32_t buttons)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setBacklightPattern(BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime, uint16_t offTime, uint8_t brightness)
EXTERN_C CCAUXDLL_API BUTTONHANDLE CCAUXDLL_CALLING_CONV GetButton(void)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getBacklightPattern(BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime, uint16_t *offTime, uint8_t *brightness)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getWakeupButtons(BUTTONHANDLE, uint32_t *buttons)
Definition: About.h:30
ButtonList
Definition: Button.h:35
@ BTN_Button7_LONGPRESS
Definition: Button.h:59
@ BTN_Button15
Definition: Button.h:51
@ BTN_Button2_LONGPRESS
Definition: Button.h:54
@ BTN_Button10
Definition: Button.h:46
@ BTN_Button3_LONGPRESS
Definition: Button.h:55
@ BTN_Button15_LONGPRESS
Definition: Button.h:67
@ BTN_Button7
Definition: Button.h:43
@ BTN_Button14_LONGPRESS
Definition: Button.h:66
@ BTN_Button11_LONGPRESS
Definition: Button.h:63
@ BTN_Button3
Definition: Button.h:39
@ BTN_Button5
Definition: Button.h:41
@ BTN_Button11
Definition: Button.h:47
@ BTN_Button9
Definition: Button.h:45
@ BTN_Button0_LONGPRESS
Definition: Button.h:52
@ BTN_Button14
Definition: Button.h:50
@ BTN_Button13_LONGPRESS
Definition: Button.h:65
@ BTN_Button6_LONGPRESS
Definition: Button.h:58
@ BTN_Button13
Definition: Button.h:49
@ BTN_Button4
Definition: Button.h:40
@ BTN_Button2
Definition: Button.h:38
@ BTN_Button8_LONGPRESS
Definition: Button.h:60
@ BTN_Button8
Definition: Button.h:44
@ BTN_Button12
Definition: Button.h:48
@ BTN_Button1
Definition: Button.h:37
@ BTN_Button12_LONGPRESS
Definition: Button.h:64
@ BTN_Button6
Definition: Button.h:42
@ BTN_Button4_LONGPRESS
Definition: Button.h:56
@ BTN_Button9_LONGPRESS
Definition: Button.h:61
@ BTN_Button1_LONGPRESS
Definition: Button.h:53
@ BTN_Button10_LONGPRESS
Definition: Button.h:62
@ BTN_Button0
Definition: Button.h:36
@ BTN_Button5_LONGPRESS
Definition: Button.h:57
eErr
Definition: CCAuxTypes.h:162
void * BUTTONHANDLE
Definition: Button.h:70