discoverpixy
Macros | Functions | Variables
screen_main.c File Reference
#include "screen_main.h"
#include "screen_guitest.h"
#include "screen_pixytest.h"
#include "screen_filetest.h"
#include "screen_photomode.h"
#include "screen_tracking.h"
#include "button.h"
#include "tft.h"
#include "filesystem.h"
Include dependency graph for screen_main.c:

Go to the source code of this file.

Macros

#define X_TAB   97
 
#define BUTTON_SPACING   7
 
#define Y_FIRST   60
 
#define Y_SECOND   Y_FIRST+25
 
#define Y_THIRD   Y_SECOND+25
 

Functions

static void b_our_tracking_cb (void *button)
 
static void b_ref_tracking_cb (void *button)
 
static void b_photo_mode_cb (void *button)
 
static void b_guitest_cb (void *button)
 
static void b_filetest_cb (void *button)
 
static void b_pixytest_cb (void *button)
 
static void enter (void *screen)
 
static void leave (void *screen)
 
static void update (void *screen)
 
SCREEN_STRUCTget_screen_main ()
 

Variables

BUTTON_STRUCT b_guitest
 
BUTTON_STRUCT b_pixytest
 
BUTTON_STRUCT b_filetest
 
BUTTON_STRUCT b_our_tracking
 
BUTTON_STRUCT b_ref_tracking
 
BUTTON_STRUCT b_photo_mode
 
static SCREEN_STRUCT screen
 

Macro Definition Documentation

#define BUTTON_SPACING   7
#define X_TAB   97
#define Y_FIRST   60
#define Y_SECOND   Y_FIRST+25
#define Y_THIRD   Y_SECOND+25

Function Documentation

static void b_filetest_cb ( void *  button)
static

Definition at line 60 of file screen_main.c.

61 {
63 }
SCREEN_STRUCT * get_screen_filetest()
bool gui_screen_navigate(SCREEN_STRUCT *screen)
Definition: screen.c:74

Here is the call graph for this function:

Here is the caller graph for this function:

static void b_guitest_cb ( void *  button)
static

Definition at line 55 of file screen_main.c.

56 {
58 }
bool gui_screen_navigate(SCREEN_STRUCT *screen)
Definition: screen.c:74
SCREEN_STRUCT * get_screen_guitest()

Here is the call graph for this function:

Here is the caller graph for this function:

static void b_our_tracking_cb ( void *  button)
static

Definition at line 38 of file screen_main.c.

39 {
42 }
void tracking_set_mode(enum Tracking_Implementation impl)
bool gui_screen_navigate(SCREEN_STRUCT *screen)
Definition: screen.c:74
SCREEN_STRUCT * get_screen_tracking()
Our own tracking PID implementation.

Here is the call graph for this function:

Here is the caller graph for this function:

static void b_photo_mode_cb ( void *  button)
static

Definition at line 50 of file screen_main.c.

51 {
53 }
bool gui_screen_navigate(SCREEN_STRUCT *screen)
Definition: screen.c:74
SCREEN_STRUCT * get_screen_photomode()

Here is the call graph for this function:

Here is the caller graph for this function:

static void b_pixytest_cb ( void *  button)
static

Definition at line 65 of file screen_main.c.

66 {
68 }
SCREEN_STRUCT * get_screen_pixytest()
bool gui_screen_navigate(SCREEN_STRUCT *screen)
Definition: screen.c:74

Here is the call graph for this function:

Here is the caller graph for this function:

static void b_ref_tracking_cb ( void *  button)
static

Definition at line 44 of file screen_main.c.

45 {
48 }
void tracking_set_mode(enum Tracking_Implementation impl)
Pixy's internal tracking implementation.
bool gui_screen_navigate(SCREEN_STRUCT *screen)
Definition: screen.c:74
SCREEN_STRUCT * get_screen_tracking()

Here is the call graph for this function:

Here is the caller graph for this function:

static void enter ( void *  screen)
static

Definition at line 71 of file screen_main.c.

72 {
74 
75  //Heading
76  tft_print_line(10, 10, BLUE, TRANSPARENT, 1, "Discoverpixy");
77  tft_draw_line(0, 40, 319, 40, BLACK);
78 
79 #define X_TAB 97
80 #define BUTTON_SPACING 7
81 
82  //First line of buttons
83 #define Y_FIRST 60
84  tft_print_line(10, Y_FIRST, BLACK, TRANSPARENT, 0, "Tracking:");
85 
86  b_our_tracking.base.x1 = X_TAB; //Start X of Button
87  b_our_tracking.base.y1 = Y_FIRST - 3; //Start Y of Button
88  b_our_tracking.base.x2 = AUTO; //Auto Calculate X2 with String Width
89  b_our_tracking.base.y2 = AUTO; //Auto Calculate Y2 with String Height
90  b_our_tracking.txtcolor = WHITE; //Set foreground color
91  b_our_tracking.bgcolor = HEX(0xE30535); //Set background color (Don't take 255 or 0 on at least one channel, to make shadows possible)
92  b_our_tracking.font = 0; //Select Font
93  b_our_tracking.text = "Our Tracking"; //Set Text (For formatted strings take sprintf)
94  b_our_tracking.callback = b_our_tracking_cb; //Call b_our_tracking when the button get's pressed
95  gui_button_add(&b_our_tracking); //Register Button (and run the callback from now on)
96 
97 
103  b_ref_tracking.bgcolor = HEX(0xFF2151);
104  b_ref_tracking.font = 0;
105  b_ref_tracking.text = "Ref Tracking";
108 
109  //Second line of buttons
110 #define Y_SECOND Y_FIRST+25
111  tft_print_line(10, Y_SECOND, BLACK, TRANSPARENT, 0, "Photo mode:");
112 
118  b_photo_mode.bgcolor = HEX(0x21B1FF);
119  b_photo_mode.font = 0;
120  b_photo_mode.text = "Photo Mode";
123 
124 
125  //Third line of buttons
126 #define Y_THIRD Y_SECOND+25
127  tft_print_line(10, Y_THIRD, BLACK, TRANSPARENT, 0, "Tests:");
128 
130  b_guitest.base.y1 = Y_THIRD - 3;
131  b_guitest.base.x2 = AUTO;
132  b_guitest.base.y2 = AUTO;
134  b_guitest.bgcolor = HEX(0x00FA21);
135  b_guitest.font = 0;
136  b_guitest.text = "Gui & Tft";
139 
140 
142  b_pixytest.base.y1 = Y_THIRD - 3;
146  b_pixytest.bgcolor = HEX(0x00FA96);
147  b_pixytest.font = 0;
148  b_pixytest.text = "Pixy";
151 
152 
154  b_filetest.base.y1 = Y_THIRD - 3;
158  b_filetest.bgcolor = HEX(0x00FAC4);
159  b_filetest.font = 0;
160  b_filetest.text = "File";
163 
164 
165  //Bottom line
166  tft_draw_line(0, 145, 319, 145, BLACK);
167  tft_print_line(10, 150, BLUE, TRANSPARENT, 0, "Powered by");
168  tft_draw_bitmap_file_unscaled(10, 165, "pixy_small.bmp");
169  tft_draw_bitmap_file_unscaled(165, 165, "stm_small.bmp");
170 
171 }
const char * text
The label of the button.
Definition: button.h:61
uint16_t txtcolor
The 16-bit text color.
Definition: button.h:59
#define AUTO
Use this value instead of x2, y2 in the BUTTON_STRUCT to autocalculate the button width/height...
Definition: button.h:65
void tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Definition: tft.c:50
uint16_t y1
Top Left Y-Coordinate of Area.
Definition: touch.h:75
static void b_our_tracking_cb(void *button)
Definition: screen_main.c:38
bool gui_button_add(BUTTON_STRUCT *button)
Definition: button.c:133
void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char *text)
Definition: tft.c:98
uint16_t x1
Top Left X-Coordinate of Area.
Definition: touch.h:74
BUTTON_STRUCT b_guitest
Definition: screen_main.c:29
static void b_photo_mode_cb(void *button)
Definition: screen_main.c:50
#define TRANSPARENT
Definition: tft.h:66
uint16_t bgcolor
The 16-bit background color of the button.
Definition: button.h:57
TOUCH_AREA_STRUCT base
Basic geometry of the button. You only need to set the x1, y1, x2, y2 members of this struct...
Definition: button.h:56
#define X_TAB
#define Y_SECOND
#define HEX(h)
Definition: tft.h:60
BUTTON_STRUCT b_photo_mode
Definition: screen_main.c:35
uint16_t y2
Bottom Right Y-Coordinate of Area.
Definition: touch.h:77
bool tft_draw_bitmap_file_unscaled(uint16_t x, uint16_t y, const char *filename)
Definition: tft.c:123
void tft_clear(uint16_t color)
Definition: tft.c:45
uint16_t x2
Bottom Right X-Coordinate of Area.
Definition: touch.h:76
BUTTON_STRUCT b_ref_tracking
Definition: screen_main.c:34
static void b_guitest_cb(void *button)
Definition: screen_main.c:55
#define WHITE
Definition: tft.h:53
#define Y_FIRST
BUTTON_STRUCT b_filetest
Definition: screen_main.c:31
BUTTON_STRUCT b_our_tracking
Definition: screen_main.c:33
static void b_pixytest_cb(void *button)
Definition: screen_main.c:65
#define BLUE
Definition: tft.h:52
BUTTON_CALLBACK callback
Callback which is executed when the button is pressed.
Definition: button.h:58
static void b_ref_tracking_cb(void *button)
Definition: screen_main.c:44
uint8_t font
The number of the font to use.
Definition: button.h:60
static void b_filetest_cb(void *button)
Definition: screen_main.c:60
#define Y_THIRD
#define BUTTON_SPACING
BUTTON_STRUCT b_pixytest
Definition: screen_main.c:30
#define BLACK
Definition: tft.h:54

Here is the call graph for this function:

static void leave ( void *  screen)
static

Definition at line 173 of file screen_main.c.

174 {
181 }
BUTTON_STRUCT b_guitest
Definition: screen_main.c:29
BUTTON_STRUCT b_photo_mode
Definition: screen_main.c:35
BUTTON_STRUCT b_ref_tracking
Definition: screen_main.c:34
void gui_button_remove(BUTTON_STRUCT *button)
Definition: button.c:184
BUTTON_STRUCT b_filetest
Definition: screen_main.c:31
BUTTON_STRUCT b_our_tracking
Definition: screen_main.c:33
BUTTON_STRUCT b_pixytest
Definition: screen_main.c:30

Here is the call graph for this function:

static void update ( void *  screen)
static

Definition at line 183 of file screen_main.c.

184 {
185  //gui_button_redraw(&b_guitest); //only needed if button is overdrawn by others
186 }

Variable Documentation

BUTTON_STRUCT b_filetest

Definition at line 31 of file screen_main.c.

BUTTON_STRUCT b_guitest

Definition at line 29 of file screen_main.c.

BUTTON_STRUCT b_our_tracking

Definition at line 33 of file screen_main.c.

BUTTON_STRUCT b_photo_mode

Definition at line 35 of file screen_main.c.

BUTTON_STRUCT b_pixytest

Definition at line 30 of file screen_main.c.

BUTTON_STRUCT b_ref_tracking

Definition at line 34 of file screen_main.c.

SCREEN_STRUCT screen
static
Initial value:
= {
}
static void enter(void *screen)
Definition: screen_main.c:71
static void leave(void *screen)
Definition: screen_main.c:173
static void update(void *screen)
Definition: screen_main.c:183

Definition at line 189 of file screen_main.c.