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