Move color definitions to their own file

This commit is contained in:
Reed Nightingale 2020-02-09 15:56:43 -08:00
parent 5fb47187a6
commit e2249af826
9 changed files with 63 additions and 42 deletions

22
color_theme.h Normal file
View File

@ -0,0 +1,22 @@
#pragma once
#include "colors.h"
static const unsigned int COLOR_TEXT = DISPLAY_WHITE;
static const unsigned int COLOR_BACKGROUND = DISPLAY_NAVY;
static const unsigned int COLOR_ACTIVE_VFO_TEXT = DISPLAY_WHITE;
static const unsigned int COLOR_ACTIVE_VFO_BACKGROUND = DISPLAY_BLACK;
static const unsigned int COLOR_INACTIVE_VFO_TEXT = DISPLAY_GREEN;
static const unsigned int COLOR_INACTIVE_VFO_BACKGROUND = DISPLAY_BLACK;
static const unsigned int COLOR_INACTIVE_TEXT = DISPLAY_GREEN;
static const unsigned int COLOR_INACTIVE_BACKGROUND = DISPLAY_BLACK;
static const unsigned int COLOR_INACTIVE_BORDER = DISPLAY_DARKGREY;
static const unsigned int COLOR_ACTIVE_TEXT = DISPLAY_BLACK;
static const unsigned int COLOR_ACTIVE_BACKGROUND = DISPLAY_ORANGE;
static const unsigned int COLOR_ACTIVE_BORDER = DISPLAY_WHITE;
static const unsigned int COLOR_VERSION_TEXT = DISPLAY_LIGHTGREY;

20
colors.h Normal file
View File

@ -0,0 +1,20 @@
// Color definitions
#define DISPLAY_BLACK 0x0000 ///< 0, 0, 0
#define DISPLAY_NAVY 0x000F ///< 0, 0, 123
#define DISPLAY_DARKGREEN 0x03E0 ///< 0, 125, 0
#define DISPLAY_DARKCYAN 0x03EF ///< 0, 125, 123
#define DISPLAY_MAROON 0x7800 ///< 123, 0, 0
#define DISPLAY_PURPLE 0x780F ///< 123, 0, 123
#define DISPLAY_OLIVE 0x7BE0 ///< 123, 125, 0
#define DISPLAY_LIGHTGREY 0xC618 ///< 198, 195, 198
#define DISPLAY_DARKGREY 0x7BEF ///< 123, 125, 123
#define DISPLAY_BLUE 0x001F ///< 0, 0, 255
#define DISPLAY_GREEN 0x07E0 ///< 0, 255, 0
#define DISPLAY_CYAN 0x07FF ///< 0, 255, 255
#define DISPLAY_RED 0xF800 ///< 255, 0, 0
#define DISPLAY_MAGENTA 0xF81F ///< 255, 0, 255
#define DISPLAY_YELLOW 0xFFE0 ///< 255, 255, 0
#define DISPLAY_WHITE 0xFFFF ///< 255, 255, 255
#define DISPLAY_ORANGE 0xFD20 ///< 255, 165, 0
#define DISPLAY_GREENYELLOW 0xAFE5 ///< 173, 255, 41
#define DISPLAY_PINK 0xFC18 ///< 255, 130, 198

View File

@ -1,4 +1,7 @@
#include "menu.h"
#include "button.h"
#include "color_theme.h"
#include "nano_gui.h"
bool runSubmenu(Menu_t* const current_menu,

6
menu.h
View File

@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
#include "button.h"
#include "nano_gui.h"//Point
enum MenuReturn_e : uint8_t {
@ -31,4 +32,7 @@ bool runSubmenu(Menu_t* current_menu,
const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,
const int16_t knob);
const int16_t knob);
void movePuck(const Button *const b_old,
const Button *const b_new);

View File

@ -1,5 +1,7 @@
#include "menu_main.h"
#include <avr/pgmspace.h>
#include "button.h"
#include "morse.h"
#include "settings.h"
@ -21,6 +23,8 @@ Menu_t* const rootMenu = &mainMenu;
bool mainMenuSelecting = false;//Tracks if we're selecting buttons with knob, or adjusting frequency
uint8_t mainMenuSelectedItemRaw = 0;
const Button mainMenuButtons [] PROGMEM = {};
void drawMainMenu(void)
{
//TODO
@ -64,6 +68,8 @@ MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
touch_point,
knob)){
//Submenu processed the input, so return now
mainMenuSelectedItemRaw = 0;
mainMenuSelecting = false;
return MenuReturn_e::StillActive;//main menu always returns StillActive
}//end submenu
@ -84,6 +90,9 @@ MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
uint8_t menu_index = mainMenuSelectedItemRaw/MENU_KNOB_COUNTS_PER_ITEM;
//TODO: activate button
}
else{
movePuck(nullptr,&mainMenuButtons[0]);
}
mainMenuSelecting = !mainMenuSelecting;
//Don't handle touch or knob on this run
@ -125,7 +134,7 @@ MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
mainMenuSelectedItemRaw += LIMIT(mainMenuSelectedItemRaw+knob,0,MAIN_MENU_NUM_BUTTONS*MENU_KNOB_COUNTS_PER_ITEM);
const uint8_t new_select = mainMenuSelectedItemRaw/MENU_KNOB_COUNTS_PER_ITEM;
if(prev_select != new_select){
movePuck(/*button[prev],button[new]*/);//TODO
movePuck(&mainMenuButtons[prev_select],&mainMenuButtons[new_select]);//TODO
}
}
else{

View File

@ -1,4 +1,5 @@
#include <Arduino.h>
#include "colors.h"
#include "settings.h"
#include "ubitx.h"
#include "nano_gui.h"

View File

@ -31,27 +31,6 @@ bool readTouch();
void scaleTouch(struct Point *p);
// Color definitions
#define DISPLAY_BLACK 0x0000 ///< 0, 0, 0
#define DISPLAY_NAVY 0x000F ///< 0, 0, 123
#define DISPLAY_DARKGREEN 0x03E0 ///< 0, 125, 0
#define DISPLAY_DARKCYAN 0x03EF ///< 0, 125, 123
#define DISPLAY_MAROON 0x7800 ///< 123, 0, 0
#define DISPLAY_PURPLE 0x780F ///< 123, 0, 123
#define DISPLAY_OLIVE 0x7BE0 ///< 123, 125, 0
#define DISPLAY_LIGHTGREY 0xC618 ///< 198, 195, 198
#define DISPLAY_DARKGREY 0x7BEF ///< 123, 125, 123
#define DISPLAY_BLUE 0x001F ///< 0, 0, 255
#define DISPLAY_GREEN 0x07E0 ///< 0, 255, 0
#define DISPLAY_CYAN 0x07FF ///< 0, 255, 255
#define DISPLAY_RED 0xF800 ///< 255, 0, 0
#define DISPLAY_MAGENTA 0xF81F ///< 255, 0, 255
#define DISPLAY_YELLOW 0xFFE0 ///< 255, 255, 0
#define DISPLAY_WHITE 0xFFFF ///< 255, 255, 255
#define DISPLAY_ORANGE 0xFD20 ///< 255, 165, 0
#define DISPLAY_GREENYELLOW 0xAFE5 ///< 173, 255, 41
#define DISPLAY_PINK 0xFC18 ///< 255, 130, 198
#define TEXT_LINE_HEIGHT 18
#define TEXT_LINE_INDENT 5

View File

@ -1,4 +1,5 @@
#include <Arduino.h>
#include "colors.h"
#include "morse.h"
#include "nano_gui.h"
#include "setup.h"

View File

@ -1,5 +1,6 @@
#include <Arduino.h>
#include "button.h"
#include "color_theme.h"
#include "morse.h"
#include "nano_gui.h"
#include "settings.h"
@ -7,25 +8,6 @@
#include "ubitx.h"
#include "version.h"
static const unsigned int COLOR_TEXT = DISPLAY_WHITE;
static const unsigned int COLOR_BACKGROUND = DISPLAY_NAVY;
static const unsigned int COLOR_ACTIVE_VFO_TEXT = DISPLAY_WHITE;
static const unsigned int COLOR_ACTIVE_VFO_BACKGROUND = DISPLAY_BLACK;
static const unsigned int COLOR_INACTIVE_VFO_TEXT = DISPLAY_GREEN;
static const unsigned int COLOR_INACTIVE_VFO_BACKGROUND = DISPLAY_BLACK;
static const unsigned int COLOR_INACTIVE_TEXT = DISPLAY_GREEN;
static const unsigned int COLOR_INACTIVE_BACKGROUND = DISPLAY_BLACK;
static const unsigned int COLOR_INACTIVE_BORDER = DISPLAY_DARKGREY;
static const unsigned int COLOR_ACTIVE_TEXT = DISPLAY_BLACK;
static const unsigned int COLOR_ACTIVE_BACKGROUND = DISPLAY_ORANGE;
static const unsigned int COLOR_ACTIVE_BORDER = DISPLAY_WHITE;
static const unsigned int COLOR_VERSION_TEXT = DISPLAY_LIGHTGREY;
static const unsigned int LAYOUT_VFO_LABEL_X = 0;
static const unsigned int LAYOUT_VFO_LABEL_Y = 10;
static const unsigned int LAYOUT_VFO_LABEL_WIDTH = 159;