Core2 for AWS IoT EduKit BSP
1.5.1
core2forAWS
button
button.h
Go to the documentation of this file.
1
6
#pragma once
7
8
#include "stdio.h"
9
13
/* @[declare_button_pressevent] */
14
typedef
enum
{
15
PRESS
= (1 << 0),
16
RELEASE
= (1 << 1),
17
LONGPRESS
= (1 << 2),
18
}
PressEvent
;
19
/* @[declare_button_pressevent] */
20
27
/* @[declare_button_button_t] */
28
typedef
struct
_Button_t {
29
uint16_t
x
;
30
uint16_t
y
;
31
uint16_t
w
;
32
uint16_t
h
;
34
uint8_t
value
;
35
uint8_t
last_value
;
36
uint32_t
last_press_time
;
37
uint32_t
long_press_time
;
38
uint8_t
state
;
39
struct
_Button_t*
next
;
40
}
Button_t
;
41
/* @[declare_button_button_t] */
42
49
/* @[declare_button_init] */
50
void
Button_Init
();
51
/* @[declare_button_init] */
52
65
/* @[declare_button_attach] */
66
Button_t
*
Button_Attach
(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
67
/* @[declare_button_attach] */
68
77
/* @[declare_button_waspressed] */
78
uint8_t
Button_WasPressed
(
Button_t
* button);
79
/* @[declare_button_waspressed] */
80
89
/* @[declare_button_wasreleased] */
90
uint8_t
Button_WasReleased
(
Button_t
* button);
91
/* @[declare_button_wasreleased] */
92
101
/* @[declare_button_ispress] */
102
uint8_t
Button_IsPress
(
Button_t
* button);
103
/* @[declare_button_ispress] */
104
113
/* @[declare_button_isrelease] */
114
uint8_t
Button_IsRelease
(
Button_t
* button);
115
/* @[declare_button_isrelease] */
116
126
/* @[declare_button_waslongpress] */
127
uint8_t
Button_WasLongPress
(
Button_t
* button, uint32_t long_press_time);
128
/* @[declare_button_waslongpress] */
Button_Attach
Button_t * Button_Attach(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Create a virtual button based on locations and size of the button area. The Core2 for AWS IoT EduKit ...
Definition:
button.c:18
Button_Init
void Button_Init()
Initializes the virtual buttons using the FT6336U touch controller.
Definition:
button.c:13
Button_WasReleased
uint8_t Button_WasReleased(Button_t *button)
See if the specified button press was released.
Definition:
button.c:51
Button_WasPressed
uint8_t Button_WasPressed(Button_t *button)
See if the specified button was pressed.
Definition:
button.c:43
Button_IsPress
uint8_t Button_IsPress(Button_t *button)
See if the specified button is currently being pressed.
Definition:
button.c:68
Button_WasLongPress
uint8_t Button_WasLongPress(Button_t *button, uint32_t long_press_time)
See if the specified button press was a long press.
Definition:
button.c:59
Button_IsRelease
uint8_t Button_IsRelease(Button_t *button)
See if the specified button press is currently released.
Definition:
button.c:75
PressEvent
PressEvent
List of possible virtual button press events.
Definition:
button.h:14
PRESS
@ PRESS
Virtual button was pressed.
Definition:
button.h:15
LONGPRESS
@ LONGPRESS
Virtual button was long pressed.
Definition:
button.h:17
RELEASE
@ RELEASE
Virtual button was released.
Definition:
button.h:16
Button_t
The member defintions of the virtual button data.
Definition:
button.h:28
Button_t::next
struct _Button_t * next
Pointer to the next virtual button.
Definition:
button.h:39
Button_t::value
uint8_t value
Current virtual button touched state.
Definition:
button.h:34
Button_t::x
uint16_t x
Virtual button touch starting point in the X-coordinate plane.
Definition:
button.h:29
Button_t::state
uint8_t state
The button press event.
Definition:
button.h:38
Button_t::y
uint16_t y
Virtual button touch starting point in the Y-coordinate plane.
Definition:
button.h:30
Button_t::last_value
uint8_t last_value
Previous virtual button touched state.
Definition:
button.h:35
Button_t::w
uint16_t w
Virtual button touched width from the starting point in the X-coordinate plane.
Definition:
button.h:31
Button_t::long_press_time
uint32_t long_press_time
Number of FreeRTOS ticks to elapse to consider holding the touch button a long press.
Definition:
button.h:37
Button_t::h
uint16_t h
Virtual button touched height from the starting point in the y-coordinate plane.
Definition:
button.h:32
Button_t::last_press_time
uint32_t last_press_time
FreeRTOS ticks when virtual button was last touched.
Definition:
button.h:36
Generated by
1.9.3