|
@@ -70,11 +70,18 @@ int main(void) {
|
|
*/
|
|
*/
|
|
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
|
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Buttons
|
|
|
|
+ */
|
|
|
|
+ buttons_Init(bha);
|
|
|
|
+ BTNS_ON;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* LCD
|
|
* LCD
|
|
*/
|
|
*/
|
|
ST7735_Init();
|
|
ST7735_Init();
|
|
lcd_MainScreen();
|
|
lcd_MainScreen();
|
|
|
|
+ chThdSleepMilliseconds(2000);
|
|
lcd_ClearMain();
|
|
lcd_ClearMain();
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -99,17 +106,17 @@ int main(void) {
|
|
static void lcd_MainScreen(void) {
|
|
static void lcd_MainScreen(void) {
|
|
ST7735_FillScreen(Black);
|
|
ST7735_FillScreen(Black);
|
|
|
|
|
|
- ST7735_WriteString(47, 48, "Heater", Font_11x18, Yellow, Black);
|
|
|
|
- ST7735_WriteString(52, 68, "Power", Font_11x18, Yellow, Black);
|
|
|
|
- ST7735_WriteString(25, 88, "Stabilizer", Font_11x18, Yellow, Black);
|
|
|
|
- chThdSleepMilliseconds(2000);
|
|
|
|
|
|
+ ST7735_WriteString(47, 38, "Heater", Font_11x18, Yellow, Black);
|
|
|
|
+ ST7735_WriteString(52, 58, "Power", Font_11x18, Yellow, Black);
|
|
|
|
+ ST7735_WriteString(25, 78, "Stabilizer", Font_11x18, Yellow, Black);
|
|
|
|
+ chThdSleepMilliseconds(1000);
|
|
|
|
|
|
/* top info line */
|
|
/* top info line */
|
|
- ST7735_FillRectangle(0, 18, ST7735_WIDTH, 1, White);
|
|
|
|
- ST7735_FillRectangle( 119, 0, 1, 18, White); // separator
|
|
|
|
|
|
+ ST7735_FillRectangle(0, 19, ST7735_WIDTH, 1, White);
|
|
|
|
+ ST7735_FillRectangle( 79, 0, 1, 19, White); // separator
|
|
|
|
|
|
- ST7735_WriteString(0, 0, "Line V", Font_11x18, Red, Black);
|
|
|
|
- ST7735_WriteString(120, 0, "Heater W", Font_11x18, Red, Black);
|
|
|
|
|
|
+ ST7735_WriteString(0, 0, " .... V", Font_11x18, Red, Black);
|
|
|
|
+ ST7735_WriteString(80, 0, " .... W", Font_11x18, Red, Black);
|
|
|
|
|
|
/* bottom status line */
|
|
/* bottom status line */
|
|
ST7735_FillRectangle(0, 117, ST7735_WIDTH, 1, White);
|
|
ST7735_FillRectangle(0, 117, ST7735_WIDTH, 1, White);
|
|
@@ -127,7 +134,7 @@ static void lcd_ClearMain(void) {
|
|
ST7735_FillRectangle(0, 20, ST7735_WIDTH, 97, Black);
|
|
ST7735_FillRectangle(0, 20, ST7735_WIDTH, 97, Black);
|
|
}
|
|
}
|
|
|
|
|
|
-static void btn1_handler(const button_state_t) {
|
|
|
|
|
|
+static void btn1_handler(const button_state_t state) {
|
|
if (state == BTN_st_Pressed) {
|
|
if (state == BTN_st_Pressed) {
|
|
ST7735_WriteString(0, 118, " + ", LiberM_7x10, Black, Grey);
|
|
ST7735_WriteString(0, 118, " + ", LiberM_7x10, Black, Grey);
|
|
chThdSleepMilliseconds(500);
|
|
chThdSleepMilliseconds(500);
|
|
@@ -135,7 +142,7 @@ static void btn1_handler(const button_state_t) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void btn2_handler(const button_state_t) {
|
|
|
|
|
|
+static void btn2_handler(const button_state_t state) {
|
|
if (state == BTN_st_Pressed) {
|
|
if (state == BTN_st_Pressed) {
|
|
ST7735_WriteString(40, 118, " - ", LiberM_7x10, Black, Grey);
|
|
ST7735_WriteString(40, 118, " - ", LiberM_7x10, Black, Grey);
|
|
chThdSleepMilliseconds(500);
|
|
chThdSleepMilliseconds(500);
|
|
@@ -143,7 +150,7 @@ static void btn2_handler(const button_state_t) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void btn3_handler(const button_state_t) {
|
|
|
|
|
|
+static void btn3_handler(const button_state_t state) {
|
|
if (state == BTN_st_Pressed) {
|
|
if (state == BTN_st_Pressed) {
|
|
ST7735_WriteString(80, 118, " R ", LiberM_7x10, Black, Grey);
|
|
ST7735_WriteString(80, 118, " R ", LiberM_7x10, Black, Grey);
|
|
chThdSleepMilliseconds(500);
|
|
chThdSleepMilliseconds(500);
|
|
@@ -151,7 +158,7 @@ static void btn3_handler(const button_state_t) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void btn4_handler(const button_state_t) {
|
|
|
|
|
|
+static void btn4_handler(const button_state_t state) {
|
|
if (state == BTN_st_Pressed) {
|
|
if (state == BTN_st_Pressed) {
|
|
ST7735_WriteString(120, 118, " S ", LiberM_7x10, Black, Grey);
|
|
ST7735_WriteString(120, 118, " S ", LiberM_7x10, Black, Grey);
|
|
chThdSleepMilliseconds(500);
|
|
chThdSleepMilliseconds(500);
|