-
-
Save Tungsteno74/07afa6c58338d49aac8927605066a2d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <Adafruit_GFX.h> // Core graphics library | |
#include <Adafruit_ILI9341.h> // Hardware-specific library | |
#include "UGUI.h" | |
#define LCD_CS A3 // Chip Select goes to Analog 3 | |
#define LCD_CD A2 // Command/Data goes to Analog 2 | |
#define LCD_WR A1 // LCD Write goes to Analog 1 | |
#define LCD_RD A0 // LCD Read goes to Analog 0 | |
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin | |
static Adafruit_ILI9341_AS8 tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); | |
void UserSetPixel (UG_S16 x, UG_S16 y, UG_COLOR c) { | |
tft.drawPixel(x, y, c); | |
} | |
void setup(void) { | |
/* Configure LCD display */ | |
tft.reset(); | |
delay(3); | |
tft.begin(); | |
tft.invertDisplay(1); | |
tft.setRotation(2); | |
/* Configure uGUI */ | |
UG_GUI gui; | |
UG_Init(gui, UserSetPixel , 240, 320); | |
/* Draw text with uGUI */ | |
UG_FontSelect(&FONT_5X8); | |
UG_ConsoleSetArea(0, 0, 230, 300); | |
UG_ConsoleSetBackcolor(C_BLACK); | |
UG_ConsoleSetForecolor(C_RED); | |
UG_ConsolePutString("Beginning System Initialization...\n"); | |
UG_ConsoleSetForecolor(C_GREEN); | |
UG_ConsolePutString("System Initialization Complete\n"); | |
} | |
void loop(void) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __UGUI_CONFIG_H | |
#define __UGUI_CONFIG_H | |
/* -------------------------------------------------------------------------------- */ | |
/* -- CONFIG SECTION -- */ | |
/* -------------------------------------------------------------------------------- */ | |
//#define USE_MULTITASKING | |
/* Enable color mode */ | |
//#define USE_COLOR_RGB888 // RGB = 0xFF,0xFF,0xFF | |
#define USE_COLOR_RGB565 // RGB = 0bRRRRRGGGGGGBBBBB | |
/* Enable needed fonts here */ | |
//#define USE_FONT_4X6 | |
#define USE_FONT_5X8 | |
//#define USE_FONT_5X12 | |
//#define USE_FONT_6X8 | |
//#define USE_FONT_6X10 | |
//#define USE_FONT_7X12 | |
//#define USE_FONT_8X8 | |
//#define USE_FONT_8X12_CYRILLIC | |
//#define USE_FONT_8X12 | |
//#define USE_FONT_8X12 | |
//#define USE_FONT_8X14 | |
//#define USE_FONT_10X16 | |
//#define USE_FONT_12X16 | |
//#define USE_FONT_12X20 | |
//#define USE_FONT_16X26 | |
//#define USE_FONT_22X36 | |
//#define USE_FONT_24X40 | |
//#define USE_FONT_32X53 | |
/* Specify platform-dependent integer types here */ | |
#define __UG_FONT_DATA const | |
typedef uint8_t UG_U8; | |
typedef int8_t UG_S8; | |
typedef uint16_t UG_U16; | |
typedef int16_t UG_S16; | |
typedef uint32_t UG_U32; | |
typedef int32_t UG_S32; | |
/* Example for dsPIC33 | |
typedef unsigned char UG_U8; | |
typedef signed char UG_S8; | |
typedef unsigned int UG_U16; | |
typedef signed int UG_S16; | |
typedef unsigned long int UG_U32; | |
typedef signed long int UG_S32; | |
*/ | |
/* -------------------------------------------------------------------------------- */ | |
/* -------------------------------------------------------------------------------- */ | |
/* Feature enablers */ | |
#define USE_PRERENDER_EVENT | |
#define USE_POSTRENDER_EVENT | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment