mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
update
This commit is contained in:
@@ -81,11 +81,11 @@
|
||||
#include "SD.h"
|
||||
#include "esp32-hal-dac.h"
|
||||
#include <utility/Display.h>
|
||||
#include <utility/bmp_map.h>
|
||||
#include <utility/config.h>
|
||||
#include <utility/Button.h>
|
||||
#include <utility/Speaker.h>
|
||||
#include <utility/music_8bit.h>
|
||||
#include "utility/bmp_map.h"
|
||||
#include "utility/music_8bit.h"
|
||||
|
||||
extern "C" {
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
||||
@@ -106,7 +106,7 @@ void startup_logo() {
|
||||
for(int i=0; i<length; i++) {
|
||||
dacWrite(SPEAKER_PIN, m5stack_startup_music[i]>>2);
|
||||
delayMicroseconds(40);
|
||||
brightness = (i/156);
|
||||
brightness = (i/157);
|
||||
if(pre_b != brightness) {
|
||||
pre_b = brightness;
|
||||
m5.lcd.setBrightness(brightness);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,231 +0,0 @@
|
||||
/******************************************************************
|
||||
This is our library for the Adafruit ILI9341 Breakout and Shield
|
||||
----> http://www.adafruit.com/products/1651
|
||||
|
||||
Check out the links above for our tutorials and wiring diagrams
|
||||
These displays use SPI to communicate, 4 or 5 pins are required
|
||||
to interface (RST is optional)
|
||||
Adafruit invests time and resources providing this open source
|
||||
code, please support Adafruit and open-source hardware by
|
||||
purchasing products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
MIT license, all text above must be included in any redistribution
|
||||
*******************************************************************/
|
||||
|
||||
#ifndef _DISPLAY_H_
|
||||
#define _DISPLAY_H_
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#include "Print.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
#include <SPI.h>
|
||||
#include <utility/Adafruit_GFX.h>
|
||||
// #include <GFX_Library/dafruit_GFX.h>
|
||||
#include <utility/Config.h>
|
||||
|
||||
#define ILI9341_TFTWIDTH 320
|
||||
#define ILI9341_TFTHEIGHT 240
|
||||
|
||||
#define ILI9341_NOP 0x00
|
||||
#define ILI9341_SWRESET 0x01
|
||||
#define ILI9341_RDDID 0x04
|
||||
#define ILI9341_RDDST 0x09
|
||||
|
||||
#define ILI9341_SLPIN 0x10
|
||||
#define ILI9341_SLPOUT 0x11
|
||||
#define ILI9341_PTLON 0x12
|
||||
#define ILI9341_NORON 0x13
|
||||
|
||||
#define ILI9341_RDMODE 0x0A
|
||||
#define ILI9341_RDMADCTL 0x0B
|
||||
#define ILI9341_RDPIXFMT 0x0C
|
||||
#define ILI9341_RDIMGFMT 0x0D
|
||||
#define ILI9341_RDSELFDIAG 0x0F
|
||||
|
||||
#define ILI9341_INVOFF 0x20
|
||||
#define ILI9341_INVON 0x21
|
||||
#define ILI9341_GAMMASET 0x26
|
||||
#define ILI9341_DISPOFF 0x28
|
||||
#define ILI9341_DISPON 0x29
|
||||
|
||||
#define ILI9341_CASET 0x2A
|
||||
#define ILI9341_PASET 0x2B
|
||||
#define ILI9341_RAMWR 0x2C
|
||||
#define ILI9341_RAMRD 0x2E
|
||||
|
||||
#define ILI9341_PTLAR 0x30
|
||||
#define ILI9341_MADCTL 0x36
|
||||
#define ILI9341_VSCRSADD 0x37
|
||||
#define ILI9341_PIXFMT 0x3A
|
||||
|
||||
#define ILI9341_FRMCTR1 0xB1
|
||||
#define ILI9341_FRMCTR2 0xB2
|
||||
#define ILI9341_FRMCTR3 0xB3
|
||||
#define ILI9341_INVCTR 0xB4
|
||||
#define ILI9341_DFUNCTR 0xB6
|
||||
|
||||
#define ILI9341_PWCTR1 0xC0
|
||||
#define ILI9341_PWCTR2 0xC1
|
||||
#define ILI9341_PWCTR3 0xC2
|
||||
#define ILI9341_PWCTR4 0xC3
|
||||
#define ILI9341_PWCTR5 0xC4
|
||||
#define ILI9341_VMCTR1 0xC5
|
||||
#define ILI9341_VMCTR2 0xC7
|
||||
|
||||
#define ILI9341_RDID1 0xDA
|
||||
#define ILI9341_RDID2 0xDB
|
||||
#define ILI9341_RDID3 0xDC
|
||||
#define ILI9341_RDID4 0xDD
|
||||
|
||||
#define ILI9341_GMCTRP1 0xE0
|
||||
#define ILI9341_GMCTRN1 0xE1
|
||||
/*
|
||||
#define ILI9341_PWCTR6 0xFC
|
||||
*/
|
||||
|
||||
// Color definitions
|
||||
#define ILI9341_BLACK 0x0000 /* 0, 0, 0 */
|
||||
#define ILI9341_NAVY 0x000F /* 0, 0, 128 */
|
||||
#define ILI9341_DARKGREEN 0x03E0 /* 0, 128, 0 */
|
||||
#define ILI9341_DARKCYAN 0x03EF /* 0, 128, 128 */
|
||||
#define ILI9341_MAROON 0x7800 /* 128, 0, 0 */
|
||||
#define ILI9341_PURPLE 0x780F /* 128, 0, 128 */
|
||||
#define ILI9341_OLIVE 0x7BE0 /* 128, 128, 0 */
|
||||
#define ILI9341_LIGHTGREY 0xC618 /* 192, 192, 192 */
|
||||
#define ILI9341_DARKGREY 0x7BEF /* 128, 128, 128 */
|
||||
#define ILI9341_BLUE 0x001F /* 0, 0, 255 */
|
||||
#define ILI9341_GREEN 0x07E0 /* 0, 255, 0 */
|
||||
#define ILI9341_CYAN 0x07FF /* 0, 255, 255 */
|
||||
#define ILI9341_RED 0xF800 /* 255, 0, 0 */
|
||||
#define ILI9341_MAGENTA 0xF81F /* 255, 0, 255 */
|
||||
#define ILI9341_YELLOW 0xFFE0 /* 255, 255, 0 */
|
||||
#define ILI9341_WHITE 0xFFFF /* 255, 255, 255 */
|
||||
#define ILI9341_ORANGE 0xFD20 /* 255, 165, 0 */
|
||||
#define ILI9341_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
|
||||
#define ILI9341_PINK 0xF81F
|
||||
|
||||
#define BLACK 0x0000 /* 0, 0, 0 */
|
||||
#define NAVY 0x000F /* 0, 0, 128 */
|
||||
#define DARKGREEN 0x03E0 /* 0, 128, 0 */
|
||||
#define DARKCYAN 0x03EF /* 0, 128, 128 */
|
||||
#define MAROON 0x7800 /* 128, 0, 0 */
|
||||
#define PURPLE 0x780F /* 128, 0, 128 */
|
||||
#define OLIVE 0x7BE0 /* 128, 128, 0 */
|
||||
#define LIGHTGREY 0xC618 /* 192, 192, 192 */
|
||||
#define DARKGREY 0x7BEF /* 128, 128, 128 */
|
||||
#define BLUE 0x001F /* 0, 0, 255 */
|
||||
#define GREEN 0x07E0 /* 0, 255, 0 */
|
||||
#define CYAN 0x07FF /* 0, 255, 255 */
|
||||
#define RED 0xF800 /* 255, 0, 0 */
|
||||
#define MAGENTA 0xF81F /* 255, 0, 255 */
|
||||
#define YELLOW 0xFFE0 /* 255, 255, 0 */
|
||||
#define WHITE 0xFFFF /* 255, 255, 255 */
|
||||
#define ORANGE 0xFD20 /* 255, 165, 0 */
|
||||
#define GREENYELLOW 0xAFE5 /* 173, 255, 47 */
|
||||
#define PINK 0xF81F
|
||||
|
||||
#if defined(ESP8266) || defined (ESP32)
|
||||
#define USE_FAST_PINIO
|
||||
#endif
|
||||
|
||||
class ILI9341 : public Adafruit_GFX {
|
||||
protected:
|
||||
|
||||
public:
|
||||
ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1);
|
||||
ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1);
|
||||
|
||||
#ifndef ESP32
|
||||
void begin(uint32_t freq = 0);
|
||||
#else
|
||||
void begin(uint32_t freq = 0, SPIClass &spi=SPI);
|
||||
#endif
|
||||
void setRotation(uint8_t r);
|
||||
void invertDisplay(boolean i);
|
||||
void scrollTo(uint16_t y);
|
||||
|
||||
// Required Non-Transaction
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
|
||||
// Transaction API
|
||||
void startWrite(void);
|
||||
void endWrite(void);
|
||||
void writePixel(int16_t x, int16_t y, uint16_t color);
|
||||
void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
|
||||
// Transaction API not used by GFX
|
||||
void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||
void writePixel(uint16_t color);
|
||||
void writePixels(uint16_t * colors, uint32_t len);
|
||||
void writeColor(uint16_t color, uint32_t len);
|
||||
void pushColor(uint16_t color);
|
||||
|
||||
// Recommended Non-Transaction
|
||||
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
void drawBitmap(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors);
|
||||
void drawBitmap(int16_t x, int16_t y, int16_t w, int16_t h, const uint8_t *pcolors);
|
||||
|
||||
uint8_t readcommand8(uint8_t reg, uint8_t index = 0);
|
||||
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
// via Charles Bailey on stackoverflow:
|
||||
// "Functions in derived classes which don't override functions in base
|
||||
// classes but which have the same name will hide other functions of the
|
||||
// same name in the base class.
|
||||
// "It is generally considered bad practice to have have functions in
|
||||
// derived classes which have the same name as functions in the base
|
||||
// class which aren't intended to override the base class functions as
|
||||
// what you are seeing is not usually desirable behaviour. It is usually
|
||||
// preferable to give different functions different names."
|
||||
// i.e. this function in ILI9341 should not have been called this; it's
|
||||
// fundamentally different from GFX's drawBitmap(). But here we are,
|
||||
// painted into the proverbial corner. C++11 has the 'using' keyword
|
||||
// to allow access to base class functions. This'll band-aid the issue
|
||||
// for now but might be inadequate for "vintage" complier variants that
|
||||
// some board support packages might possibly be using, dunno.
|
||||
using Adafruit_GFX::drawBitmap;
|
||||
void progressBar(int x, int y, int w, int h, uint8_t val);
|
||||
void setBrightness(uint8_t brightness);
|
||||
void putChar(int x, int y, char ch);
|
||||
void putStr(int x, int y, String str);
|
||||
|
||||
private:
|
||||
SPIClass _spi;
|
||||
uint32_t _freq;
|
||||
#if defined (__AVR__) || defined(TEENSYDUINO)
|
||||
int8_t _cs, _dc, _rst, _sclk, _mosi, _miso;
|
||||
#ifdef USE_FAST_PINIO
|
||||
volatile uint8_t *mosiport, *misoport, *clkport, *dcport, *csport;
|
||||
uint8_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask;
|
||||
#endif
|
||||
#elif defined (__arm__)
|
||||
int32_t _cs, _dc, _rst, _sclk, _mosi, _miso;
|
||||
#ifdef USE_FAST_PINIO
|
||||
volatile RwReg *mosiport, *misoport, *clkport, *dcport, *csport;
|
||||
uint32_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask;
|
||||
#endif
|
||||
#elif defined (ESP8266) || defined (ESP32)
|
||||
int8_t _cs, _dc, _rst, _sclk, _mosi, _miso;
|
||||
#ifdef USE_FAST_PINIO
|
||||
volatile uint32_t *mosiport, *misoport, *clkport, *dcport, *csport;
|
||||
uint32_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask;
|
||||
#endif
|
||||
#else
|
||||
int8_t _cs, _dc, _rst, _sclk, _mosi, _miso;
|
||||
#endif
|
||||
|
||||
void writeCommand(uint8_t cmd);
|
||||
void spiWrite(uint8_t v);
|
||||
uint8_t spiRead(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
# Adafruit GFX Library
|
||||
|
||||
This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions).
|
||||
|
||||
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information.
|
||||
All text above must be included in any redistribution.
|
||||
|
||||
Recent Arduino IDE releases include the Library Manager for easy installation. Otherwise, to download, click the DOWNLOAD ZIP button, uncompress and rename the uncompressed folder Adafruit_GFX. Confirm that the Adafruit_GFX folder contains Adafruit_GFX.cpp and Adafruit_GFX.h. Place the Adafruit_GFX library folder your <arduinosketchfolder>/Libraries/ folder. You may need to create the Libraries subfolder if its your first library. Restart the IDE.
|
||||
|
||||
# Useful Resources
|
||||
|
||||
- Image2Code: This is a handy Java GUI utility to convert a BMP file into the array code necessary to display the image with the drawBitmap function. Check out the code at ehubin's GitHub repository: https://github.com/ehubin/Adafruit-GFX-Library/tree/master/Img2Code
|
||||
|
||||
- drawXBitmap function: You can use the GIMP photo editor to save a .xbm file and use the array saved in the file to draw a bitmap with the drawXBitmap function. See the pull request here for more details: https://github.com/adafruit/Adafruit-GFX-Library/pull/31
|
||||
|
||||
- 'Fonts' folder contains bitmap fonts for use with recent (1.1 and later) Adafruit_GFX. To use a font in your Arduino sketch, #include the corresponding .h file and pass address of GFXfont struct to setFont(). Pass NULL to revert to 'classic' fixed-space bitmap font.
|
||||
|
||||
- 'fontconvert' folder contains a command-line tool for converting TTF fonts to Adafruit_GFX .h format.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,211 +0,0 @@
|
||||
#ifndef _DAFRUIT_GFX_H
|
||||
#define _DAFRUIT_GFX_H
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#include "Print.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
#include "gfxfont.h"
|
||||
|
||||
class Adafruit_GFX : public Print {
|
||||
|
||||
public:
|
||||
|
||||
Adafruit_GFX(int16_t w, int16_t h); // Constructor
|
||||
|
||||
// This MUST be defined by the subclass:
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
|
||||
|
||||
// TRANSACTION API / CORE DRAW API
|
||||
// These MAY be overridden by the subclass to provide device-specific
|
||||
// optimized code. Otherwise 'generic' versions are used.
|
||||
virtual void startWrite(void);
|
||||
virtual void writePixel(int16_t x, int16_t y, uint16_t color);
|
||||
virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
|
||||
virtual void endWrite(void);
|
||||
|
||||
// CONTROL API
|
||||
// These MAY be overridden by the subclass to provide device-specific
|
||||
// optimized code. Otherwise 'generic' versions are used.
|
||||
virtual void setRotation(uint8_t r);
|
||||
virtual void invertDisplay(boolean i);
|
||||
|
||||
// BASIC DRAW API
|
||||
// These MAY be overridden by the subclass to provide device-specific
|
||||
// optimized code. Otherwise 'generic' versions are used.
|
||||
virtual void
|
||||
// It's good to implement those, even if using transaction API
|
||||
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
|
||||
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
|
||||
fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color),
|
||||
fillScreen(uint16_t color),
|
||||
// Optional and probably not necessary to change
|
||||
drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color),
|
||||
drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
|
||||
// These exist only with Adafruit_GFX (no subclass overrides)
|
||||
void
|
||||
drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||
drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
|
||||
uint16_t color),
|
||||
fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||
fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
|
||||
int16_t delta, uint16_t color),
|
||||
drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
int16_t x2, int16_t y2, uint16_t color),
|
||||
fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
int16_t x2, int16_t y2, uint16_t color),
|
||||
drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||
int16_t radius, uint16_t color),
|
||||
fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||
int16_t radius, uint16_t color),
|
||||
drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
|
||||
int16_t w, int16_t h, uint16_t color),
|
||||
drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
|
||||
int16_t w, int16_t h, uint16_t color, uint16_t bg),
|
||||
drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
|
||||
int16_t w, int16_t h, uint16_t color),
|
||||
drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
|
||||
int16_t w, int16_t h, uint16_t color, uint16_t bg),
|
||||
drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
|
||||
int16_t w, int16_t h, uint16_t color),
|
||||
drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
|
||||
int16_t w, int16_t h),
|
||||
drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap,
|
||||
int16_t w, int16_t h),
|
||||
drawGrayscaleBitmap(int16_t x, int16_t y,
|
||||
const uint8_t bitmap[], const uint8_t mask[],
|
||||
int16_t w, int16_t h),
|
||||
drawGrayscaleBitmap(int16_t x, int16_t y,
|
||||
uint8_t *bitmap, uint8_t *mask, int16_t w, int16_t h),
|
||||
drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
|
||||
int16_t w, int16_t h),
|
||||
drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap,
|
||||
int16_t w, int16_t h),
|
||||
drawRGBBitmap(int16_t x, int16_t y,
|
||||
const uint16_t bitmap[], const uint8_t mask[],
|
||||
int16_t w, int16_t h),
|
||||
drawRGBBitmap(int16_t x, int16_t y,
|
||||
uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h),
|
||||
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
|
||||
uint16_t bg, uint8_t size),
|
||||
setCursor(int16_t x, int16_t y),
|
||||
setTextColor(uint16_t c),
|
||||
setTextColor(uint16_t c, uint16_t bg),
|
||||
setTextSize(uint8_t s),
|
||||
setTextWrap(boolean w),
|
||||
cp437(boolean x=true),
|
||||
setFont(const GFXfont *f = NULL),
|
||||
getTextBounds(char *string, int16_t x, int16_t y,
|
||||
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h),
|
||||
getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
|
||||
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
|
||||
|
||||
#if ARDUINO >= 100
|
||||
virtual size_t write(uint8_t);
|
||||
#else
|
||||
virtual void write(uint8_t);
|
||||
#endif
|
||||
|
||||
int16_t height(void) const;
|
||||
int16_t width(void) const;
|
||||
|
||||
uint8_t getRotation(void) const;
|
||||
|
||||
// get current cursor position (get rotation safe maximum values, using: width() for x, height() for y)
|
||||
int16_t getCursorX(void) const;
|
||||
int16_t getCursorY(void) const;
|
||||
|
||||
protected:
|
||||
void
|
||||
charBounds(char c, int16_t *x, int16_t *y,
|
||||
int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy);
|
||||
const int16_t
|
||||
WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes
|
||||
int16_t
|
||||
_width, _height, // Display w/h as modified by current rotation
|
||||
cursor_x, cursor_y;
|
||||
uint16_t
|
||||
textcolor, textbgcolor;
|
||||
uint8_t
|
||||
textsize,
|
||||
rotation;
|
||||
boolean
|
||||
wrap, // If set, 'wrap' text at right edge of display
|
||||
_cp437; // If set, use correct CP437 charset (default is off)
|
||||
GFXfont
|
||||
*gfxFont;
|
||||
};
|
||||
|
||||
class Adafruit_GFX_Button {
|
||||
|
||||
public:
|
||||
Adafruit_GFX_Button(void);
|
||||
// "Classic" initButton() uses center & size
|
||||
void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize);
|
||||
// New/alt initButton() uses upper-left corner & size
|
||||
void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize);
|
||||
void drawButton(boolean inverted = false);
|
||||
boolean contains(int16_t x, int16_t y);
|
||||
|
||||
void press(boolean p);
|
||||
boolean isPressed();
|
||||
boolean justPressed();
|
||||
boolean justReleased();
|
||||
|
||||
private:
|
||||
Adafruit_GFX *_gfx;
|
||||
int16_t _x1, _y1; // Coordinates of top-left corner
|
||||
uint16_t _w, _h;
|
||||
uint8_t _textsize;
|
||||
uint16_t _outlinecolor, _fillcolor, _textcolor;
|
||||
char _label[10];
|
||||
|
||||
boolean currstate, laststate;
|
||||
};
|
||||
|
||||
class GFXcanvas1 : public Adafruit_GFX {
|
||||
public:
|
||||
GFXcanvas1(uint16_t w, uint16_t h);
|
||||
~GFXcanvas1(void);
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
fillScreen(uint16_t color);
|
||||
uint8_t *getBuffer(void);
|
||||
private:
|
||||
uint8_t *buffer;
|
||||
};
|
||||
|
||||
class GFXcanvas8 : public Adafruit_GFX {
|
||||
public:
|
||||
GFXcanvas8(uint16_t w, uint16_t h);
|
||||
~GFXcanvas8(void);
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
fillScreen(uint16_t color),
|
||||
writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
|
||||
uint8_t *getBuffer(void);
|
||||
private:
|
||||
uint8_t *buffer;
|
||||
};
|
||||
|
||||
class GFXcanvas16 : public Adafruit_GFX {
|
||||
public:
|
||||
GFXcanvas16(uint16_t w, uint16_t h);
|
||||
~GFXcanvas16(void);
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
fillScreen(uint16_t color);
|
||||
uint16_t *getBuffer(void);
|
||||
private:
|
||||
uint16_t *buffer;
|
||||
};
|
||||
|
||||
#endif // _ADAFRUIT_GFX_H
|
||||
@@ -1,12 +0,0 @@
|
||||
all: fontconvert
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I/usr/include
|
||||
LIBS = -lfreetype
|
||||
|
||||
fontconvert: fontconvert.c
|
||||
$(CC) $(CFLAGS) $< $(LIBS) -o $@
|
||||
strip $@
|
||||
|
||||
clean:
|
||||
rm -f fontconvert
|
||||
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
TrueType to Adafruit_GFX font converter. Derived from Peter Jakobs'
|
||||
Adafruit_ftGFX fork & makefont tool, and Paul Kourany's Adafruit_mfGFX.
|
||||
|
||||
NOT AN ARDUINO SKETCH. This is a command-line tool for preprocessing
|
||||
fonts to be used with the Adafruit_GFX Arduino library.
|
||||
|
||||
For UNIX-like systems. Outputs to stdout; redirect to header file, e.g.:
|
||||
./fontconvert ~/Library/Fonts/FreeSans.ttf 18 > FreeSans18pt7b.h
|
||||
|
||||
REQUIRES FREETYPE LIBRARY. www.freetype.org
|
||||
|
||||
Currently this only extracts the printable 7-bit ASCII chars of a font.
|
||||
Will eventually extend with some int'l chars a la ftGFX, not there yet.
|
||||
Keep 7-bit fonts around as an option in that case, more compact.
|
||||
|
||||
See notes at end for glyph nomenclature & other tidbits.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_GLYPH_H
|
||||
#include "../gfxfont.h" // Adafruit_GFX font structures
|
||||
|
||||
#define DPI 141 // Approximate res. of Adafruit 2.8" TFT
|
||||
|
||||
// Accumulate bits for output, with periodic hexadecimal byte write
|
||||
void enbit(uint8_t value) {
|
||||
static uint8_t row = 0, sum = 0, bit = 0x80, firstCall = 1;
|
||||
if(value) sum |= bit; // Set bit if needed
|
||||
if(!(bit >>= 1)) { // Advance to next bit, end of byte reached?
|
||||
if(!firstCall) { // Format output table nicely
|
||||
if(++row >= 12) { // Last entry on line?
|
||||
printf(",\n "); // Newline format output
|
||||
row = 0; // Reset row counter
|
||||
} else { // Not end of line
|
||||
printf(", "); // Simple comma delim
|
||||
}
|
||||
}
|
||||
printf("0x%02X", sum); // Write byte value
|
||||
sum = 0; // Clear for next byte
|
||||
bit = 0x80; // Reset bit counter
|
||||
firstCall = 0; // Formatting flag
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, j, err, size, first=' ', last='~',
|
||||
bitmapOffset = 0, x, y, byte;
|
||||
char *fontName, c, *ptr;
|
||||
FT_Library library;
|
||||
FT_Face face;
|
||||
FT_Glyph glyph;
|
||||
FT_Bitmap *bitmap;
|
||||
FT_BitmapGlyphRec *g;
|
||||
GFXglyph *table;
|
||||
uint8_t bit;
|
||||
|
||||
// Parse command line. Valid syntaxes are:
|
||||
// fontconvert [filename] [size]
|
||||
// fontconvert [filename] [size] [last char]
|
||||
// fontconvert [filename] [size] [first char] [last char]
|
||||
// Unless overridden, default first and last chars are
|
||||
// ' ' (space) and '~', respectively
|
||||
|
||||
if(argc < 3) {
|
||||
fprintf(stderr, "Usage: %s fontfile size [first] [last]\n",
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
size = atoi(argv[2]);
|
||||
|
||||
if(argc == 4) {
|
||||
last = atoi(argv[3]);
|
||||
} else if(argc == 5) {
|
||||
first = atoi(argv[3]);
|
||||
last = atoi(argv[4]);
|
||||
}
|
||||
|
||||
if(last < first) {
|
||||
i = first;
|
||||
first = last;
|
||||
last = i;
|
||||
}
|
||||
|
||||
ptr = strrchr(argv[1], '/'); // Find last slash in filename
|
||||
if(ptr) ptr++; // First character of filename (path stripped)
|
||||
else ptr = argv[1]; // No path; font in local dir.
|
||||
|
||||
// Allocate space for font name and glyph table
|
||||
if((!(fontName = malloc(strlen(ptr) + 20))) ||
|
||||
(!(table = (GFXglyph *)malloc((last - first + 1) *
|
||||
sizeof(GFXglyph))))) {
|
||||
fprintf(stderr, "Malloc error\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Derive font table names from filename. Period (filename
|
||||
// extension) is truncated and replaced with the font size & bits.
|
||||
strcpy(fontName, ptr);
|
||||
ptr = strrchr(fontName, '.'); // Find last period (file ext)
|
||||
if(!ptr) ptr = &fontName[strlen(fontName)]; // If none, append
|
||||
// Insert font size and 7/8 bit. fontName was alloc'd w/extra
|
||||
// space to allow this, we're not sprintfing into Forbidden Zone.
|
||||
sprintf(ptr, "%dpt%db", size, (last > 127) ? 8 : 7);
|
||||
// Space and punctuation chars in name replaced w/ underscores.
|
||||
for(i=0; (c=fontName[i]); i++) {
|
||||
if(isspace(c) || ispunct(c)) fontName[i] = '_';
|
||||
}
|
||||
|
||||
// Init FreeType lib, load font
|
||||
if((err = FT_Init_FreeType(&library))) {
|
||||
fprintf(stderr, "FreeType init error: %d", err);
|
||||
return err;
|
||||
}
|
||||
if((err = FT_New_Face(library, argv[1], 0, &face))) {
|
||||
fprintf(stderr, "Font load error: %d", err);
|
||||
FT_Done_FreeType(library);
|
||||
return err;
|
||||
}
|
||||
|
||||
// << 6 because '26dot6' fixed-point format
|
||||
FT_Set_Char_Size(face, size << 6, 0, DPI, 0);
|
||||
|
||||
// Currently all symbols from 'first' to 'last' are processed.
|
||||
// Fonts may contain WAY more glyphs than that, but this code
|
||||
// will need to handle encoding stuff to deal with extracting
|
||||
// the right symbols, and that's not done yet.
|
||||
// fprintf(stderr, "%ld glyphs\n", face->num_glyphs);
|
||||
|
||||
printf("const uint8_t %sBitmaps[] PROGMEM = {\n ", fontName);
|
||||
|
||||
// Process glyphs and output huge bitmap data array
|
||||
for(i=first, j=0; i<=last; i++, j++) {
|
||||
// MONO renderer provides clean image with perfect crop
|
||||
// (no wasted pixels) via bitmap struct.
|
||||
if((err = FT_Load_Char(face, i, FT_LOAD_TARGET_MONO))) {
|
||||
fprintf(stderr, "Error %d loading char '%c'\n",
|
||||
err, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if((err = FT_Render_Glyph(face->glyph,
|
||||
FT_RENDER_MODE_MONO))) {
|
||||
fprintf(stderr, "Error %d rendering char '%c'\n",
|
||||
err, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if((err = FT_Get_Glyph(face->glyph, &glyph))) {
|
||||
fprintf(stderr, "Error %d getting glyph '%c'\n",
|
||||
err, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
bitmap = &face->glyph->bitmap;
|
||||
g = (FT_BitmapGlyphRec *)glyph;
|
||||
|
||||
// Minimal font and per-glyph information is stored to
|
||||
// reduce flash space requirements. Glyph bitmaps are
|
||||
// fully bit-packed; no per-scanline pad, though end of
|
||||
// each character may be padded to next byte boundary
|
||||
// when needed. 16-bit offset means 64K max for bitmaps,
|
||||
// code currently doesn't check for overflow. (Doesn't
|
||||
// check that size & offsets are within bounds either for
|
||||
// that matter...please convert fonts responsibly.)
|
||||
table[j].bitmapOffset = bitmapOffset;
|
||||
table[j].width = bitmap->width;
|
||||
table[j].height = bitmap->rows;
|
||||
table[j].xAdvance = face->glyph->advance.x >> 6;
|
||||
table[j].xOffset = g->left;
|
||||
table[j].yOffset = 1 - g->top;
|
||||
|
||||
for(y=0; y < bitmap->rows; y++) {
|
||||
for(x=0;x < bitmap->width; x++) {
|
||||
byte = x / 8;
|
||||
bit = 0x80 >> (x & 7);
|
||||
enbit(bitmap->buffer[
|
||||
y * bitmap->pitch + byte] & bit);
|
||||
}
|
||||
}
|
||||
|
||||
// Pad end of char bitmap to next byte boundary if needed
|
||||
int n = (bitmap->width * bitmap->rows) & 7;
|
||||
if(n) { // Pixel count not an even multiple of 8?
|
||||
n = 8 - n; // # bits to next multiple
|
||||
while(n--) enbit(0);
|
||||
}
|
||||
bitmapOffset += (bitmap->width * bitmap->rows + 7) / 8;
|
||||
|
||||
FT_Done_Glyph(glyph);
|
||||
}
|
||||
|
||||
printf(" };\n\n"); // End bitmap array
|
||||
|
||||
// Output glyph attributes table (one per character)
|
||||
printf("const GFXglyph %sGlyphs[] PROGMEM = {\n", fontName);
|
||||
for(i=first, j=0; i<=last; i++, j++) {
|
||||
printf(" { %5d, %3d, %3d, %3d, %4d, %4d }",
|
||||
table[j].bitmapOffset,
|
||||
table[j].width,
|
||||
table[j].height,
|
||||
table[j].xAdvance,
|
||||
table[j].xOffset,
|
||||
table[j].yOffset);
|
||||
if(i < last) {
|
||||
printf(", // 0x%02X", i);
|
||||
if((i >= ' ') && (i <= '~')) {
|
||||
printf(" '%c'", i);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
printf(" }; // 0x%02X", last);
|
||||
if((last >= ' ') && (last <= '~')) printf(" '%c'", last);
|
||||
printf("\n\n");
|
||||
|
||||
// Output font structure
|
||||
printf("const GFXfont %s PROGMEM = {\n", fontName);
|
||||
printf(" (uint8_t *)%sBitmaps,\n", fontName);
|
||||
printf(" (GFXglyph *)%sGlyphs,\n", fontName);
|
||||
printf(" 0x%02X, 0x%02X, %ld };\n\n",
|
||||
first, last, face->size->metrics.height >> 6);
|
||||
printf("// Approx. %d bytes\n",
|
||||
bitmapOffset + (last - first + 1) * 7 + 7);
|
||||
// Size estimate is based on AVR struct and pointer sizes;
|
||||
// actual size may vary.
|
||||
|
||||
FT_Done_FreeType(library);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
|
||||
Character metrics are slightly different from classic GFX & ftGFX.
|
||||
In classic GFX: cursor position is the upper-left pixel of each 5x7
|
||||
character; lower extent of most glyphs (except those w/descenders)
|
||||
is +6 pixels in Y direction.
|
||||
W/new GFX fonts: cursor position is on baseline, where baseline is
|
||||
'inclusive' (containing the bottom-most row of pixels in most symbols,
|
||||
except those with descenders; ftGFX is one pixel lower).
|
||||
|
||||
Cursor Y will be moved automatically when switching between classic
|
||||
and new fonts. If you switch fonts, any print() calls will continue
|
||||
along the same baseline.
|
||||
|
||||
...........#####.. -- yOffset
|
||||
..........######..
|
||||
..........######..
|
||||
.........#######..
|
||||
........#########.
|
||||
* = Cursor pos. ........#########.
|
||||
.......##########.
|
||||
......#####..####.
|
||||
......#####..####.
|
||||
*.#.. .....#####...####.
|
||||
.#.#. ....##############
|
||||
#...# ...###############
|
||||
#...# ...###############
|
||||
##### ..#####......#####
|
||||
#...# .#####.......#####
|
||||
====== #...# ====== #*###.........#### ======= Baseline
|
||||
|| xOffset
|
||||
|
||||
glyph->xOffset and yOffset are pixel offsets, in GFX coordinate space
|
||||
(+Y is down), from the cursor position to the top-left pixel of the
|
||||
glyph bitmap. i.e. yOffset is typically negative, xOffset is typically
|
||||
zero but a few glyphs will have other values (even negative xOffsets
|
||||
sometimes, totally normal). glyph->xAdvance is the distance to move
|
||||
the cursor on the X axis after drawing the corresponding symbol.
|
||||
|
||||
There's also some changes with regard to 'background' color and new GFX
|
||||
fonts (classic fonts unchanged). See Adafruit_GFX.cpp for explanation.
|
||||
*/
|
||||
@@ -1,88 +0,0 @@
|
||||
### A short guide to use fontconvert.c to create your own fonts using MinGW.
|
||||
|
||||
#### STEP 1: INSTALL MinGW
|
||||
|
||||
Install MinGW (Minimalist GNU for Windows) from [MinGW.org](http://www.mingw.org/).
|
||||
Please read carefully the instructions found on [Getting started page](http://www.mingw.org/wiki/Getting_Started).
|
||||
I suggest installing with the "Graphical User Interface Installer".
|
||||
To complete your initial installation you should further install some "packages".
|
||||
For our purpose you should only install the "Basic Setup" packages.
|
||||
To do that:
|
||||
|
||||
1. Open the MinGW Installation Manager
|
||||
2. From the left panel click "Basic Setup".
|
||||
3. On the right panel choose "mingw32-base", "mingw-gcc-g++", "mingw-gcc-objc" and "msys-base"
|
||||
and click "Mark for installation"
|
||||
4. From the Menu click "Installation" and then "Apply changes". In the pop-up window select "Apply".
|
||||
|
||||
|
||||
#### STEP 2: INSTALL Freetype Library
|
||||
|
||||
To read about the freetype project visit [freetype.org](https://www.freetype.org/).
|
||||
To Download the latest version of freetype go to [download page](http://download.savannah.gnu.org/releases/freetype/)
|
||||
and choose "freetype-2.7.tar.gz" file (or a newer version if available).
|
||||
To avoid long cd commands later in the command prompt, I suggest you unzip the file in the C:\ directory.
|
||||
(I also renamed the folder to "ft27")
|
||||
Before you build the library it's good to read these articles:
|
||||
* [Using MSYS with MinGW](http://www.mingw.org/wiki/MSYS)
|
||||
* [Installation and Use of Supplementary Libraries with MinGW](http://www.mingw.org/wiki/LibraryPathHOWTO)
|
||||
* [Include Path](http://www.mingw.org/wiki/IncludePathHOWTO)
|
||||
|
||||
Inside the unzipped folder there is another folder named "docs". Open it and read the INSTALL.UNIX (using notepad).
|
||||
Pay attention to paragraph 3 (Build and Install the Library). So, let's begin the installation.
|
||||
To give the appropriate commands we will use the MSYS command prompt (not cmd.exe of windows) which is UNIX like.
|
||||
Follow the path C:\MinGW\msys\1.0 and double click "msys.bat". The command prompt environment appears.
|
||||
Enter "ft27" directory using the cd commands:
|
||||
```
|
||||
cd /c
|
||||
cd ft27
|
||||
```
|
||||
|
||||
and then type one by one the commands:
|
||||
```
|
||||
./configure --prefix=/mingw
|
||||
make
|
||||
make install
|
||||
```
|
||||
Once you're finished, go inside "C:\MinGW\include" and there should be a new folder named "freetype2".
|
||||
That, hopefully, means that you have installed the library correctly !!
|
||||
|
||||
#### STEP 3: Build fontconvert.c
|
||||
|
||||
Before proceeding I suggest you make a copy of Adafruit_GFX_library folder in C:\ directory.
|
||||
Then, inside "fontconvert" folder open the "makefile" with an editor ( I used notepad++).
|
||||
Change the commands so in the end the program looks like :
|
||||
```
|
||||
all: fontconvert
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -I c:/mingw/include/freetype2
|
||||
LIBS = -lfreetype
|
||||
|
||||
fontconvert: fontconvert.c
|
||||
$(CC) $(CFLAGS) $< $(LIBS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f fontconvert
|
||||
```
|
||||
Go back in the command prompt and with a cd command enter the fontconvert directory.
|
||||
```
|
||||
cd /c/adafruit_gfx_library\fontconvert
|
||||
```
|
||||
Give the command:
|
||||
```
|
||||
make
|
||||
```
|
||||
This command will, eventually, create a "fontconvert.exe" file inside fontconvert directory.
|
||||
|
||||
#### STEP 4: Create your own font header files
|
||||
|
||||
Now that you have an executable file, you can use it to create your own fonts to work with Adafruit GFX lib.
|
||||
So, if we suppose that you already have a .ttf file with your favorite fonts, jump to the command prompt and type:
|
||||
```
|
||||
./fontconvert yourfonts.ttf 9 > yourfonts9pt7b.h
|
||||
```
|
||||
You can read more details at: [learn.adafruit](https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts).
|
||||
|
||||
Taraaaaaammm !! you've just created your new font header file. Put it inside the "Fonts" folder, grab a cup of coffee
|
||||
and start playing with your Arduino (or whatever else ....)+ display module project.
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Ugly little Bash script, generates a set of .h files for GFX using
|
||||
# GNU FreeFont sources. There are three fonts: 'Mono' (Courier-like),
|
||||
# 'Sans' (Helvetica-like) and 'Serif' (Times-like); four styles: regular,
|
||||
# bold, oblique or italic, and bold+oblique or bold+italic; and four
|
||||
# sizes: 9, 12, 18 and 24 point. No real error checking or anything,
|
||||
# this just powers through all the combinations, calling the fontconvert
|
||||
# utility and redirecting the output to a .h file for each combo.
|
||||
|
||||
# Adafruit_GFX repository does not include the source outline fonts
|
||||
# (huge zipfile, different license) but they're easily acquired:
|
||||
# http://savannah.gnu.org/projects/freefont/
|
||||
|
||||
convert=./fontconvert
|
||||
inpath=~/Desktop/freefont/
|
||||
outpath=../Fonts/
|
||||
fonts=(FreeMono FreeSans FreeSerif)
|
||||
styles=("" Bold Italic BoldItalic Oblique BoldOblique)
|
||||
sizes=(9 12 18 24)
|
||||
|
||||
for f in ${fonts[*]}
|
||||
do
|
||||
for index in ${!styles[*]}
|
||||
do
|
||||
st=${styles[$index]}
|
||||
for si in ${sizes[*]}
|
||||
do
|
||||
infile=$inpath$f$st".ttf"
|
||||
if [ -f $infile ] # Does source combination exist?
|
||||
then
|
||||
outfile=$outpath$f$st$si"pt7b.h"
|
||||
# printf "%s %s %s > %s\n" $convert $infile $si $outfile
|
||||
$convert $infile $si > $outfile
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
@@ -1,24 +0,0 @@
|
||||
// Font structures for newer Adafruit_GFX (1.1 and later).
|
||||
// Example fonts are included in 'Fonts' directory.
|
||||
// To use a font in your Arduino sketch, #include the corresponding .h
|
||||
// file and pass address of GFXfont struct to setFont(). Pass NULL to
|
||||
// revert to 'classic' fixed-space bitmap font.
|
||||
|
||||
#ifndef _GFXFONT_H_
|
||||
#define _GFXFONT_H_
|
||||
|
||||
typedef struct { // Data stored PER GLYPH
|
||||
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
|
||||
uint8_t width, height; // Bitmap dimensions in pixels
|
||||
uint8_t xAdvance; // Distance to advance cursor (x axis)
|
||||
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
|
||||
} GFXglyph;
|
||||
|
||||
typedef struct { // Data stored for FONT AS A WHOLE:
|
||||
uint8_t *bitmap; // Glyph bitmaps, concatenated
|
||||
GFXglyph *glyph; // Glyph array
|
||||
uint8_t first, last; // ASCII extents
|
||||
uint8_t yAdvance; // Newline distance (y axis)
|
||||
} GFXfont;
|
||||
|
||||
#endif // _GFXFONT_H_
|
||||
@@ -1,276 +0,0 @@
|
||||
// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
|
||||
// See gfxfont.h for newer custom bitmap font info.
|
||||
|
||||
#ifndef FONT5X7_H
|
||||
#define FONT5X7_H
|
||||
|
||||
#ifdef __AVR__
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <pgmspace.h>
|
||||
#else
|
||||
#define PROGMEM
|
||||
#endif
|
||||
|
||||
// Standard ASCII 5x7 font
|
||||
|
||||
static const unsigned char font[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
|
||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
|
||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
|
||||
0x18, 0x3C, 0x7E, 0x3C, 0x18,
|
||||
0x1C, 0x57, 0x7D, 0x57, 0x1C,
|
||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
|
||||
0x00, 0x18, 0x3C, 0x18, 0x00,
|
||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
|
||||
0x00, 0x18, 0x24, 0x18, 0x00,
|
||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
|
||||
0x30, 0x48, 0x3A, 0x06, 0x0E,
|
||||
0x26, 0x29, 0x79, 0x29, 0x26,
|
||||
0x40, 0x7F, 0x05, 0x05, 0x07,
|
||||
0x40, 0x7F, 0x05, 0x25, 0x3F,
|
||||
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
|
||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
|
||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
|
||||
0x14, 0x22, 0x7F, 0x22, 0x14,
|
||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
|
||||
0x06, 0x09, 0x7F, 0x01, 0x7F,
|
||||
0x00, 0x66, 0x89, 0x95, 0x6A,
|
||||
0x60, 0x60, 0x60, 0x60, 0x60,
|
||||
0x94, 0xA2, 0xFF, 0xA2, 0x94,
|
||||
0x08, 0x04, 0x7E, 0x04, 0x08,
|
||||
0x10, 0x20, 0x7E, 0x20, 0x10,
|
||||
0x08, 0x08, 0x2A, 0x1C, 0x08,
|
||||
0x08, 0x1C, 0x2A, 0x08, 0x08,
|
||||
0x1E, 0x10, 0x10, 0x10, 0x10,
|
||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
|
||||
0x30, 0x38, 0x3E, 0x38, 0x30,
|
||||
0x06, 0x0E, 0x3E, 0x0E, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x5F, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x07, 0x00,
|
||||
0x14, 0x7F, 0x14, 0x7F, 0x14,
|
||||
0x24, 0x2A, 0x7F, 0x2A, 0x12,
|
||||
0x23, 0x13, 0x08, 0x64, 0x62,
|
||||
0x36, 0x49, 0x56, 0x20, 0x50,
|
||||
0x00, 0x08, 0x07, 0x03, 0x00,
|
||||
0x00, 0x1C, 0x22, 0x41, 0x00,
|
||||
0x00, 0x41, 0x22, 0x1C, 0x00,
|
||||
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
|
||||
0x08, 0x08, 0x3E, 0x08, 0x08,
|
||||
0x00, 0x80, 0x70, 0x30, 0x00,
|
||||
0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x60, 0x60, 0x00,
|
||||
0x20, 0x10, 0x08, 0x04, 0x02,
|
||||
0x3E, 0x51, 0x49, 0x45, 0x3E,
|
||||
0x00, 0x42, 0x7F, 0x40, 0x00,
|
||||
0x72, 0x49, 0x49, 0x49, 0x46,
|
||||
0x21, 0x41, 0x49, 0x4D, 0x33,
|
||||
0x18, 0x14, 0x12, 0x7F, 0x10,
|
||||
0x27, 0x45, 0x45, 0x45, 0x39,
|
||||
0x3C, 0x4A, 0x49, 0x49, 0x31,
|
||||
0x41, 0x21, 0x11, 0x09, 0x07,
|
||||
0x36, 0x49, 0x49, 0x49, 0x36,
|
||||
0x46, 0x49, 0x49, 0x29, 0x1E,
|
||||
0x00, 0x00, 0x14, 0x00, 0x00,
|
||||
0x00, 0x40, 0x34, 0x00, 0x00,
|
||||
0x00, 0x08, 0x14, 0x22, 0x41,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||
0x00, 0x41, 0x22, 0x14, 0x08,
|
||||
0x02, 0x01, 0x59, 0x09, 0x06,
|
||||
0x3E, 0x41, 0x5D, 0x59, 0x4E,
|
||||
0x7C, 0x12, 0x11, 0x12, 0x7C,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x36,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x22,
|
||||
0x7F, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x41,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x01,
|
||||
0x3E, 0x41, 0x41, 0x51, 0x73,
|
||||
0x7F, 0x08, 0x08, 0x08, 0x7F,
|
||||
0x00, 0x41, 0x7F, 0x41, 0x00,
|
||||
0x20, 0x40, 0x41, 0x3F, 0x01,
|
||||
0x7F, 0x08, 0x14, 0x22, 0x41,
|
||||
0x7F, 0x40, 0x40, 0x40, 0x40,
|
||||
0x7F, 0x02, 0x1C, 0x02, 0x7F,
|
||||
0x7F, 0x04, 0x08, 0x10, 0x7F,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x06,
|
||||
0x3E, 0x41, 0x51, 0x21, 0x5E,
|
||||
0x7F, 0x09, 0x19, 0x29, 0x46,
|
||||
0x26, 0x49, 0x49, 0x49, 0x32,
|
||||
0x03, 0x01, 0x7F, 0x01, 0x03,
|
||||
0x3F, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x1F, 0x20, 0x40, 0x20, 0x1F,
|
||||
0x3F, 0x40, 0x38, 0x40, 0x3F,
|
||||
0x63, 0x14, 0x08, 0x14, 0x63,
|
||||
0x03, 0x04, 0x78, 0x04, 0x03,
|
||||
0x61, 0x59, 0x49, 0x4D, 0x43,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x41,
|
||||
0x02, 0x04, 0x08, 0x10, 0x20,
|
||||
0x00, 0x41, 0x41, 0x41, 0x7F,
|
||||
0x04, 0x02, 0x01, 0x02, 0x04,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
0x00, 0x03, 0x07, 0x08, 0x00,
|
||||
0x20, 0x54, 0x54, 0x78, 0x40,
|
||||
0x7F, 0x28, 0x44, 0x44, 0x38,
|
||||
0x38, 0x44, 0x44, 0x44, 0x28,
|
||||
0x38, 0x44, 0x44, 0x28, 0x7F,
|
||||
0x38, 0x54, 0x54, 0x54, 0x18,
|
||||
0x00, 0x08, 0x7E, 0x09, 0x02,
|
||||
0x18, 0xA4, 0xA4, 0x9C, 0x78,
|
||||
0x7F, 0x08, 0x04, 0x04, 0x78,
|
||||
0x00, 0x44, 0x7D, 0x40, 0x00,
|
||||
0x20, 0x40, 0x40, 0x3D, 0x00,
|
||||
0x7F, 0x10, 0x28, 0x44, 0x00,
|
||||
0x00, 0x41, 0x7F, 0x40, 0x00,
|
||||
0x7C, 0x04, 0x78, 0x04, 0x78,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x78,
|
||||
0x38, 0x44, 0x44, 0x44, 0x38,
|
||||
0xFC, 0x18, 0x24, 0x24, 0x18,
|
||||
0x18, 0x24, 0x24, 0x18, 0xFC,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x08,
|
||||
0x48, 0x54, 0x54, 0x54, 0x24,
|
||||
0x04, 0x04, 0x3F, 0x44, 0x24,
|
||||
0x3C, 0x40, 0x40, 0x20, 0x7C,
|
||||
0x1C, 0x20, 0x40, 0x20, 0x1C,
|
||||
0x3C, 0x40, 0x30, 0x40, 0x3C,
|
||||
0x44, 0x28, 0x10, 0x28, 0x44,
|
||||
0x4C, 0x90, 0x90, 0x90, 0x7C,
|
||||
0x44, 0x64, 0x54, 0x4C, 0x44,
|
||||
0x00, 0x08, 0x36, 0x41, 0x00,
|
||||
0x00, 0x00, 0x77, 0x00, 0x00,
|
||||
0x00, 0x41, 0x36, 0x08, 0x00,
|
||||
0x02, 0x01, 0x02, 0x04, 0x02,
|
||||
0x3C, 0x26, 0x23, 0x26, 0x3C,
|
||||
0x1E, 0xA1, 0xA1, 0x61, 0x12,
|
||||
0x3A, 0x40, 0x40, 0x20, 0x7A,
|
||||
0x38, 0x54, 0x54, 0x55, 0x59,
|
||||
0x21, 0x55, 0x55, 0x79, 0x41,
|
||||
0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut
|
||||
0x21, 0x55, 0x54, 0x78, 0x40,
|
||||
0x20, 0x54, 0x55, 0x79, 0x40,
|
||||
0x0C, 0x1E, 0x52, 0x72, 0x12,
|
||||
0x39, 0x55, 0x55, 0x55, 0x59,
|
||||
0x39, 0x54, 0x54, 0x54, 0x59,
|
||||
0x39, 0x55, 0x54, 0x54, 0x58,
|
||||
0x00, 0x00, 0x45, 0x7C, 0x41,
|
||||
0x00, 0x02, 0x45, 0x7D, 0x42,
|
||||
0x00, 0x01, 0x45, 0x7C, 0x40,
|
||||
0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut
|
||||
0xF0, 0x28, 0x25, 0x28, 0xF0,
|
||||
0x7C, 0x54, 0x55, 0x45, 0x00,
|
||||
0x20, 0x54, 0x54, 0x7C, 0x54,
|
||||
0x7C, 0x0A, 0x09, 0x7F, 0x49,
|
||||
0x32, 0x49, 0x49, 0x49, 0x32,
|
||||
0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut
|
||||
0x32, 0x4A, 0x48, 0x48, 0x30,
|
||||
0x3A, 0x41, 0x41, 0x21, 0x7A,
|
||||
0x3A, 0x42, 0x40, 0x20, 0x78,
|
||||
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
|
||||
0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut
|
||||
0x3D, 0x40, 0x40, 0x40, 0x3D,
|
||||
0x3C, 0x24, 0xFF, 0x24, 0x24,
|
||||
0x48, 0x7E, 0x49, 0x43, 0x66,
|
||||
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
|
||||
0xFF, 0x09, 0x29, 0xF6, 0x20,
|
||||
0xC0, 0x88, 0x7E, 0x09, 0x03,
|
||||
0x20, 0x54, 0x54, 0x79, 0x41,
|
||||
0x00, 0x00, 0x44, 0x7D, 0x41,
|
||||
0x30, 0x48, 0x48, 0x4A, 0x32,
|
||||
0x38, 0x40, 0x40, 0x22, 0x7A,
|
||||
0x00, 0x7A, 0x0A, 0x0A, 0x72,
|
||||
0x7D, 0x0D, 0x19, 0x31, 0x7D,
|
||||
0x26, 0x29, 0x29, 0x2F, 0x28,
|
||||
0x26, 0x29, 0x29, 0x29, 0x26,
|
||||
0x30, 0x48, 0x4D, 0x40, 0x20,
|
||||
0x38, 0x08, 0x08, 0x08, 0x08,
|
||||
0x08, 0x08, 0x08, 0x08, 0x38,
|
||||
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
|
||||
0x2F, 0x10, 0x28, 0x34, 0xFA,
|
||||
0x00, 0x00, 0x7B, 0x00, 0x00,
|
||||
0x08, 0x14, 0x2A, 0x14, 0x22,
|
||||
0x22, 0x14, 0x2A, 0x14, 0x08,
|
||||
0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
|
||||
0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block
|
||||
0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block
|
||||
0x00, 0x00, 0x00, 0xFF, 0x00,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x00,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x00,
|
||||
0x10, 0x10, 0xFF, 0x00, 0xFF,
|
||||
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||
0x14, 0x14, 0x14, 0xFC, 0x00,
|
||||
0x14, 0x14, 0xF7, 0x00, 0xFF,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x14, 0x14, 0xF4, 0x04, 0xFC,
|
||||
0x14, 0x14, 0x17, 0x10, 0x1F,
|
||||
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||
0x14, 0x14, 0x14, 0x1F, 0x00,
|
||||
0x10, 0x10, 0x10, 0xF0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1F, 0x10,
|
||||
0x10, 0x10, 0x10, 0x1F, 0x10,
|
||||
0x10, 0x10, 0x10, 0xF0, 0x10,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x10,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x14,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x1F, 0x10, 0x17,
|
||||
0x00, 0x00, 0xFC, 0x04, 0xF4,
|
||||
0x14, 0x14, 0x17, 0x10, 0x17,
|
||||
0x14, 0x14, 0xF4, 0x04, 0xF4,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xF7,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||
0x14, 0x14, 0xF7, 0x00, 0xF7,
|
||||
0x14, 0x14, 0x14, 0x17, 0x14,
|
||||
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||
0x14, 0x14, 0x14, 0xF4, 0x14,
|
||||
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||
0x00, 0x00, 0x1F, 0x10, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x1F, 0x14,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x14,
|
||||
0x00, 0x00, 0xF0, 0x10, 0xF0,
|
||||
0x10, 0x10, 0xFF, 0x10, 0xFF,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x14,
|
||||
0x10, 0x10, 0x10, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x10,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
|
||||
0x38, 0x44, 0x44, 0x38, 0x44,
|
||||
0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta
|
||||
0x7E, 0x02, 0x02, 0x06, 0x06,
|
||||
0x02, 0x7E, 0x02, 0x7E, 0x02,
|
||||
0x63, 0x55, 0x49, 0x41, 0x63,
|
||||
0x38, 0x44, 0x44, 0x3C, 0x04,
|
||||
0x40, 0x7E, 0x20, 0x1E, 0x20,
|
||||
0x06, 0x02, 0x7E, 0x02, 0x02,
|
||||
0x99, 0xA5, 0xE7, 0xA5, 0x99,
|
||||
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
|
||||
0x4C, 0x72, 0x01, 0x72, 0x4C,
|
||||
0x30, 0x4A, 0x4D, 0x4D, 0x30,
|
||||
0x30, 0x48, 0x78, 0x48, 0x30,
|
||||
0xBC, 0x62, 0x5A, 0x46, 0x3D,
|
||||
0x3E, 0x49, 0x49, 0x49, 0x00,
|
||||
0x7E, 0x01, 0x01, 0x01, 0x7E,
|
||||
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
|
||||
0x44, 0x44, 0x5F, 0x44, 0x44,
|
||||
0x40, 0x51, 0x4A, 0x44, 0x40,
|
||||
0x40, 0x44, 0x4A, 0x51, 0x40,
|
||||
0x00, 0x00, 0xFF, 0x01, 0x03,
|
||||
0xE0, 0x80, 0xFF, 0x00, 0x00,
|
||||
0x08, 0x08, 0x6B, 0x6B, 0x08,
|
||||
0x36, 0x12, 0x36, 0x24, 0x36,
|
||||
0x06, 0x0F, 0x09, 0x0F, 0x06,
|
||||
0x00, 0x00, 0x18, 0x18, 0x00,
|
||||
0x00, 0x00, 0x10, 0x10, 0x00,
|
||||
0x30, 0x40, 0xFF, 0x01, 0x01,
|
||||
0x00, 0x1F, 0x01, 0x01, 0x1E,
|
||||
0x00, 0x19, 0x1D, 0x17, 0x12,
|
||||
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP
|
||||
};
|
||||
#endif // FONT5X7_H
|
||||
@@ -1,9 +0,0 @@
|
||||
name=Adafruit GFX Library
|
||||
version=1.2.2
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.
|
||||
paragraph=Install this library in addition to the display library for your hardware.
|
||||
category=Display
|
||||
url=https://github.com/adafruit/Adafruit-GFX-Library
|
||||
architectures=*
|
||||
@@ -1,24 +0,0 @@
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2012 Adafruit Industries. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
+4
-22
@@ -860,30 +860,12 @@ void ILI9341::drawFastHLine(int16_t x, int16_t y,
|
||||
endWrite();
|
||||
}
|
||||
|
||||
// (x,y) is topmost point; if unsure, calling function
|
||||
// should sort endpoints or call writeLine() instead
|
||||
void ILI9341::writeFastVLine(int16_t x, int16_t y,
|
||||
int16_t h, uint16_t color) {
|
||||
// Overwrite in subclasses if startWrite is defined!
|
||||
// Can be just writeLine(x, y, x, y+h-1, color);
|
||||
// or writeFillRect(x, y, 1, h, color);
|
||||
drawFastVLine(x, y, h, color);
|
||||
void ILI9341::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color){
|
||||
writeFillRect(x, y, 1, h, color);
|
||||
}
|
||||
|
||||
// (x,y) is leftmost point; if unsure, calling function
|
||||
// should sort endpoints or call writeLine() instead
|
||||
void ILI9341::writeFastHLine(int16_t x, int16_t y,
|
||||
int16_t w, uint16_t color) {
|
||||
// Overwrite in subclasses if startWrite is defined!
|
||||
// Example: writeLine(x, y, x+w-1, y, color);
|
||||
// or writeFillRect(x, y, w, 1, color);
|
||||
drawFastHLine(x, y, w, color);
|
||||
}
|
||||
|
||||
void ILI9341::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint16_t color) {
|
||||
// Overwrite in subclasses if desired!
|
||||
fillRect(x,y,w,h,color);
|
||||
void ILI9341::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color){
|
||||
writeFillRect(x, y, w, 1, color);
|
||||
}
|
||||
|
||||
void ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user