66 #define FRAME_START_X 1 //x-Coordinate of the top-left point of the frame rectangle on display
67 #define FRAME_START_Y 41 //y-Coordinate of the top-left point of the frame rectangle on display
68 #define FRAME_WIDTH 318 //Width of the video frame
69 #define FRAME_HEIGHT 198 //Height of the video frame
70 #define FRAME_END_X FRAME_START_X +FRAME_WIDTH-1 //x-Coordinate of the bottom-right point of the frame rectangle
71 #define FRAME_END_Y FRAME_START_Y +FRAME_HEIGHT-1 //y-Coordinate of the bottom-right point of the frame rectangle
79 switch (triggeredAction) {
140 if (num_blocks <= 0) {
144 uint16_t x = blocks[0].
x;
145 uint16_t y = blocks[0].
y;
153 xset = (xset < 0) ? 0 : xset;
154 xset = (xset > 1000) ? 1000 : xset;
156 yset = (yset < 0) ? 0 : yset;
157 yset = (yset > 1000) ? 1000 : yset;
223 tracking_current = NULL;
241 b_back.
text =
"Back";
254 b_select.
text =
"Select Color";
259 c_frame_toggle.
base.
x1 = 50;
260 c_frame_toggle.
base.
x2 = 50 + 16;
261 c_frame_toggle.
base.
y1 = 5;
262 c_frame_toggle.
base.
y2 = 5 + 16;
279 if (tracking_current == NULL) {
299 tracking_current->
stop(tracking_current);
317 tracking_current->
start(tracking_current);
331 #define BLOCK_BUFFER_SIZE 5 //The maximum amount of blocks that we want to receive
332 struct Block blocks[BLOCK_BUFFER_SIZE];
335 if (blocks_received >= 0) {
336 tracking_current->
update(tracking_current, blocks, blocks_received);
339 for (
int i = 0; i < blocks_received; i++) {
340 struct Block* block = &(blocks[i]);
352 tracking_current->
stop(tracking_current);
359 b_select.
text =
"Abort";
370 if (point1.
x > point2.
x) {
376 if (point1.
y > point2.
y) {
391 b_select.
text =
"Select Color";
394 tracking_current->
start(tracking_current);
bool touch_register_area(TOUCH_AREA_STRUCT *area)
const char * text
The label of the button.
uint16_t txtcolor
The 16-bit text color.
Receive an event when the pen goes down inside the region.
static void leave(void *screen)
Receive an event when the pen goes up inside the region.
bool gui_checkbox_add(CHECKBOX_STRUCT *checkbox)
static TRACKING_CONFIG_STRUCT tracking_our
uint16_t y1
Top Left Y-Coordinate of Area.
uint16_t y
The Y-Coordinate of the point.
void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char *text)
void tracking_set_mode(enum Tracking_Implementation impl)
void(* TRACKING_VOID_CALLBACK)(void *tracking_config)
uint16_t x
The X-Coordinate of the point.
void gui_checkbox_remove(CHECKBOX_STRUCT *checkbox)
uint16_t x1
Top Left X-Coordinate of Area.
bool checked
A boolean which indicates whether or not the checkbox is currently checked.
static TRACKING_CONFIG_STRUCT * tracking_current
uint16_t bgcolor
The 16-bit background color of the button.
TOUCH_AREA_STRUCT base
Basic geometry of the button. You only need to set the x1, y1, x2, y2 members of this struct...
void touch_unregister_area(TOUCH_AREA_STRUCT *area)
void tracking_our_update(void *tracking_config, struct Block *blocks, int num_blocks)
int pixy_blocks_are_new()
Indicates when new block data from Pixy is received.
uint16_t y2
Bottom Right Y-Coordinate of Area.
static void c_frame_toggle_cb(void *checkbox, bool checked)
Pixy's internal tracking implementation.
static void update(void *screen)
int16_t pixy_PID_X(int16_t x, int16_t w)
void tracking_reference_stop(void *tracking_config)
TOUCH_CALLBACK callback
Callback which is executed when an event occurred in this Area.
void tracking_reference_update(void *tracking_config, struct Block *blocks, int num_blocks)
void tracking_reference_start(void *tracking_config)
int pixy_command(const char *name,...)
Send a command to Pixy.
void tft_clear(uint16_t color)
uint16_t x2
Bottom Right X-Coordinate of Area.
TRACKING_VOID_CALLBACK start
#define CHECKBOX_WIN_FG_COLOR
static BUTTON_STRUCT b_select
static POINT_STRUCT point1
TRACKING_VOID_CALLBACK stop
POINT_STRUCT touch_get_last_point()
void tft_fill_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
void(* TRACKING_BLOCK_CALLBACK)(void *tracking_config, struct Block *blocks, int num_blocks)
static TOUCH_AREA_STRUCT a_area
int pixy_init()
Creates a connection with Pixy and listens for Pixy messages.
static volatile bool frame_visible
TOUCH_ACTION hookedActions
Actions to listen to.
int pixy_rcs_set_position(uint8_t channel, uint16_t position)
Set pixy servo axis position.
void tft_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
SCREEN_STRUCT * get_screen_tracking()
void tracking_our_stop(void *tracking_config)
static TRACKING_CONFIG_STRUCT tracking_reference
void tracking_our_start(void *tracking_config)
static SCREEN_STRUCT screen
static void enter(void *screen)
TRACKING_BLOCK_CALLBACK update
TOUCH_AREA_STRUCT base
Basic geometry of the Checkbox. You only need to set the x1, y1, x2, y2 members of this struct...
int16_t pixy_PID_Y(int16_t x, int16_t w)
static void b_select_cb(void *button)
uint16_t fgcolor
The 16-bit color of the tickmark.
static BUTTON_STRUCT b_back
BUTTON_CALLBACK callback
Callback which is executed when the button is pressed.
static CHECKBOX_STRUCT c_frame_toggle
int pixy_render_full_frame(uint16_t x, uint16_t y)
int pixy_cc_set_region(uint8_t signum, uint16_t xoffset, uint16_t yoffset, uint16_t width, uint16_t height)
static POINT_STRUCT point2
int pixy_get_blocks(uint16_t max_blocks, struct Block *blocks)
Copies up to 'max_blocks' number of Blocks to the address pointed to by 'blocks'. ...
CHECKBOX_CALLBACK callback
Callback which is executed when the checkbox changes state.
uint8_t font
The number of the font to use.
Our own tracking PID implementation.
int pixy_led_set_RGB(uint8_t red, uint8_t green, uint8_t blue)
Set color of pixy LED.
static void b_back_cb(void *button)
static void touchCB(void *touchArea, TOUCH_ACTION triggeredAction)