// // FILE: [sd_card_formatter.ino] // Created by GUIslice Builder version: [0.15.b004] // // GUIslice Builder Generated File // // For the latest guides, updates and support view: // https://github.com/ImpulseAdventure/GUIslice // // // ------------------------------------------------ // Headers to include // ------------------------------------------------ // // Varous system includes #include // Various library includes #include #include #include #include #include // Various local includes #include "sd_card_formatter_GSLC.h" // // ------------------------------------------------ // Program Globals // ------------------------------------------------ // Battery level measurement #define VBATPIN A6 float measuredVBat; int batteryPercent; // TFT Setup #define TFT_CS 9 #define TFT_DC 10 Adafruit_ILI9341 tft(TFT_CS, TFT_DC); // Keyboard BBQ10Keyboard keyboard; #define KBD_BTN_1 0x06 #define KBD_BTN_2 0x11 #define KBD_BTN_3 0x07 #define KBD_BTN_4 0x12 #define KBD_SW_UP 0x01 #define KBD_SW_DN 0x02 #define KBD_SW_LF 0x03 #define KBD_SW_RT 0x04 #define KBD_SW_OK 0x05 CircularBuffer uiKeyBuffer; // NeoPixels #define PIXELS_NUM_BOARD 1 #define PIXELS_NUM_WING 1 #define PIXELS_WING_PIN 11 Adafruit_NeoPixel pixels_board(PIXELS_NUM_BOARD, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels_wing(PIXELS_NUM_WING, PIXELS_WING_PIN, NEO_GRB + NEO_KHZ800); // GUI state globals bool popupOnScreen = false; // Various loop handlers void handlerKeyboard(); void handlerBatteryLevel(); void eraseAndFormatCard(); // Save some element references for direct access // gslc_tsElemRef* m_pElemBatteryLevel= NULL; gslc_tsElemRef* m_pElemBtSDNo = NULL; gslc_tsElemRef* m_pElemBtSDYes = NULL; gslc_tsElemRef* m_pElemSDInfo = NULL; gslc_tsElemRef* m_pElemStatusText = NULL; // // Keyboard map related #define MAX_INPUT_MAP 5 gslc_tsInputMap m_asInputMap[MAX_INPUT_MAP]; // Define debug message function static int16_t DebugOut(char ch) { if (ch == (char)'\n') Serial.println(""); else Serial.write(ch); return 0; } // ------------------------------------------------ // Callback Methods // ------------------------------------------------ // Common Button callback bool CbBtnCommon(void* pvGui,void *pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY) { // Typecast the parameters to match the GUI and element types gslc_tsGui* pGui = (gslc_tsGui*)(pvGui); gslc_tsElemRef* pElemRef = (gslc_tsElemRef*)(pvElemRef); gslc_tsElem* pElem = gslc_GetElemFromRef(pGui,pElemRef); if ( eTouch == GSLC_TOUCH_UP_IN ) { // From the element's ID we can determine which button was pressed. switch (pElem->nId) { //