Mistake on this page?
Report an issue in GitHub or email us
pal_btn.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Button driver definition.
6  *
7  * Copyright (c) 2018-2019 ARM Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef PAL_BTN_H
26 #define PAL_BTN_H
27 
28 #include "pal_types.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*! \addtogroup PAL_BUTTON
35  * \{ */
36 
37 /**************************************************************************************************
38  Data Types
39 **************************************************************************************************/
40 
41 /*! \brief Operational states. */
42 typedef enum
43 {
44  PAL_BTN_STATE_UNINIT = 0, /*!< Uninitialized state. */
45  PAL_BTN_STATE_ERROR = 0, /*!< Error state. */
46  PAL_BTN_STATE_READY /*!< Ready state. */
48 
49 /*! \brief Button position. */
50 typedef enum
51 {
52  PAL_BTN_POS_INVALID, /*!< Button position is invalid. */
53  PAL_BTN_POS_DOWN, /*!< Button position is depressed. */
54  PAL_BTN_POS_UP /*!< Button position is released. */
55 } PalBtnPos_t;
56 
57 /*! \brief Action callback signature. */
58 typedef void (*PalBtnActionCback_t)(uint8_t btnId, PalBtnPos_t state);
59 
60 /*! \brief Audio button assignments (only mapped in audio applications). */
61 enum
62 {
63  PAL_BTN_AUDIO_PLAY = 0x80, /*!< Play button. */
64  PAL_BTN_AUDIO_FWD, /*!< Fast Forward button. */
65  PAL_BTN_AUDIO_RWD, /*!< Fast Rewind button. */
66  PAL_BTN_AUDIO_VOL_UP, /*!< Volume Up button. */
67  PAL_BTN_AUDIO_VOL_DN, /*!< Volume Down button. */
68  PAL_BTN_AUDIO_MUTE /*!< Mute button. */
69 };
70 
71 /**************************************************************************************************
72  Function Declarations
73 **************************************************************************************************/
74 
75 /* Initialization */
76 void PalBtnInit(PalBtnActionCback_t actCback);
77 void PalBtnDeInit(void);
78 
79 /* Control and Status */
80 PalBtnState_t PalBtnGetState(void);
81 PalBtnPos_t PalBtnGetPosition(uint8_t id);
82 
83 /*! \} */ /* PAL_BUTTON */
84 
85 #ifdef __cplusplus
86 };
87 #endif
88 
89 #endif /* PAL_BTN_H */
PalBtnPos_t
Button position.
Definition: pal_btn.h:50
PalBtnState_t
Operational states.
Definition: pal_btn.h:42
Platform-independent data types.
void(* PalBtnActionCback_t)(uint8_t btnId, PalBtnPos_t state)
Action callback signature.
Definition: pal_btn.h:58
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.