├── .gitignore ├── README.md ├── libraries ├── Adafruit_GFX_Library │ ├── Adafruit_GFX.cpp │ ├── Adafruit_GFX.h │ ├── Adafruit_SPITFT.cpp │ ├── Adafruit_SPITFT.h │ ├── Adafruit_SPITFT_Macros.h │ ├── Fonts │ │ ├── FreeMono12pt7b.h │ │ ├── FreeMono18pt7b.h │ │ ├── FreeMono24pt7b.h │ │ ├── FreeMono9pt7b.h │ │ ├── FreeMonoBold12pt7b.h │ │ ├── FreeMonoBold18pt7b.h │ │ ├── FreeMonoBold24pt7b.h │ │ ├── FreeMonoBold9pt7b.h │ │ ├── FreeMonoBoldOblique12pt7b.h │ │ ├── FreeMonoBoldOblique18pt7b.h │ │ ├── FreeMonoBoldOblique24pt7b.h │ │ ├── FreeMonoBoldOblique9pt7b.h │ │ ├── FreeMonoOblique12pt7b.h │ │ ├── FreeMonoOblique18pt7b.h │ │ ├── FreeMonoOblique24pt7b.h │ │ ├── FreeMonoOblique9pt7b.h │ │ ├── FreeSans12pt7b.h │ │ ├── FreeSans18pt7b.h │ │ ├── FreeSans24pt7b.h │ │ ├── FreeSans9pt7b.h │ │ ├── FreeSansBold12pt7b.h │ │ ├── FreeSansBold18pt7b.h │ │ ├── FreeSansBold24pt7b.h │ │ ├── FreeSansBold9pt7b.h │ │ ├── FreeSansBoldOblique12pt7b.h │ │ ├── FreeSansBoldOblique18pt7b.h │ │ ├── FreeSansBoldOblique24pt7b.h │ │ ├── FreeSansBoldOblique9pt7b.h │ │ ├── FreeSansOblique12pt7b.h │ │ ├── FreeSansOblique18pt7b.h │ │ ├── FreeSansOblique24pt7b.h │ │ ├── FreeSansOblique9pt7b.h │ │ ├── FreeSerif12pt7b.h │ │ ├── FreeSerif18pt7b.h │ │ ├── FreeSerif24pt7b.h │ │ ├── FreeSerif9pt7b.h │ │ ├── FreeSerifBold12pt7b.h │ │ ├── FreeSerifBold18pt7b.h │ │ ├── FreeSerifBold24pt7b.h │ │ ├── FreeSerifBold9pt7b.h │ │ ├── FreeSerifBoldItalic12pt7b.h │ │ ├── FreeSerifBoldItalic18pt7b.h │ │ ├── FreeSerifBoldItalic24pt7b.h │ │ ├── FreeSerifBoldItalic9pt7b.h │ │ ├── FreeSerifItalic12pt7b.h │ │ ├── FreeSerifItalic18pt7b.h │ │ ├── FreeSerifItalic24pt7b.h │ │ ├── FreeSerifItalic9pt7b.h │ │ ├── Org_01.h │ │ ├── Picopixel.h │ │ ├── Tiny3x3a2pt7b │ │ └── TomThumb.h │ ├── README.md │ ├── examples │ │ └── mock_ili9341 │ │ │ └── mock_ili9341.ino │ ├── fontconvert │ │ ├── Makefile │ │ ├── fontconvert.c │ │ ├── fontconvert_win.md │ │ └── makefonts.sh │ ├── gfxfont.h │ ├── glcdfont.c │ ├── library.properties │ └── license.txt ├── Adafruit_SSD1306 │ ├── Adafruit_SSD1306.cpp │ ├── Adafruit_SSD1306.h │ ├── README.md │ ├── README.txt │ ├── examples │ │ ├── ssd1306_128x32_i2c │ │ │ └── ssd1306_128x32_i2c.ino │ │ ├── ssd1306_128x32_spi │ │ │ └── ssd1306_128x32_spi.ino │ │ ├── ssd1306_128x64_i2c │ │ │ └── ssd1306_128x64_i2c.ino │ │ └── ssd1306_128x64_spi │ │ │ └── ssd1306_128x64_spi.ino │ ├── library.properties │ └── license.txt └── SparkFun_CAN-Bus_Arduino_Library │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── examples │ ├── CAN_Read_Demo │ │ └── CAN_Read_Demo.ino │ ├── CAN_Write_Demo │ │ └── CAN_Write_Demo.ino │ ├── SparkFun_CAN_Demo │ │ └── SparkFun_CAN_Demo.ino │ ├── SparkFun_ECU_Demo │ │ └── SparkFun_ECU_Demo.ino │ ├── SparkFun_GPS_Demo │ │ └── SparkFun_GPS_Demo.ino │ ├── SparkFun_Joystick_Demo │ │ └── SparkFun_Joystick_Demo.ino │ ├── SparkFun_SD_Demo │ │ └── SparkFun_SD_Demo.ino │ └── SparkFun_SerialLCD_Demo │ │ └── SparkFun_SerialLCD_Demo.ino │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── src │ ├── Canbus.cpp │ ├── Canbus.h │ ├── defaults.h │ ├── global.h │ ├── mcp2515.c │ ├── mcp2515.h │ └── mcp2515_defs.h └── obd2-oled-arduino.ino /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # obd2-oled-arduino (WIP) 2 | Made a simple OBD 2 reader for my Volkswagen Golf MK6 to show realtime data on a 64x32 OLED display. 3 | 4 | Should probably also work on different VAG (Volkswagen, Audi, Seat and Skoda) models, but never tested it. 5 | 6 | ### Libraries 7 | I used the following libraries and made some changes to make the 64x32 OLED display and CAN-Bus shield work properly. 8 | 9 | - Adafruit_GFX_Library (for OLED display) 10 | - Adafruit_SSD1306 (for OLED display) 11 | - SparkFun_CAN-Bus_Arduino_Library (for CAN-Bus shield) 12 | 13 | ### Parts 14 | - TODO 15 | 16 | ### Documentation / Resources 17 | 18 | - [Online image to byte arrays converter](http://javl.github.io/image2cpp/) 19 | - [VDO NTC Fluide Temperature Probe, Steinhart Hart Coefficients?](https://forum.arduino.cc/index.php?topic=211816.0) 20 | - [V3 MicroSquirt® - QuickStart Guide](http://www.useasydocs.com/theory/ntc.htm) 21 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Adafruit_GFX.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_GFX_H 2 | #define _ADAFRUIT_GFX_H 3 | 4 | #if ARDUINO >= 100 5 | #include "Arduino.h" 6 | #include "Print.h" 7 | #else 8 | #include "WProgram.h" 9 | #endif 10 | #include "gfxfont.h" 11 | 12 | /// A generic graphics superclass that can handle all sorts of drawing. At a minimum you can subclass and provide drawPixel(). At a maximum you can do a ton of overriding to optimize. Used for any/all Adafruit displays! 13 | class Adafruit_GFX : public Print { 14 | 15 | public: 16 | 17 | Adafruit_GFX(int16_t w, int16_t h); // Constructor 18 | 19 | // This MUST be defined by the subclass: 20 | virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; ///< Virtual drawPixel() function to draw to the screen/framebuffer/etc, must be overridden in subclass. @param x X coordinate. @param y Y coordinate. @param color 16-bit pixel color. 21 | 22 | // TRANSACTION API / CORE DRAW API 23 | // These MAY be overridden by the subclass to provide device-specific 24 | // optimized code. Otherwise 'generic' versions are used. 25 | virtual void startWrite(void); 26 | virtual void writePixel(int16_t x, int16_t y, uint16_t color); 27 | virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); 28 | virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); 29 | virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); 30 | virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color); 31 | virtual void endWrite(void); 32 | 33 | // CONTROL API 34 | // These MAY be overridden by the subclass to provide device-specific 35 | // optimized code. Otherwise 'generic' versions are used. 36 | virtual void setRotation(uint8_t r); 37 | virtual void invertDisplay(boolean i); 38 | 39 | // BASIC DRAW API 40 | // These MAY be overridden by the subclass to provide device-specific 41 | // optimized code. Otherwise 'generic' versions are used. 42 | virtual void 43 | // It's good to implement those, even if using transaction API 44 | drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), 45 | drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), 46 | fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), 47 | fillScreen(uint16_t color), 48 | // Optional and probably not necessary to change 49 | drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color), 50 | drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); 51 | 52 | // These exist only with Adafruit_GFX (no subclass overrides) 53 | void 54 | drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), 55 | drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, 56 | uint16_t color), 57 | fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), 58 | fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, 59 | int16_t delta, uint16_t color), 60 | drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, 61 | int16_t x2, int16_t y2, uint16_t color), 62 | fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, 63 | int16_t x2, int16_t y2, uint16_t color), 64 | drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, 65 | int16_t radius, uint16_t color), 66 | fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, 67 | int16_t radius, uint16_t color), 68 | drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], 69 | int16_t w, int16_t h, uint16_t color), 70 | drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], 71 | int16_t w, int16_t h, uint16_t color, uint16_t bg), 72 | drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, 73 | int16_t w, int16_t h, uint16_t color), 74 | drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, 75 | int16_t w, int16_t h, uint16_t color, uint16_t bg), 76 | drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], 77 | int16_t w, int16_t h, uint16_t color), 78 | drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[], 79 | int16_t w, int16_t h), 80 | drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, 81 | int16_t w, int16_t h), 82 | drawGrayscaleBitmap(int16_t x, int16_t y, 83 | const uint8_t bitmap[], const uint8_t mask[], 84 | int16_t w, int16_t h), 85 | drawGrayscaleBitmap(int16_t x, int16_t y, 86 | uint8_t *bitmap, uint8_t *mask, int16_t w, int16_t h), 87 | drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], 88 | int16_t w, int16_t h), 89 | drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, 90 | int16_t w, int16_t h), 91 | drawRGBBitmap(int16_t x, int16_t y, 92 | const uint16_t bitmap[], const uint8_t mask[], 93 | int16_t w, int16_t h), 94 | drawRGBBitmap(int16_t x, int16_t y, 95 | uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h), 96 | drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, 97 | uint16_t bg, uint8_t size), 98 | setCursor(int16_t x, int16_t y), 99 | setTextColor(uint16_t c), 100 | setTextColor(uint16_t c, uint16_t bg), 101 | setTextSize(uint8_t s), 102 | setTextWrap(boolean w), 103 | cp437(boolean x=true), 104 | setFont(const GFXfont *f = NULL), 105 | getTextBounds(char *string, int16_t x, int16_t y, 106 | int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h), 107 | getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y, 108 | int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h); 109 | 110 | #if ARDUINO >= 100 111 | virtual size_t write(uint8_t); 112 | #else 113 | virtual void write(uint8_t); 114 | #endif 115 | 116 | int16_t height(void) const; 117 | int16_t width(void) const; 118 | 119 | uint8_t getRotation(void) const; 120 | 121 | // get current cursor position (get rotation safe maximum values, using: width() for x, height() for y) 122 | int16_t getCursorX(void) const; 123 | int16_t getCursorY(void) const; 124 | 125 | protected: 126 | void 127 | charBounds(char c, int16_t *x, int16_t *y, 128 | int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy); 129 | const int16_t 130 | WIDTH, ///< This is the 'raw' display width - never changes 131 | HEIGHT; ///< This is the 'raw' display height - never changes 132 | int16_t 133 | _width, ///< Display width as modified by current rotation 134 | _height, ///< Display height as modified by current rotation 135 | cursor_x, ///< x location to start print()ing text 136 | cursor_y; ///< y location to start print()ing text 137 | uint16_t 138 | textcolor, ///< 16-bit background color for print() 139 | textbgcolor; ///< 16-bit text color for print() 140 | uint8_t 141 | textsize, ///< Desired magnification of text to print() 142 | rotation; ///< Display rotation (0 thru 3) 143 | boolean 144 | wrap, ///< If set, 'wrap' text at right edge of display 145 | _cp437; ///< If set, use correct CP437 charset (default is off) 146 | GFXfont 147 | *gfxFont; ///< Pointer to special font 148 | }; 149 | 150 | 151 | /// A simple drawn button UI element 152 | class Adafruit_GFX_Button { 153 | 154 | public: 155 | Adafruit_GFX_Button(void); 156 | // "Classic" initButton() uses center & size 157 | void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y, 158 | uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, 159 | uint16_t textcolor, char *label, uint8_t textsize); 160 | // New/alt initButton() uses upper-left corner & size 161 | void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, 162 | uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, 163 | uint16_t textcolor, char *label, uint8_t textsize); 164 | void drawButton(boolean inverted = false); 165 | boolean contains(int16_t x, int16_t y); 166 | 167 | void press(boolean p); 168 | boolean isPressed(); 169 | boolean justPressed(); 170 | boolean justReleased(); 171 | 172 | private: 173 | Adafruit_GFX *_gfx; 174 | int16_t _x1, _y1; // Coordinates of top-left corner 175 | uint16_t _w, _h; 176 | uint8_t _textsize; 177 | uint16_t _outlinecolor, _fillcolor, _textcolor; 178 | char _label[10]; 179 | 180 | boolean currstate, laststate; 181 | }; 182 | 183 | 184 | /// A GFX 1-bit canvas context for graphics 185 | class GFXcanvas1 : public Adafruit_GFX { 186 | public: 187 | GFXcanvas1(uint16_t w, uint16_t h); 188 | ~GFXcanvas1(void); 189 | void drawPixel(int16_t x, int16_t y, uint16_t color), 190 | fillScreen(uint16_t color); 191 | uint8_t *getBuffer(void); 192 | private: 193 | uint8_t *buffer; 194 | }; 195 | 196 | 197 | /// A GFX 8-bit canvas context for graphics 198 | class GFXcanvas8 : public Adafruit_GFX { 199 | public: 200 | GFXcanvas8(uint16_t w, uint16_t h); 201 | ~GFXcanvas8(void); 202 | void drawPixel(int16_t x, int16_t y, uint16_t color), 203 | fillScreen(uint16_t color), 204 | writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); 205 | 206 | uint8_t *getBuffer(void); 207 | private: 208 | uint8_t *buffer; 209 | }; 210 | 211 | 212 | /// A GFX 16-bit canvas context for graphics 213 | class GFXcanvas16 : public Adafruit_GFX { 214 | public: 215 | GFXcanvas16(uint16_t w, uint16_t h); 216 | ~GFXcanvas16(void); 217 | void drawPixel(int16_t x, int16_t y, uint16_t color), 218 | fillScreen(uint16_t color); 219 | uint16_t *getBuffer(void); 220 | private: 221 | uint16_t *buffer; 222 | }; 223 | 224 | #endif // _ADAFRUIT_GFX_H 225 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Adafruit_SPITFT.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_SPITFT_ 2 | #define _ADAFRUIT_SPITFT_ 3 | 4 | #if ARDUINO >= 100 5 | #include "Arduino.h" 6 | #include "Print.h" 7 | #else 8 | #include "WProgram.h" 9 | #endif 10 | #include 11 | #include "Adafruit_GFX.h" 12 | 13 | #define USE_FAST_PINIO 14 | 15 | #if defined(__AVR__) 16 | typedef volatile uint8_t RwReg; 17 | #elif defined(ARDUINO_STM32_FEATHER) 18 | typedef volatile uint32 RwReg; 19 | #elif defined(ARDUINO_FEATHER52) || defined(__arm__) 20 | typedef volatile uint32_t RwReg; 21 | #elif defined(ESP32) || defined(ESP8266) 22 | typedef volatile uint32_t RwReg; 23 | #else 24 | #undefine USE_FAST_PINIO 25 | #endif 26 | 27 | #include "Adafruit_SPITFT_Macros.h" 28 | 29 | /// A heavily optimized SPI display subclass of GFX. Manages SPI bitbanging, transactions, DMA, etc! Despite being called SPITFT, the classic SPI data/command interface is also used by OLEDs. 30 | class Adafruit_SPITFT : public Adafruit_GFX { 31 | protected: 32 | 33 | public: 34 | Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1); 35 | Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _RST = -1); 36 | 37 | virtual void begin(uint32_t freq) = 0; ///< Virtual begin() function to set SPI frequency, must be overridden in subclass. @param freq Maximum SPI hardware clock speed 38 | void initSPI(uint32_t freq); 39 | 40 | // Required Non-Transaction 41 | void drawPixel(int16_t x, int16_t y, uint16_t color); 42 | 43 | // Transaction API 44 | void startWrite(void); 45 | void endWrite(void); 46 | 47 | void writePixel(int16_t x, int16_t y, uint16_t color); 48 | void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); 49 | void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); 50 | void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); 51 | 52 | // Transaction API not used by GFX 53 | 54 | /*! 55 | @brief SPI displays set an address window rectangle for blitting pixels 56 | @param x Top left corner x coordinate 57 | @param y Top left corner x coordinate 58 | @param w Width of window 59 | @param h Height of window 60 | */ 61 | virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0; 62 | 63 | /*! 64 | @brief Write a 2-byte color (must have a transaction in progress) 65 | @param color 16-bit 5-6-5 Color to draw 66 | */ 67 | void inline writePixel(uint16_t color) { SPI_WRITE16(color); } 68 | void writePixels(uint16_t * colors, uint32_t len); 69 | void writeColor(uint16_t color, uint32_t len); 70 | void pushColor(uint16_t color); 71 | 72 | // Recommended Non-Transaction 73 | void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); 74 | void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); 75 | void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); 76 | 77 | using Adafruit_GFX::drawRGBBitmap; // Check base class first 78 | void drawRGBBitmap(int16_t x, int16_t y, 79 | uint16_t *pcolors, int16_t w, int16_t h); 80 | void invertDisplay(boolean i); 81 | 82 | uint16_t color565(uint8_t r, uint8_t g, uint8_t b); 83 | 84 | protected: 85 | uint32_t _freq; ///< SPI clock frequency (for hardware SPI) 86 | #if defined (__AVR__) || defined(TEENSYDUINO) || defined (ESP8266) || defined (ESP32) 87 | int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; 88 | #else 89 | int32_t _cs, ///< Arduino pin # for chip-select pin 90 | _dc, ///< Arduino pin # for data-command pin 91 | _rst, ///< Arduino pin # for reset pin 92 | _sclk, ///< Arduino pin # for SPI clock pin 93 | _mosi, ///< Arduino pin # for SPI MOSI pin 94 | _miso; ///< Arduino pin # for SPI MISO pin 95 | #endif 96 | 97 | #ifdef USE_FAST_PINIO 98 | volatile RwReg *mosiport, ///< Direct chip register for toggling MOSI with fast bitbang IO 99 | *misoport, ///< Direct chip register for toggling MISO with fast bitbang IO 100 | *clkport, ///< Direct chip register for toggling CLK with fast bitbang IO 101 | *dcport, ///< Direct chip register for toggling DC with fast bitbang IO 102 | *csport; ///< Direct chip register for toggling CS with fast bitbang IO 103 | RwReg mosipinmask, ///< bitmask for turning on/off MOSI with fast register bitbang IO 104 | misopinmask, ///< bitmask for turning on/off MISO with fast register bitbang IO 105 | clkpinmask, ///< bitmask for turning on/off CLK with fast register bitbang IO 106 | cspinmask, ///< bitmask for turning on/off CS with fast register bitbang IO 107 | dcpinmask; ///< bitmask for turning on/off DC with fast register bitbang IO 108 | #endif 109 | 110 | void writeCommand(uint8_t cmd); 111 | void spiWrite(uint8_t v); 112 | uint8_t spiRead(void); 113 | 114 | uint8_t invertOnCommand = 0, ///< SPI command byte to turn on invert 115 | invertOffCommand = 0; ///< SPI command byte to turn off invert 116 | int16_t _xstart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the x offset from 0 to align 117 | int16_t _ystart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the y offset from 0 to align 118 | }; 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Adafruit_SPITFT_Macros.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_SPITFT_MACROS 2 | #define _ADAFRUIT_SPITFT_MACROS 3 | 4 | /* 5 | * Control Pins 6 | * */ 7 | 8 | #ifdef USE_FAST_PINIO 9 | #define SPI_DC_HIGH() *dcport |= dcpinmask 10 | #define SPI_DC_LOW() *dcport &= ~dcpinmask 11 | #define SPI_CS_HIGH() *csport |= cspinmask 12 | #define SPI_CS_LOW() *csport &= ~cspinmask 13 | #else 14 | #define SPI_DC_HIGH() digitalWrite(_dc, HIGH) 15 | #define SPI_DC_LOW() digitalWrite(_dc, LOW) 16 | #define SPI_CS_HIGH() { if(_cs >= 0) digitalWrite(_cs, HIGH) } 17 | #define SPI_CS_LOW() { if(_cs >= 0) digitalWrite(_cs, LOW) } 18 | #endif 19 | 20 | /* 21 | * Software SPI Macros 22 | * */ 23 | 24 | #ifdef USE_FAST_PINIO 25 | #define SSPI_MOSI_HIGH() *mosiport |= mosipinmask 26 | #define SSPI_MOSI_LOW() *mosiport &= ~mosipinmask 27 | #define SSPI_SCK_HIGH() *clkport |= clkpinmask 28 | #define SSPI_SCK_LOW() *clkport &= ~clkpinmask 29 | #define SSPI_MISO_READ() ((*misoport & misopinmask) != 0) 30 | #else 31 | #define SSPI_MOSI_HIGH() digitalWrite(_mosi, HIGH) 32 | #define SSPI_MOSI_LOW() digitalWrite(_mosi, LOW) 33 | #define SSPI_SCK_HIGH() digitalWrite(_sclk, HIGH) 34 | #define SSPI_SCK_LOW() digitalWrite(_sclk, LOW) 35 | #define SSPI_MISO_READ() digitalRead(_miso) 36 | #endif 37 | 38 | #define SSPI_BEGIN_TRANSACTION() 39 | #define SSPI_END_TRANSACTION() 40 | #define SSPI_WRITE(v) spiWrite(v) 41 | #define SSPI_WRITE16(s) SSPI_WRITE((s) >> 8); SSPI_WRITE(s) 42 | #define SSPI_WRITE32(l) SSPI_WRITE((l) >> 24); SSPI_WRITE((l) >> 16); SSPI_WRITE((l) >> 8); SSPI_WRITE(l) 43 | #define SSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ SSPI_WRITE(((uint8_t*)(c))[i+1]); SSPI_WRITE(((uint8_t*)(c))[i]); } 44 | 45 | /* 46 | * Hardware SPI Macros 47 | * */ 48 | 49 | #define SPI_OBJECT SPI 50 | 51 | #if defined (__AVR__) || defined(TEENSYDUINO) || defined(ARDUINO_ARCH_STM32F1) 52 | #define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(SPI_CLOCK_DIV2); 53 | #elif defined (__arm__) 54 | #define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(11); 55 | #elif defined(ESP8266) || defined(ESP32) 56 | #define HSPI_SET_CLOCK() SPI_OBJECT.setFrequency(_freq); 57 | #elif defined(RASPI) 58 | #define HSPI_SET_CLOCK() SPI_OBJECT.setClock(_freq); 59 | #elif defined(ARDUINO_ARCH_STM32F1) 60 | #define HSPI_SET_CLOCK() SPI_OBJECT.setClock(_freq); 61 | #else 62 | #define HSPI_SET_CLOCK() 63 | #endif 64 | 65 | #ifdef SPI_HAS_TRANSACTION 66 | #define HSPI_BEGIN_TRANSACTION() SPI_OBJECT.beginTransaction(SPISettings(_freq, MSBFIRST, SPI_MODE0)) 67 | #define HSPI_END_TRANSACTION() SPI_OBJECT.endTransaction() 68 | #else 69 | #define HSPI_BEGIN_TRANSACTION() HSPI_SET_CLOCK(); SPI_OBJECT.setBitOrder(MSBFIRST); SPI_OBJECT.setDataMode(SPI_MODE0) 70 | #define HSPI_END_TRANSACTION() 71 | #endif 72 | 73 | #ifdef ESP32 74 | #define SPI_HAS_WRITE_PIXELS 75 | #endif 76 | #if defined(ESP8266) || defined(ESP32) 77 | // Optimized SPI (ESP8266 and ESP32) 78 | #define HSPI_READ() SPI_OBJECT.transfer(0) 79 | #define HSPI_WRITE(b) SPI_OBJECT.write(b) 80 | #define HSPI_WRITE16(s) SPI_OBJECT.write16(s) 81 | #define HSPI_WRITE32(l) SPI_OBJECT.write32(l) 82 | #ifdef SPI_HAS_WRITE_PIXELS 83 | #define SPI_MAX_PIXELS_AT_ONCE 32 84 | #define HSPI_WRITE_PIXELS(c,l) SPI_OBJECT.writePixels(c,l) 85 | #else 86 | #define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<((l)/2); i++){ SPI_WRITE16(((uint16_t*)(c))[i]); } 87 | #endif 88 | #else 89 | // Standard Byte-by-Byte SPI 90 | 91 | #if defined (__AVR__) || defined(TEENSYDUINO) 92 | static inline uint8_t _avr_spi_read(void) __attribute__((always_inline)); 93 | static inline uint8_t _avr_spi_read(void) { 94 | uint8_t r = 0; 95 | SPDR = r; 96 | while(!(SPSR & _BV(SPIF))); 97 | r = SPDR; 98 | return r; 99 | } 100 | #define HSPI_WRITE(b) {SPDR = (b); while(!(SPSR & _BV(SPIF)));} 101 | #define HSPI_READ() _avr_spi_read() 102 | #else 103 | #define HSPI_WRITE(b) SPI_OBJECT.transfer((uint8_t)(b)) 104 | #define HSPI_READ() HSPI_WRITE(0) 105 | #endif 106 | #define HSPI_WRITE16(s) HSPI_WRITE((s) >> 8); HSPI_WRITE(s) 107 | #define HSPI_WRITE32(l) HSPI_WRITE((l) >> 24); HSPI_WRITE((l) >> 16); HSPI_WRITE((l) >> 8); HSPI_WRITE(l) 108 | #define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ HSPI_WRITE(((uint8_t*)(c))[i+1]); HSPI_WRITE(((uint8_t*)(c))[i]); } 109 | #endif 110 | 111 | #define SPI_BEGIN() if(_sclk < 0){SPI_OBJECT.begin();} 112 | #define SPI_BEGIN_TRANSACTION() if(_sclk < 0){HSPI_BEGIN_TRANSACTION();} 113 | #define SPI_END_TRANSACTION() if(_sclk < 0){HSPI_END_TRANSACTION();} 114 | #define SPI_WRITE16(s) if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);} 115 | #define SPI_WRITE32(l) if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);} 116 | #define SPI_WRITE_PIXELS(c,l) if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);} 117 | 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Fonts/FreeMono9pt7b.h: -------------------------------------------------------------------------------- 1 | const uint8_t FreeMono9pt7bBitmaps[] PROGMEM = { 2 | 0xAA, 0xA8, 0x0C, 0xED, 0x24, 0x92, 0x48, 0x24, 0x48, 0x91, 0x2F, 0xE4, 3 | 0x89, 0x7F, 0x28, 0x51, 0x22, 0x40, 0x08, 0x3E, 0x62, 0x40, 0x30, 0x0E, 4 | 0x01, 0x81, 0xC3, 0xBE, 0x08, 0x08, 0x71, 0x12, 0x23, 0x80, 0x23, 0xB8, 5 | 0x0E, 0x22, 0x44, 0x70, 0x38, 0x81, 0x02, 0x06, 0x1A, 0x65, 0x46, 0xC8, 6 | 0xEC, 0xE9, 0x24, 0x5A, 0xAA, 0xA9, 0x40, 0xA9, 0x55, 0x5A, 0x80, 0x10, 7 | 0x22, 0x4B, 0xE3, 0x05, 0x11, 0x00, 0x10, 0x20, 0x47, 0xF1, 0x02, 0x04, 8 | 0x00, 0x6B, 0x48, 0xFF, 0x00, 0xF0, 0x02, 0x08, 0x10, 0x60, 0x81, 0x04, 9 | 0x08, 0x20, 0x41, 0x02, 0x08, 0x00, 0x38, 0x8A, 0x0C, 0x18, 0x30, 0x60, 10 | 0xC1, 0x82, 0x88, 0xE0, 0x27, 0x28, 0x42, 0x10, 0x84, 0x21, 0x3E, 0x38, 11 | 0x8A, 0x08, 0x10, 0x20, 0x82, 0x08, 0x61, 0x03, 0xF8, 0x7C, 0x06, 0x02, 12 | 0x02, 0x1C, 0x06, 0x01, 0x01, 0x01, 0x42, 0x3C, 0x18, 0xA2, 0x92, 0x8A, 13 | 0x28, 0xBF, 0x08, 0x21, 0xC0, 0x7C, 0x81, 0x03, 0xE4, 0x40, 0x40, 0x81, 14 | 0x03, 0x88, 0xE0, 0x1E, 0x41, 0x04, 0x0B, 0x98, 0xB0, 0xC1, 0xC2, 0x88, 15 | 0xE0, 0xFE, 0x04, 0x08, 0x20, 0x40, 0x82, 0x04, 0x08, 0x20, 0x40, 0x38, 16 | 0x8A, 0x0C, 0x14, 0x47, 0x11, 0x41, 0x83, 0x8C, 0xE0, 0x38, 0x8A, 0x1C, 17 | 0x18, 0x68, 0xCE, 0x81, 0x04, 0x13, 0xC0, 0xF0, 0x0F, 0x6C, 0x00, 0xD2, 18 | 0xD2, 0x00, 0x03, 0x04, 0x18, 0x60, 0x60, 0x18, 0x04, 0x03, 0xFF, 0x80, 19 | 0x00, 0x1F, 0xF0, 0x40, 0x18, 0x03, 0x00, 0x60, 0x20, 0x60, 0xC0, 0x80, 20 | 0x3D, 0x84, 0x08, 0x30, 0xC2, 0x00, 0x00, 0x00, 0x30, 0x3C, 0x46, 0x82, 21 | 0x8E, 0xB2, 0xA2, 0xA2, 0x9F, 0x80, 0x80, 0x40, 0x3C, 0x3C, 0x01, 0x40, 22 | 0x28, 0x09, 0x01, 0x10, 0x42, 0x0F, 0xC1, 0x04, 0x40, 0x9E, 0x3C, 0xFE, 23 | 0x21, 0x90, 0x48, 0x67, 0xE2, 0x09, 0x02, 0x81, 0x41, 0xFF, 0x80, 0x3E, 24 | 0xB0, 0xF0, 0x30, 0x08, 0x04, 0x02, 0x00, 0x80, 0x60, 0x8F, 0x80, 0xFE, 25 | 0x21, 0x90, 0x68, 0x14, 0x0A, 0x05, 0x02, 0x83, 0x43, 0x7F, 0x00, 0xFF, 26 | 0x20, 0x90, 0x08, 0x87, 0xC2, 0x21, 0x00, 0x81, 0x40, 0xFF, 0xC0, 0xFF, 27 | 0xA0, 0x50, 0x08, 0x87, 0xC2, 0x21, 0x00, 0x80, 0x40, 0x78, 0x00, 0x1E, 28 | 0x98, 0x6C, 0x0A, 0x00, 0x80, 0x20, 0xF8, 0x0B, 0x02, 0x60, 0x87, 0xC0, 29 | 0xE3, 0xA0, 0x90, 0x48, 0x27, 0xF2, 0x09, 0x04, 0x82, 0x41, 0x71, 0xC0, 30 | 0xF9, 0x08, 0x42, 0x10, 0x84, 0x27, 0xC0, 0x1F, 0x02, 0x02, 0x02, 0x02, 31 | 0x02, 0x82, 0x82, 0xC6, 0x78, 0xE3, 0xA1, 0x11, 0x09, 0x05, 0x83, 0x21, 32 | 0x08, 0x84, 0x41, 0x70, 0xC0, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x41, 33 | 0x41, 0x41, 0xFF, 0xE0, 0xEC, 0x19, 0x45, 0x28, 0xA4, 0xA4, 0x94, 0x91, 34 | 0x12, 0x02, 0x40, 0x5C, 0x1C, 0xC3, 0xB0, 0x94, 0x4A, 0x24, 0x92, 0x49, 35 | 0x14, 0x8A, 0x43, 0x70, 0x80, 0x1E, 0x31, 0x90, 0x50, 0x18, 0x0C, 0x06, 36 | 0x02, 0x82, 0x63, 0x0F, 0x00, 0xFE, 0x43, 0x41, 0x41, 0x42, 0x7C, 0x40, 37 | 0x40, 0x40, 0xF0, 0x1C, 0x31, 0x90, 0x50, 0x18, 0x0C, 0x06, 0x02, 0x82, 38 | 0x63, 0x1F, 0x04, 0x07, 0x92, 0x30, 0xFE, 0x21, 0x90, 0x48, 0x24, 0x23, 39 | 0xE1, 0x10, 0x84, 0x41, 0x70, 0xC0, 0x3A, 0xCD, 0x0A, 0x03, 0x01, 0x80, 40 | 0xC1, 0xC7, 0x78, 0xFF, 0xC4, 0x62, 0x21, 0x00, 0x80, 0x40, 0x20, 0x10, 41 | 0x08, 0x1F, 0x00, 0xE3, 0xA0, 0x90, 0x48, 0x24, 0x12, 0x09, 0x04, 0x82, 42 | 0x22, 0x0E, 0x00, 0xF1, 0xE8, 0x10, 0x82, 0x10, 0x42, 0x10, 0x22, 0x04, 43 | 0x80, 0x50, 0x0C, 0x00, 0x80, 0xF1, 0xE8, 0x09, 0x11, 0x25, 0x44, 0xA8, 44 | 0x55, 0x0C, 0xA1, 0x8C, 0x31, 0x84, 0x30, 0xE3, 0xA0, 0x88, 0x82, 0x80, 45 | 0x80, 0xC0, 0x90, 0x44, 0x41, 0x71, 0xC0, 0xE3, 0xA0, 0x88, 0x82, 0x81, 46 | 0x40, 0x40, 0x20, 0x10, 0x08, 0x1F, 0x00, 0xFD, 0x0A, 0x20, 0x81, 0x04, 47 | 0x10, 0x21, 0x83, 0xFC, 0xEA, 0xAA, 0xAA, 0xC0, 0x80, 0x81, 0x03, 0x02, 48 | 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0xD5, 0x55, 0x55, 0xC0, 49 | 0x10, 0x51, 0x22, 0x28, 0x20, 0xFF, 0xE0, 0x88, 0x80, 0x7E, 0x00, 0x80, 50 | 0x47, 0xEC, 0x14, 0x0A, 0x0C, 0xFB, 0xC0, 0x20, 0x10, 0x0B, 0xC6, 0x12, 51 | 0x05, 0x02, 0x81, 0x40, 0xB0, 0xB7, 0x80, 0x3A, 0x8E, 0x0C, 0x08, 0x10, 52 | 0x10, 0x9E, 0x03, 0x00, 0x80, 0x47, 0xA4, 0x34, 0x0A, 0x05, 0x02, 0x81, 53 | 0x21, 0x8F, 0x60, 0x3C, 0x43, 0x81, 0xFF, 0x80, 0x80, 0x61, 0x3E, 0x3D, 54 | 0x04, 0x3E, 0x41, 0x04, 0x10, 0x41, 0x0F, 0x80, 0x3D, 0xA1, 0xA0, 0x50, 55 | 0x28, 0x14, 0x09, 0x0C, 0x7A, 0x01, 0x01, 0x87, 0x80, 0xC0, 0x20, 0x10, 56 | 0x0B, 0xC6, 0x32, 0x09, 0x04, 0x82, 0x41, 0x20, 0xB8, 0xE0, 0x10, 0x01, 57 | 0xC0, 0x81, 0x02, 0x04, 0x08, 0x11, 0xFC, 0x10, 0x3E, 0x10, 0x84, 0x21, 58 | 0x08, 0x42, 0x3F, 0x00, 0xC0, 0x40, 0x40, 0x4F, 0x44, 0x58, 0x70, 0x48, 59 | 0x44, 0x42, 0xC7, 0x70, 0x20, 0x40, 0x81, 0x02, 0x04, 0x08, 0x10, 0x23, 60 | 0xF8, 0xB7, 0x64, 0x62, 0x31, 0x18, 0x8C, 0x46, 0x23, 0x91, 0x5E, 0x31, 61 | 0x90, 0x48, 0x24, 0x12, 0x09, 0x05, 0xC7, 0x3E, 0x31, 0xA0, 0x30, 0x18, 62 | 0x0C, 0x05, 0x8C, 0x7C, 0xDE, 0x30, 0x90, 0x28, 0x14, 0x0A, 0x05, 0x84, 63 | 0xBC, 0x40, 0x20, 0x38, 0x00, 0x3D, 0xA1, 0xA0, 0x50, 0x28, 0x14, 0x09, 64 | 0x0C, 0x7A, 0x01, 0x00, 0x80, 0xE0, 0xCE, 0xA1, 0x82, 0x04, 0x08, 0x10, 65 | 0x7C, 0x3A, 0x8D, 0x0B, 0x80, 0xF0, 0x70, 0xDE, 0x40, 0x40, 0xFC, 0x40, 66 | 0x40, 0x40, 0x40, 0x40, 0x41, 0x3E, 0xC3, 0x41, 0x41, 0x41, 0x41, 0x41, 67 | 0x43, 0x3D, 0xE3, 0xA0, 0x90, 0x84, 0x42, 0x20, 0xA0, 0x50, 0x10, 0xE3, 68 | 0xC0, 0x92, 0x4B, 0x25, 0x92, 0xA9, 0x98, 0x44, 0xE3, 0x31, 0x05, 0x01, 69 | 0x01, 0x41, 0x11, 0x05, 0xC7, 0xE3, 0xA0, 0x90, 0x84, 0x42, 0x40, 0xA0, 70 | 0x60, 0x10, 0x10, 0x08, 0x3E, 0x00, 0xFD, 0x08, 0x20, 0x82, 0x08, 0x10, 71 | 0xBF, 0x29, 0x24, 0xA2, 0x49, 0x26, 0xFF, 0xF8, 0x89, 0x24, 0x8A, 0x49, 72 | 0x2C, 0x61, 0x24, 0x30 }; 73 | 74 | const GFXglyph FreeMono9pt7bGlyphs[] PROGMEM = { 75 | { 0, 0, 0, 11, 0, 1 }, // 0x20 ' ' 76 | { 0, 2, 11, 11, 4, -10 }, // 0x21 '!' 77 | { 3, 6, 5, 11, 2, -10 }, // 0x22 '"' 78 | { 7, 7, 12, 11, 2, -10 }, // 0x23 '#' 79 | { 18, 8, 12, 11, 1, -10 }, // 0x24 '$' 80 | { 30, 7, 11, 11, 2, -10 }, // 0x25 '%' 81 | { 40, 7, 10, 11, 2, -9 }, // 0x26 '&' 82 | { 49, 3, 5, 11, 4, -10 }, // 0x27 ''' 83 | { 51, 2, 13, 11, 5, -10 }, // 0x28 '(' 84 | { 55, 2, 13, 11, 4, -10 }, // 0x29 ')' 85 | { 59, 7, 7, 11, 2, -10 }, // 0x2A '*' 86 | { 66, 7, 7, 11, 2, -8 }, // 0x2B '+' 87 | { 73, 3, 5, 11, 2, -1 }, // 0x2C ',' 88 | { 75, 9, 1, 11, 1, -5 }, // 0x2D '-' 89 | { 77, 2, 2, 11, 4, -1 }, // 0x2E '.' 90 | { 78, 7, 13, 11, 2, -11 }, // 0x2F '/' 91 | { 90, 7, 11, 11, 2, -10 }, // 0x30 '0' 92 | { 100, 5, 11, 11, 3, -10 }, // 0x31 '1' 93 | { 107, 7, 11, 11, 2, -10 }, // 0x32 '2' 94 | { 117, 8, 11, 11, 1, -10 }, // 0x33 '3' 95 | { 128, 6, 11, 11, 3, -10 }, // 0x34 '4' 96 | { 137, 7, 11, 11, 2, -10 }, // 0x35 '5' 97 | { 147, 7, 11, 11, 2, -10 }, // 0x36 '6' 98 | { 157, 7, 11, 11, 2, -10 }, // 0x37 '7' 99 | { 167, 7, 11, 11, 2, -10 }, // 0x38 '8' 100 | { 177, 7, 11, 11, 2, -10 }, // 0x39 '9' 101 | { 187, 2, 8, 11, 4, -7 }, // 0x3A ':' 102 | { 189, 3, 11, 11, 3, -7 }, // 0x3B ';' 103 | { 194, 8, 8, 11, 1, -8 }, // 0x3C '<' 104 | { 202, 9, 4, 11, 1, -6 }, // 0x3D '=' 105 | { 207, 9, 8, 11, 1, -8 }, // 0x3E '>' 106 | { 216, 7, 10, 11, 2, -9 }, // 0x3F '?' 107 | { 225, 8, 12, 11, 2, -10 }, // 0x40 '@' 108 | { 237, 11, 10, 11, 0, -9 }, // 0x41 'A' 109 | { 251, 9, 10, 11, 1, -9 }, // 0x42 'B' 110 | { 263, 9, 10, 11, 1, -9 }, // 0x43 'C' 111 | { 275, 9, 10, 11, 1, -9 }, // 0x44 'D' 112 | { 287, 9, 10, 11, 1, -9 }, // 0x45 'E' 113 | { 299, 9, 10, 11, 1, -9 }, // 0x46 'F' 114 | { 311, 10, 10, 11, 1, -9 }, // 0x47 'G' 115 | { 324, 9, 10, 11, 1, -9 }, // 0x48 'H' 116 | { 336, 5, 10, 11, 3, -9 }, // 0x49 'I' 117 | { 343, 8, 10, 11, 2, -9 }, // 0x4A 'J' 118 | { 353, 9, 10, 11, 1, -9 }, // 0x4B 'K' 119 | { 365, 8, 10, 11, 2, -9 }, // 0x4C 'L' 120 | { 375, 11, 10, 11, 0, -9 }, // 0x4D 'M' 121 | { 389, 9, 10, 11, 1, -9 }, // 0x4E 'N' 122 | { 401, 9, 10, 11, 1, -9 }, // 0x4F 'O' 123 | { 413, 8, 10, 11, 1, -9 }, // 0x50 'P' 124 | { 423, 9, 13, 11, 1, -9 }, // 0x51 'Q' 125 | { 438, 9, 10, 11, 1, -9 }, // 0x52 'R' 126 | { 450, 7, 10, 11, 2, -9 }, // 0x53 'S' 127 | { 459, 9, 10, 11, 1, -9 }, // 0x54 'T' 128 | { 471, 9, 10, 11, 1, -9 }, // 0x55 'U' 129 | { 483, 11, 10, 11, 0, -9 }, // 0x56 'V' 130 | { 497, 11, 10, 11, 0, -9 }, // 0x57 'W' 131 | { 511, 9, 10, 11, 1, -9 }, // 0x58 'X' 132 | { 523, 9, 10, 11, 1, -9 }, // 0x59 'Y' 133 | { 535, 7, 10, 11, 2, -9 }, // 0x5A 'Z' 134 | { 544, 2, 13, 11, 5, -10 }, // 0x5B '[' 135 | { 548, 7, 13, 11, 2, -11 }, // 0x5C '\' 136 | { 560, 2, 13, 11, 4, -10 }, // 0x5D ']' 137 | { 564, 7, 5, 11, 2, -10 }, // 0x5E '^' 138 | { 569, 11, 1, 11, 0, 2 }, // 0x5F '_' 139 | { 571, 3, 3, 11, 3, -11 }, // 0x60 '`' 140 | { 573, 9, 8, 11, 1, -7 }, // 0x61 'a' 141 | { 582, 9, 11, 11, 1, -10 }, // 0x62 'b' 142 | { 595, 7, 8, 11, 2, -7 }, // 0x63 'c' 143 | { 602, 9, 11, 11, 1, -10 }, // 0x64 'd' 144 | { 615, 8, 8, 11, 1, -7 }, // 0x65 'e' 145 | { 623, 6, 11, 11, 3, -10 }, // 0x66 'f' 146 | { 632, 9, 11, 11, 1, -7 }, // 0x67 'g' 147 | { 645, 9, 11, 11, 1, -10 }, // 0x68 'h' 148 | { 658, 7, 10, 11, 2, -9 }, // 0x69 'i' 149 | { 667, 5, 13, 11, 3, -9 }, // 0x6A 'j' 150 | { 676, 8, 11, 11, 2, -10 }, // 0x6B 'k' 151 | { 687, 7, 11, 11, 2, -10 }, // 0x6C 'l' 152 | { 697, 9, 8, 11, 1, -7 }, // 0x6D 'm' 153 | { 706, 9, 8, 11, 1, -7 }, // 0x6E 'n' 154 | { 715, 9, 8, 11, 1, -7 }, // 0x6F 'o' 155 | { 724, 9, 11, 11, 1, -7 }, // 0x70 'p' 156 | { 737, 9, 11, 11, 1, -7 }, // 0x71 'q' 157 | { 750, 7, 8, 11, 3, -7 }, // 0x72 'r' 158 | { 757, 7, 8, 11, 2, -7 }, // 0x73 's' 159 | { 764, 8, 10, 11, 2, -9 }, // 0x74 't' 160 | { 774, 8, 8, 11, 1, -7 }, // 0x75 'u' 161 | { 782, 9, 8, 11, 1, -7 }, // 0x76 'v' 162 | { 791, 9, 8, 11, 1, -7 }, // 0x77 'w' 163 | { 800, 9, 8, 11, 1, -7 }, // 0x78 'x' 164 | { 809, 9, 11, 11, 1, -7 }, // 0x79 'y' 165 | { 822, 7, 8, 11, 2, -7 }, // 0x7A 'z' 166 | { 829, 3, 13, 11, 4, -10 }, // 0x7B '{' 167 | { 834, 1, 13, 11, 5, -10 }, // 0x7C '|' 168 | { 836, 3, 13, 11, 4, -10 }, // 0x7D '}' 169 | { 841, 7, 3, 11, 2, -6 } }; // 0x7E '~' 170 | 171 | const GFXfont FreeMono9pt7b PROGMEM = { 172 | (uint8_t *)FreeMono9pt7bBitmaps, 173 | (GFXglyph *)FreeMono9pt7bGlyphs, 174 | 0x20, 0x7E, 18 }; 175 | 176 | // Approx. 1516 bytes 177 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Fonts/Org_01.h: -------------------------------------------------------------------------------- 1 | // Org_v01 by Orgdot (www.orgdot.com/aliasfonts). A tiny, 2 | // stylized font with all characters within a 6 pixel height. 3 | 4 | const uint8_t Org_01Bitmaps[] PROGMEM = { 5 | 0xE8, 0xA0, 0x57, 0xD5, 0xF5, 0x00, 0xFD, 0x3E, 0x5F, 0x80, 0x88, 0x88, 6 | 0x88, 0x80, 0xF4, 0xBF, 0x2E, 0x80, 0x80, 0x6A, 0x40, 0x95, 0x80, 0xAA, 7 | 0x80, 0x5D, 0x00, 0xC0, 0xF0, 0x80, 0x08, 0x88, 0x88, 0x00, 0xFC, 0x63, 8 | 0x1F, 0x80, 0xF8, 0xF8, 0x7F, 0x0F, 0x80, 0xF8, 0x7E, 0x1F, 0x80, 0x8C, 9 | 0x7E, 0x10, 0x80, 0xFC, 0x3E, 0x1F, 0x80, 0xFC, 0x3F, 0x1F, 0x80, 0xF8, 10 | 0x42, 0x10, 0x80, 0xFC, 0x7F, 0x1F, 0x80, 0xFC, 0x7E, 0x1F, 0x80, 0x90, 11 | 0xB0, 0x2A, 0x22, 0xF0, 0xF0, 0x88, 0xA8, 0xF8, 0x4E, 0x02, 0x00, 0xFD, 12 | 0x6F, 0x0F, 0x80, 0xFC, 0x7F, 0x18, 0x80, 0xF4, 0x7D, 0x1F, 0x00, 0xFC, 13 | 0x21, 0x0F, 0x80, 0xF4, 0x63, 0x1F, 0x00, 0xFC, 0x3F, 0x0F, 0x80, 0xFC, 14 | 0x3F, 0x08, 0x00, 0xFC, 0x2F, 0x1F, 0x80, 0x8C, 0x7F, 0x18, 0x80, 0xF9, 15 | 0x08, 0x4F, 0x80, 0x78, 0x85, 0x2F, 0x80, 0x8D, 0xB1, 0x68, 0x80, 0x84, 16 | 0x21, 0x0F, 0x80, 0xFD, 0x6B, 0x5A, 0x80, 0xFC, 0x63, 0x18, 0x80, 0xFC, 17 | 0x63, 0x1F, 0x80, 0xFC, 0x7F, 0x08, 0x00, 0xFC, 0x63, 0x3F, 0x80, 0xFC, 18 | 0x7F, 0x29, 0x00, 0xFC, 0x3E, 0x1F, 0x80, 0xF9, 0x08, 0x42, 0x00, 0x8C, 19 | 0x63, 0x1F, 0x80, 0x8C, 0x62, 0xA2, 0x00, 0xAD, 0x6B, 0x5F, 0x80, 0x8A, 20 | 0x88, 0xA8, 0x80, 0x8C, 0x54, 0x42, 0x00, 0xF8, 0x7F, 0x0F, 0x80, 0xEA, 21 | 0xC0, 0x82, 0x08, 0x20, 0x80, 0xD5, 0xC0, 0x54, 0xF8, 0x80, 0xF1, 0xFF, 22 | 0x8F, 0x99, 0xF0, 0xF8, 0x8F, 0x1F, 0x99, 0xF0, 0xFF, 0x8F, 0x6B, 0xA4, 23 | 0xF9, 0x9F, 0x10, 0x8F, 0x99, 0x90, 0xF0, 0x55, 0xC0, 0x8A, 0xF9, 0x90, 24 | 0xF8, 0xFD, 0x63, 0x10, 0xF9, 0x99, 0xF9, 0x9F, 0xF9, 0x9F, 0x80, 0xF9, 25 | 0x9F, 0x20, 0xF8, 0x88, 0x47, 0x1F, 0x27, 0xC8, 0x42, 0x00, 0x99, 0x9F, 26 | 0x99, 0x97, 0x8C, 0x6B, 0xF0, 0x96, 0x69, 0x99, 0x9F, 0x10, 0x2E, 0x8F, 27 | 0x2B, 0x22, 0xF8, 0x89, 0xA8, 0x0F, 0xE0 }; 28 | 29 | const GFXglyph Org_01Glyphs[] PROGMEM = { 30 | { 0, 0, 0, 6, 0, 1 }, // 0x20 ' ' 31 | { 0, 1, 5, 2, 0, -4 }, // 0x21 '!' 32 | { 1, 3, 1, 4, 0, -4 }, // 0x22 '"' 33 | { 2, 5, 5, 6, 0, -4 }, // 0x23 '#' 34 | { 6, 5, 5, 6, 0, -4 }, // 0x24 '$' 35 | { 10, 5, 5, 6, 0, -4 }, // 0x25 '%' 36 | { 14, 5, 5, 6, 0, -4 }, // 0x26 '&' 37 | { 18, 1, 1, 2, 0, -4 }, // 0x27 ''' 38 | { 19, 2, 5, 3, 0, -4 }, // 0x28 '(' 39 | { 21, 2, 5, 3, 0, -4 }, // 0x29 ')' 40 | { 23, 3, 3, 4, 0, -3 }, // 0x2A '*' 41 | { 25, 3, 3, 4, 0, -3 }, // 0x2B '+' 42 | { 27, 1, 2, 2, 0, 0 }, // 0x2C ',' 43 | { 28, 4, 1, 5, 0, -2 }, // 0x2D '-' 44 | { 29, 1, 1, 2, 0, 0 }, // 0x2E '.' 45 | { 30, 5, 5, 6, 0, -4 }, // 0x2F '/' 46 | { 34, 5, 5, 6, 0, -4 }, // 0x30 '0' 47 | { 38, 1, 5, 2, 0, -4 }, // 0x31 '1' 48 | { 39, 5, 5, 6, 0, -4 }, // 0x32 '2' 49 | { 43, 5, 5, 6, 0, -4 }, // 0x33 '3' 50 | { 47, 5, 5, 6, 0, -4 }, // 0x34 '4' 51 | { 51, 5, 5, 6, 0, -4 }, // 0x35 '5' 52 | { 55, 5, 5, 6, 0, -4 }, // 0x36 '6' 53 | { 59, 5, 5, 6, 0, -4 }, // 0x37 '7' 54 | { 63, 5, 5, 6, 0, -4 }, // 0x38 '8' 55 | { 67, 5, 5, 6, 0, -4 }, // 0x39 '9' 56 | { 71, 1, 4, 2, 0, -3 }, // 0x3A ':' 57 | { 72, 1, 4, 2, 0, -3 }, // 0x3B ';' 58 | { 73, 3, 5, 4, 0, -4 }, // 0x3C '<' 59 | { 75, 4, 3, 5, 0, -3 }, // 0x3D '=' 60 | { 77, 3, 5, 4, 0, -4 }, // 0x3E '>' 61 | { 79, 5, 5, 6, 0, -4 }, // 0x3F '?' 62 | { 83, 5, 5, 6, 0, -4 }, // 0x40 '@' 63 | { 87, 5, 5, 6, 0, -4 }, // 0x41 'A' 64 | { 91, 5, 5, 6, 0, -4 }, // 0x42 'B' 65 | { 95, 5, 5, 6, 0, -4 }, // 0x43 'C' 66 | { 99, 5, 5, 6, 0, -4 }, // 0x44 'D' 67 | { 103, 5, 5, 6, 0, -4 }, // 0x45 'E' 68 | { 107, 5, 5, 6, 0, -4 }, // 0x46 'F' 69 | { 111, 5, 5, 6, 0, -4 }, // 0x47 'G' 70 | { 115, 5, 5, 6, 0, -4 }, // 0x48 'H' 71 | { 119, 5, 5, 6, 0, -4 }, // 0x49 'I' 72 | { 123, 5, 5, 6, 0, -4 }, // 0x4A 'J' 73 | { 127, 5, 5, 6, 0, -4 }, // 0x4B 'K' 74 | { 131, 5, 5, 6, 0, -4 }, // 0x4C 'L' 75 | { 135, 5, 5, 6, 0, -4 }, // 0x4D 'M' 76 | { 139, 5, 5, 6, 0, -4 }, // 0x4E 'N' 77 | { 143, 5, 5, 6, 0, -4 }, // 0x4F 'O' 78 | { 147, 5, 5, 6, 0, -4 }, // 0x50 'P' 79 | { 151, 5, 5, 6, 0, -4 }, // 0x51 'Q' 80 | { 155, 5, 5, 6, 0, -4 }, // 0x52 'R' 81 | { 159, 5, 5, 6, 0, -4 }, // 0x53 'S' 82 | { 163, 5, 5, 6, 0, -4 }, // 0x54 'T' 83 | { 167, 5, 5, 6, 0, -4 }, // 0x55 'U' 84 | { 171, 5, 5, 6, 0, -4 }, // 0x56 'V' 85 | { 175, 5, 5, 6, 0, -4 }, // 0x57 'W' 86 | { 179, 5, 5, 6, 0, -4 }, // 0x58 'X' 87 | { 183, 5, 5, 6, 0, -4 }, // 0x59 'Y' 88 | { 187, 5, 5, 6, 0, -4 }, // 0x5A 'Z' 89 | { 191, 2, 5, 3, 0, -4 }, // 0x5B '[' 90 | { 193, 5, 5, 6, 0, -4 }, // 0x5C '\' 91 | { 197, 2, 5, 3, 0, -4 }, // 0x5D ']' 92 | { 199, 3, 2, 4, 0, -4 }, // 0x5E '^' 93 | { 200, 5, 1, 6, 0, 1 }, // 0x5F '_' 94 | { 201, 1, 1, 2, 0, -4 }, // 0x60 '`' 95 | { 202, 4, 4, 5, 0, -3 }, // 0x61 'a' 96 | { 204, 4, 5, 5, 0, -4 }, // 0x62 'b' 97 | { 207, 4, 4, 5, 0, -3 }, // 0x63 'c' 98 | { 209, 4, 5, 5, 0, -4 }, // 0x64 'd' 99 | { 212, 4, 4, 5, 0, -3 }, // 0x65 'e' 100 | { 214, 3, 5, 4, 0, -4 }, // 0x66 'f' 101 | { 216, 4, 5, 5, 0, -3 }, // 0x67 'g' 102 | { 219, 4, 5, 5, 0, -4 }, // 0x68 'h' 103 | { 222, 1, 4, 2, 0, -3 }, // 0x69 'i' 104 | { 223, 2, 5, 3, 0, -3 }, // 0x6A 'j' 105 | { 225, 4, 5, 5, 0, -4 }, // 0x6B 'k' 106 | { 228, 1, 5, 2, 0, -4 }, // 0x6C 'l' 107 | { 229, 5, 4, 6, 0, -3 }, // 0x6D 'm' 108 | { 232, 4, 4, 5, 0, -3 }, // 0x6E 'n' 109 | { 234, 4, 4, 5, 0, -3 }, // 0x6F 'o' 110 | { 236, 4, 5, 5, 0, -3 }, // 0x70 'p' 111 | { 239, 4, 5, 5, 0, -3 }, // 0x71 'q' 112 | { 242, 4, 4, 5, 0, -3 }, // 0x72 'r' 113 | { 244, 4, 4, 5, 0, -3 }, // 0x73 's' 114 | { 246, 5, 5, 6, 0, -4 }, // 0x74 't' 115 | { 250, 4, 4, 5, 0, -3 }, // 0x75 'u' 116 | { 252, 4, 4, 5, 0, -3 }, // 0x76 'v' 117 | { 254, 5, 4, 6, 0, -3 }, // 0x77 'w' 118 | { 257, 4, 4, 5, 0, -3 }, // 0x78 'x' 119 | { 259, 4, 5, 5, 0, -3 }, // 0x79 'y' 120 | { 262, 4, 4, 5, 0, -3 }, // 0x7A 'z' 121 | { 264, 3, 5, 4, 0, -4 }, // 0x7B '{' 122 | { 266, 1, 5, 2, 0, -4 }, // 0x7C '|' 123 | { 267, 3, 5, 4, 0, -4 }, // 0x7D '}' 124 | { 269, 5, 3, 6, 0, -3 } }; // 0x7E '~' 125 | 126 | const GFXfont Org_01 PROGMEM = { 127 | (uint8_t *)Org_01Bitmaps, 128 | (GFXglyph *)Org_01Glyphs, 129 | 0x20, 0x7E, 7 }; 130 | 131 | // Approx. 943 bytes 132 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Fonts/Picopixel.h: -------------------------------------------------------------------------------- 1 | // Picopixel by Sebastian Weber. A tiny font 2 | // with all characters within a 6 pixel height. 3 | 4 | const uint8_t PicopixelBitmaps[] PROGMEM = { 5 | 0xE8, 0xB4, 0x57, 0xD5, 0xF5, 0x00, 0x4E, 0x3E, 0x80, 0xA5, 0x4A, 0x4A, 6 | 0x5A, 0x50, 0xC0, 0x6A, 0x40, 0x95, 0x80, 0xAA, 0x80, 0x5D, 0x00, 0x60, 7 | 0xE0, 0x80, 0x25, 0x48, 0x56, 0xD4, 0x75, 0x40, 0xC5, 0x4E, 0xC5, 0x1C, 8 | 0x97, 0x92, 0xF3, 0x1C, 0x53, 0x54, 0xE5, 0x48, 0x55, 0x54, 0x55, 0x94, 9 | 0xA0, 0x46, 0x64, 0xE3, 0x80, 0x98, 0xC5, 0x04, 0x56, 0xC6, 0x57, 0xDA, 10 | 0xD7, 0x5C, 0x72, 0x46, 0xD6, 0xDC, 0xF3, 0xCE, 0xF3, 0x48, 0x72, 0xD4, 11 | 0xB7, 0xDA, 0xF8, 0x24, 0xD4, 0xBB, 0x5A, 0x92, 0x4E, 0x8E, 0xEB, 0x58, 12 | 0x80, 0x9D, 0xB9, 0x90, 0x56, 0xD4, 0xD7, 0x48, 0x56, 0xD4, 0x40, 0xD7, 13 | 0x5A, 0x71, 0x1C, 0xE9, 0x24, 0xB6, 0xD4, 0xB6, 0xA4, 0x8C, 0x6B, 0x55, 14 | 0x00, 0xB5, 0x5A, 0xB5, 0x24, 0xE5, 0x4E, 0xEA, 0xC0, 0x91, 0x12, 0xD5, 15 | 0xC0, 0x54, 0xF0, 0x90, 0xC7, 0xF0, 0x93, 0x5E, 0x71, 0x80, 0x25, 0xDE, 16 | 0x5E, 0x30, 0x6E, 0x80, 0x77, 0x9C, 0x93, 0x5A, 0xB8, 0x45, 0x60, 0x92, 17 | 0xEA, 0xAA, 0x40, 0xD5, 0x6A, 0xD6, 0x80, 0x55, 0x00, 0xD7, 0x40, 0x75, 18 | 0x90, 0xE8, 0x71, 0xE0, 0xBA, 0x40, 0xB5, 0x80, 0xB5, 0x00, 0x8D, 0x54, 19 | 0xAA, 0x80, 0xAC, 0xE0, 0xE5, 0x70, 0x6A, 0x26, 0xFC, 0xC8, 0xAC, 0x5A }; 20 | 21 | const GFXglyph PicopixelGlyphs[] PROGMEM = { 22 | { 0, 0, 0, 2, 0, 1 }, // 0x20 ' ' 23 | { 0, 1, 5, 2, 0, -4 }, // 0x21 '!' 24 | { 1, 3, 2, 4, 0, -4 }, // 0x22 '"' 25 | { 2, 5, 5, 6, 0, -4 }, // 0x23 '#' 26 | { 6, 3, 6, 4, 0, -4 }, // 0x24 '$' 27 | { 9, 3, 5, 4, 0, -4 }, // 0x25 '%' 28 | { 11, 4, 5, 5, 0, -4 }, // 0x26 '&' 29 | { 14, 1, 2, 2, 0, -4 }, // 0x27 ''' 30 | { 15, 2, 5, 3, 0, -4 }, // 0x28 '(' 31 | { 17, 2, 5, 3, 0, -4 }, // 0x29 ')' 32 | { 19, 3, 3, 4, 0, -3 }, // 0x2A '*' 33 | { 21, 3, 3, 4, 0, -3 }, // 0x2B '+' 34 | { 23, 2, 2, 3, 0, 0 }, // 0x2C ',' 35 | { 24, 3, 1, 4, 0, -2 }, // 0x2D '-' 36 | { 25, 1, 1, 2, 0, 0 }, // 0x2E '.' 37 | { 26, 3, 5, 4, 0, -4 }, // 0x2F '/' 38 | { 28, 3, 5, 4, 0, -4 }, // 0x30 '0' 39 | { 30, 2, 5, 3, 0, -4 }, // 0x31 '1' 40 | { 32, 3, 5, 4, 0, -4 }, // 0x32 '2' 41 | { 34, 3, 5, 4, 0, -4 }, // 0x33 '3' 42 | { 36, 3, 5, 4, 0, -4 }, // 0x34 '4' 43 | { 38, 3, 5, 4, 0, -4 }, // 0x35 '5' 44 | { 40, 3, 5, 4, 0, -4 }, // 0x36 '6' 45 | { 42, 3, 5, 4, 0, -4 }, // 0x37 '7' 46 | { 44, 3, 5, 4, 0, -4 }, // 0x38 '8' 47 | { 46, 3, 5, 4, 0, -4 }, // 0x39 '9' 48 | { 48, 1, 3, 2, 0, -3 }, // 0x3A ':' 49 | { 49, 2, 4, 3, 0, -3 }, // 0x3B ';' 50 | { 50, 2, 3, 3, 0, -3 }, // 0x3C '<' 51 | { 51, 3, 3, 4, 0, -3 }, // 0x3D '=' 52 | { 53, 2, 3, 3, 0, -3 }, // 0x3E '>' 53 | { 54, 3, 5, 4, 0, -4 }, // 0x3F '?' 54 | { 56, 3, 5, 4, 0, -4 }, // 0x40 '@' 55 | { 58, 3, 5, 4, 0, -4 }, // 0x41 'A' 56 | { 60, 3, 5, 4, 0, -4 }, // 0x42 'B' 57 | { 62, 3, 5, 4, 0, -4 }, // 0x43 'C' 58 | { 64, 3, 5, 4, 0, -4 }, // 0x44 'D' 59 | { 66, 3, 5, 4, 0, -4 }, // 0x45 'E' 60 | { 68, 3, 5, 4, 0, -4 }, // 0x46 'F' 61 | { 70, 3, 5, 4, 0, -4 }, // 0x47 'G' 62 | { 72, 3, 5, 4, 0, -4 }, // 0x48 'H' 63 | { 74, 1, 5, 2, 0, -4 }, // 0x49 'I' 64 | { 75, 3, 5, 4, 0, -4 }, // 0x4A 'J' 65 | { 77, 3, 5, 4, 0, -4 }, // 0x4B 'K' 66 | { 79, 3, 5, 4, 0, -4 }, // 0x4C 'L' 67 | { 81, 5, 5, 6, 0, -4 }, // 0x4D 'M' 68 | { 85, 4, 5, 5, 0, -4 }, // 0x4E 'N' 69 | { 88, 3, 5, 4, 0, -4 }, // 0x4F 'O' 70 | { 90, 3, 5, 4, 0, -4 }, // 0x50 'P' 71 | { 92, 3, 6, 4, 0, -4 }, // 0x51 'Q' 72 | { 95, 3, 5, 4, 0, -4 }, // 0x52 'R' 73 | { 97, 3, 5, 4, 0, -4 }, // 0x53 'S' 74 | { 99, 3, 5, 4, 0, -4 }, // 0x54 'T' 75 | { 101, 3, 5, 4, 0, -4 }, // 0x55 'U' 76 | { 103, 3, 5, 4, 0, -4 }, // 0x56 'V' 77 | { 105, 5, 5, 6, 0, -4 }, // 0x57 'W' 78 | { 109, 3, 5, 4, 0, -4 }, // 0x58 'X' 79 | { 111, 3, 5, 4, 0, -4 }, // 0x59 'Y' 80 | { 113, 3, 5, 4, 0, -4 }, // 0x5A 'Z' 81 | { 115, 2, 5, 3, 0, -4 }, // 0x5B '[' 82 | { 117, 3, 5, 4, 0, -4 }, // 0x5C '\' 83 | { 119, 2, 5, 3, 0, -4 }, // 0x5D ']' 84 | { 121, 3, 2, 4, 0, -4 }, // 0x5E '^' 85 | { 122, 4, 1, 4, 0, 1 }, // 0x5F '_' 86 | { 123, 2, 2, 3, 0, -4 }, // 0x60 '`' 87 | { 124, 3, 4, 4, 0, -3 }, // 0x61 'a' 88 | { 126, 3, 5, 4, 0, -4 }, // 0x62 'b' 89 | { 128, 3, 3, 4, 0, -2 }, // 0x63 'c' 90 | { 130, 3, 5, 4, 0, -4 }, // 0x64 'd' 91 | { 132, 3, 4, 4, 0, -3 }, // 0x65 'e' 92 | { 134, 2, 5, 3, 0, -4 }, // 0x66 'f' 93 | { 136, 3, 5, 4, 0, -3 }, // 0x67 'g' 94 | { 138, 3, 5, 4, 0, -4 }, // 0x68 'h' 95 | { 140, 1, 5, 2, 0, -4 }, // 0x69 'i' 96 | { 141, 2, 6, 3, 0, -4 }, // 0x6A 'j' 97 | { 143, 3, 5, 4, 0, -4 }, // 0x6B 'k' 98 | { 145, 2, 5, 3, 0, -4 }, // 0x6C 'l' 99 | { 147, 5, 3, 6, 0, -2 }, // 0x6D 'm' 100 | { 149, 3, 3, 4, 0, -2 }, // 0x6E 'n' 101 | { 151, 3, 3, 4, 0, -2 }, // 0x6F 'o' 102 | { 153, 3, 4, 4, 0, -2 }, // 0x70 'p' 103 | { 155, 3, 4, 4, 0, -2 }, // 0x71 'q' 104 | { 157, 2, 3, 3, 0, -2 }, // 0x72 'r' 105 | { 158, 3, 4, 4, 0, -3 }, // 0x73 's' 106 | { 160, 2, 5, 3, 0, -4 }, // 0x74 't' 107 | { 162, 3, 3, 4, 0, -2 }, // 0x75 'u' 108 | { 164, 3, 3, 4, 0, -2 }, // 0x76 'v' 109 | { 166, 5, 3, 6, 0, -2 }, // 0x77 'w' 110 | { 168, 3, 3, 4, 0, -2 }, // 0x78 'x' 111 | { 170, 3, 4, 4, 0, -2 }, // 0x79 'y' 112 | { 172, 3, 4, 4, 0, -3 }, // 0x7A 'z' 113 | { 174, 3, 5, 4, 0, -4 }, // 0x7B '{' 114 | { 176, 1, 6, 2, 0, -4 }, // 0x7C '|' 115 | { 177, 3, 5, 4, 0, -4 }, // 0x7D '}' 116 | { 179, 4, 2, 5, 0, -3 } }; // 0x7E '~' 117 | 118 | const GFXfont Picopixel PROGMEM = { 119 | (uint8_t *)PicopixelBitmaps, 120 | (GFXglyph *)PicopixelGlyphs, 121 | 0x20, 0x7E, 7 }; 122 | 123 | // Approx. 852 bytes 124 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/Fonts/Tiny3x3a2pt7b: -------------------------------------------------------------------------------- 1 | /** 2 | ** The FontStruction “Tiny3x3a” 3 | ** (https://fontstruct.com/fontstructions/show/670512) by “Michaelangel007” is 4 | ** licensed under a Creative Commons Attribution Non-commercial Share Alike license 5 | ** (http://creativecommons.org/licenses/by-nc-sa/3.0/). 6 | ** “Tiny3x3a” was originally cloned (copied) from the FontStruction 7 | ** “CHECKER” (https://fontstruct.com/fontstructions/show/2391) by Wolf grant 8 | ** Grant, which is licensed under a Creative Commons Attribution Non-commercial 9 | ** Share Alike license (http://creativecommons.org/licenses/by-nc-sa/3.0/). 10 | * 11 | * Converted by eadmaster with fontconvert 12 | **/ 13 | 14 | const uint8_t Tiny3x3a2pt7bBitmaps[] PROGMEM = { 15 | 0xC0, 0xB4, 0xBF, 0x80, 0x6B, 0x00, 0xDD, 0x80, 0x59, 0x80, 0x80, 0x64, 16 | 0x98, 0xF0, 0x5D, 0x00, 0xC0, 0xE0, 0x80, 0x2A, 0x00, 0x55, 0x00, 0x94, 17 | 0xC9, 0x80, 0xEF, 0x80, 0xBC, 0x80, 0x6B, 0x00, 0x9F, 0x80, 0xE4, 0x80, 18 | 0x7F, 0x00, 0xFC, 0x80, 0xA0, 0x58, 0x64, 0xE3, 0x80, 0x98, 0xD8, 0xD8, 19 | 0x80, 0x5E, 0x80, 0xDF, 0x80, 0x71, 0x80, 0xD7, 0x00, 0xFB, 0x80, 0xFA, 20 | 0x00, 0xD7, 0x80, 0xBE, 0x80, 0xE0, 0x27, 0x00, 0xBA, 0x80, 0x93, 0x80, 21 | 0xFE, 0x80, 0xF6, 0x80, 0xF7, 0x80, 0xFE, 0x00, 0xF7, 0x00, 0xDE, 0x80, 22 | 0x6B, 0x00, 0xE9, 0x00, 0xB7, 0x80, 0xB5, 0x00, 0xBF, 0x80, 0xAA, 0x80, 23 | 0xA9, 0x00, 0xEB, 0x80, 0xEC, 0x88, 0x80, 0xDC, 0x54, 0xE0, 0x90, 0x70, 24 | 0xBC, 0xF0, 0x7C, 0xB0, 0x68, 0xFC, 0xBC, 0xC0, 0x58, 0x9A, 0x80, 0xA4, 25 | 0xDC, 0xD4, 0xF0, 0xF8, 0xF4, 0xE0, 0x60, 0x59, 0x80, 0xBC, 0xA8, 0xEC, 26 | 0xF0, 0xAC, 0x80, 0x90, 0x79, 0x80, 0xF0, 0xCF, 0x00, 0x78 }; 27 | 28 | const GFXglyph Tiny3x3a2pt7bGlyphs[] PROGMEM = { 29 | { 0, 0, 0, 4, 0, 1 }, // 0x20 ' ' 30 | { 0, 1, 2, 3, 1, -2 }, // 0x21 '!' 31 | { 1, 3, 2, 4, 0, -2 }, // 0x22 '"' 32 | { 2, 3, 3, 4, 0, -2 }, // 0x23 '#' 33 | { 4, 3, 3, 4, 0, -2 }, // 0x24 '$' 34 | { 6, 3, 3, 4, 0, -2 }, // 0x25 '%' 35 | { 8, 3, 3, 4, 0, -2 }, // 0x26 '&' 36 | { 10, 1, 1, 3, 1, -2 }, // 0x27 ''' 37 | { 11, 2, 3, 3, 0, -2 }, // 0x28 '(' 38 | { 12, 2, 3, 4, 1, -2 }, // 0x29 ')' 39 | { 13, 2, 2, 4, 1, -2 }, // 0x2A '*' 40 | { 14, 3, 3, 4, 0, -2 }, // 0x2B '+' 41 | { 16, 1, 2, 2, 0, 0 }, // 0x2C ',' 42 | { 17, 3, 1, 4, 0, -1 }, // 0x2D '-' 43 | { 18, 1, 1, 2, 0, 0 }, // 0x2E '.' 44 | { 19, 3, 3, 4, 0, -2 }, // 0x2F '/' 45 | { 21, 3, 3, 4, 0, -2 }, // 0x30 '0' 46 | { 23, 2, 3, 3, 0, -2 }, // 0x31 '1' 47 | { 24, 3, 3, 4, 0, -2 }, // 0x32 '2' 48 | { 26, 3, 3, 4, 0, -2 }, // 0x33 '3' 49 | { 28, 3, 3, 4, 0, -2 }, // 0x34 '4' 50 | { 30, 3, 3, 4, 0, -2 }, // 0x35 '5' 51 | { 32, 3, 3, 4, 0, -2 }, // 0x36 '6' 52 | { 34, 3, 3, 4, 0, -2 }, // 0x37 '7' 53 | { 36, 3, 3, 4, 0, -2 }, // 0x38 '8' 54 | { 38, 3, 3, 4, 0, -2 }, // 0x39 '9' 55 | { 40, 1, 3, 3, 1, -2 }, // 0x3A ':' 56 | { 41, 2, 3, 3, 0, -1 }, // 0x3B ';' 57 | { 42, 2, 3, 3, 0, -2 }, // 0x3C '<' 58 | { 43, 3, 3, 4, 0, -2 }, // 0x3D '=' 59 | { 45, 2, 3, 4, 1, -2 }, // 0x3E '>' 60 | { 46, 2, 3, 4, 1, -2 }, // 0x3F '?' 61 | { 47, 3, 3, 4, 0, -2 }, // 0x40 '@' 62 | { 49, 3, 3, 4, 0, -2 }, // 0x41 'A' 63 | { 51, 3, 3, 4, 0, -2 }, // 0x42 'B' 64 | { 53, 3, 3, 4, 0, -2 }, // 0x43 'C' 65 | { 55, 3, 3, 4, 0, -2 }, // 0x44 'D' 66 | { 57, 3, 3, 4, 0, -2 }, // 0x45 'E' 67 | { 59, 3, 3, 4, 0, -2 }, // 0x46 'F' 68 | { 61, 3, 3, 4, 0, -2 }, // 0x47 'G' 69 | { 63, 3, 3, 4, 0, -2 }, // 0x48 'H' 70 | { 65, 1, 3, 3, 1, -2 }, // 0x49 'I' 71 | { 66, 3, 3, 4, 0, -2 }, // 0x4A 'J' 72 | { 68, 3, 3, 4, 0, -2 }, // 0x4B 'K' 73 | { 70, 3, 3, 4, 0, -2 }, // 0x4C 'L' 74 | { 72, 3, 3, 4, 0, -2 }, // 0x4D 'M' 75 | { 74, 3, 3, 4, 0, -2 }, // 0x4E 'N' 76 | { 76, 3, 3, 4, 0, -2 }, // 0x4F 'O' 77 | { 78, 3, 3, 4, 0, -2 }, // 0x50 'P' 78 | { 80, 3, 3, 4, 0, -2 }, // 0x51 'Q' 79 | { 82, 3, 3, 4, 0, -2 }, // 0x52 'R' 80 | { 84, 3, 3, 4, 0, -2 }, // 0x53 'S' 81 | { 86, 3, 3, 4, 0, -2 }, // 0x54 'T' 82 | { 88, 3, 3, 4, 0, -2 }, // 0x55 'U' 83 | { 90, 3, 3, 4, 0, -2 }, // 0x56 'V' 84 | { 92, 3, 3, 4, 0, -2 }, // 0x57 'W' 85 | { 94, 3, 3, 4, 0, -2 }, // 0x58 'X' 86 | { 96, 3, 3, 4, 0, -2 }, // 0x59 'Y' 87 | { 98, 3, 3, 4, 0, -2 }, // 0x5A 'Z' 88 | { 100, 2, 3, 3, 0, -2 }, // 0x5B '[' 89 | { 101, 3, 3, 4, 0, -2 }, // 0x5C '\' 90 | { 103, 2, 3, 4, 1, -2 }, // 0x5D ']' 91 | { 104, 3, 2, 4, 0, -2 }, // 0x5E '^' 92 | { 105, 3, 1, 4, 0, 0 }, // 0x5F '_' 93 | { 106, 2, 2, 3, 0, -2 }, // 0x60 '`' 94 | { 107, 2, 2, 3, 0, -1 }, // 0x61 'a' 95 | { 108, 2, 3, 3, 0, -2 }, // 0x62 'b' 96 | { 109, 2, 2, 3, 0, -1 }, // 0x63 'c' 97 | { 110, 2, 3, 3, 0, -2 }, // 0x64 'd' 98 | { 111, 2, 2, 3, 0, -1 }, // 0x65 'e' 99 | { 112, 2, 3, 3, 0, -2 }, // 0x66 'f' 100 | { 113, 2, 3, 3, 0, -1 }, // 0x67 'g' 101 | { 114, 2, 3, 3, 0, -2 }, // 0x68 'h' 102 | { 115, 1, 2, 2, 0, -1 }, // 0x69 'i' 103 | { 116, 2, 3, 3, 0, -1 }, // 0x6A 'j' 104 | { 117, 3, 3, 4, 0, -2 }, // 0x6B 'k' 105 | { 119, 2, 3, 3, 0, -2 }, // 0x6C 'l' 106 | { 120, 3, 2, 4, 0, -1 }, // 0x6D 'm' 107 | { 121, 3, 2, 4, 0, -1 }, // 0x6E 'n' 108 | { 122, 2, 2, 3, 0, -1 }, // 0x6F 'o' 109 | { 123, 2, 3, 3, 0, -1 }, // 0x70 'p' 110 | { 124, 2, 3, 3, 0, -1 }, // 0x71 'q' 111 | { 125, 2, 2, 3, 0, -1 }, // 0x72 'r' 112 | { 126, 2, 2, 3, 0, -1 }, // 0x73 's' 113 | { 127, 3, 3, 4, 0, -2 }, // 0x74 't' 114 | { 129, 3, 2, 4, 0, -1 }, // 0x75 'u' 115 | { 130, 3, 2, 4, 0, -1 }, // 0x76 'v' 116 | { 131, 3, 2, 4, 0, -1 }, // 0x77 'w' 117 | { 132, 2, 2, 3, 0, -1 }, // 0x78 'x' 118 | { 133, 3, 3, 4, 0, -1 }, // 0x79 'y' 119 | { 135, 2, 2, 3, 0, -1 }, // 0x7A 'z' 120 | { 136, 3, 3, 4, 0, -2 }, // 0x7B '{' 121 | { 138, 1, 4, 3, 1, -2 }, // 0x7C '|' 122 | { 139, 3, 3, 4, 0, -2 }, // 0x7D '}' 123 | { 141, 3, 2, 4, 0, -2 } }; // 0x7E '~' 124 | 125 | const GFXfont Tiny3x3a2pt7b PROGMEM = { 126 | (uint8_t *)Tiny3x3a2pt7bBitmaps, 127 | (GFXglyph *)Tiny3x3a2pt7bGlyphs, 128 | 0x20, 0x7E, 4 }; 129 | 130 | // Approx. 814 bytes 131 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/README.md: -------------------------------------------------------------------------------- 1 | # Adafruit GFX Library # [![Build Status](https://travis-ci.org/adafruit/Adafruit_GFX.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_GFX) 2 | 3 | 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). 4 | 5 | Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! 6 | 7 | Written by Limor Fried/Ladyada for Adafruit Industries. 8 | BSD license, check license.txt for more information. 9 | All text above must be included in any redistribution. 10 | 11 | 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. 12 | 13 | # Useful Resources 14 | 15 | - 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 16 | 17 | - 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 18 | 19 | - '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. 20 | 21 | - 'fontconvert' folder contains a command-line tool for converting TTF fonts to Adafruit_GFX header format. 22 | 23 | --- 24 | 25 | ### Roadmap 26 | 27 | The PRIME DIRECTIVE is to maintain backward compatibility with existing Arduino sketches -- many are hosted elsewhere and don't track changes here, some are in print and can never be changed! This "little" library has grown organically over time and sometimes we paint ourselves into a design corner and just have to live with it or add ungainly workarounds. 28 | 29 | Highly unlikely to merge any changes for additional or incompatible font formats (see Prime Directive above). There are already two formats and the code is quite bloaty there as it is (this also creates liabilities for tools and documentation). If you *must* have a more sophisticated font format, consider creating a fork with the features required for your project. For similar reasons, also unlikely to add any more bitmap formats, it's getting messy. 30 | 31 | Please don't reformat code for the sake of reformatting code. The resulting large "visual diff" makes it impossible to untangle actual bug fixes from merely rearranged lines. 32 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/examples/mock_ili9341/mock_ili9341.ino: -------------------------------------------------------------------------------- 1 | /*************************************************** 2 | This is our GFX example for the Adafruit ILI9341 Breakout and Shield 3 | ----> http://www.adafruit.com/products/1651 4 | 5 | Check out the links above for our tutorials and wiring diagrams 6 | These displays use SPI to communicate, 4 or 5 pins are required to 7 | interface (RST is optional) 8 | Adafruit invests time and resources providing this open source code, 9 | please support Adafruit and open-source hardware by purchasing 10 | products from Adafruit! 11 | 12 | Written by Limor Fried/Ladyada for Adafruit Industries. 13 | MIT license, all text above must be included in any redistribution 14 | ****************************************************/ 15 | 16 | 17 | #include "SPI.h" 18 | #include "Adafruit_GFX.h" 19 | #include "Adafruit_ILI9341.h" 20 | 21 | // For the Adafruit shield, these are the default. 22 | #define TFT_DC 9 23 | #define TFT_CS 10 24 | 25 | // Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC 26 | Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); 27 | // If using the breakout, change pins as desired 28 | //Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO); 29 | 30 | void setup() { 31 | Serial.begin(9600); 32 | Serial.println("ILI9341 Test!"); 33 | 34 | tft.begin(); 35 | 36 | // read diagnostics (optional but can help debug problems) 37 | uint8_t x = tft.readcommand8(ILI9341_RDMODE); 38 | Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX); 39 | x = tft.readcommand8(ILI9341_RDMADCTL); 40 | Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX); 41 | x = tft.readcommand8(ILI9341_RDPIXFMT); 42 | Serial.print("Pixel Format: 0x"); Serial.println(x, HEX); 43 | x = tft.readcommand8(ILI9341_RDIMGFMT); 44 | Serial.print("Image Format: 0x"); Serial.println(x, HEX); 45 | x = tft.readcommand8(ILI9341_RDSELFDIAG); 46 | Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 47 | 48 | Serial.println(F("Benchmark Time (microseconds)")); 49 | delay(10); 50 | Serial.print(F("Screen fill ")); 51 | Serial.println(testFillScreen()); 52 | delay(500); 53 | 54 | Serial.print(F("Text ")); 55 | Serial.println(testText()); 56 | delay(3000); 57 | 58 | Serial.print(F("Lines ")); 59 | Serial.println(testLines(ILI9341_CYAN)); 60 | delay(500); 61 | 62 | Serial.print(F("Horiz/Vert Lines ")); 63 | Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE)); 64 | delay(500); 65 | 66 | Serial.print(F("Rectangles (outline) ")); 67 | Serial.println(testRects(ILI9341_GREEN)); 68 | delay(500); 69 | 70 | Serial.print(F("Rectangles (filled) ")); 71 | Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA)); 72 | delay(500); 73 | 74 | Serial.print(F("Circles (filled) ")); 75 | Serial.println(testFilledCircles(10, ILI9341_MAGENTA)); 76 | 77 | Serial.print(F("Circles (outline) ")); 78 | Serial.println(testCircles(10, ILI9341_WHITE)); 79 | delay(500); 80 | 81 | Serial.print(F("Triangles (outline) ")); 82 | Serial.println(testTriangles()); 83 | delay(500); 84 | 85 | Serial.print(F("Triangles (filled) ")); 86 | Serial.println(testFilledTriangles()); 87 | delay(500); 88 | 89 | Serial.print(F("Rounded rects (outline) ")); 90 | Serial.println(testRoundRects()); 91 | delay(500); 92 | 93 | Serial.print(F("Rounded rects (filled) ")); 94 | Serial.println(testFilledRoundRects()); 95 | delay(500); 96 | 97 | Serial.println(F("Done!")); 98 | 99 | } 100 | 101 | 102 | void loop(void) { 103 | for(uint8_t rotation=0; rotation<4; rotation++) { 104 | tft.setRotation(rotation); 105 | testText(); 106 | delay(1000); 107 | } 108 | } 109 | 110 | unsigned long testFillScreen() { 111 | unsigned long start = micros(); 112 | tft.fillScreen(ILI9341_BLACK); 113 | yield(); 114 | tft.fillScreen(ILI9341_RED); 115 | yield(); 116 | tft.fillScreen(ILI9341_GREEN); 117 | yield(); 118 | tft.fillScreen(ILI9341_BLUE); 119 | yield(); 120 | tft.fillScreen(ILI9341_BLACK); 121 | yield(); 122 | return micros() - start; 123 | } 124 | 125 | unsigned long testText() { 126 | tft.fillScreen(ILI9341_BLACK); 127 | unsigned long start = micros(); 128 | tft.setCursor(0, 0); 129 | tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1); 130 | tft.println("Hello World!"); 131 | tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2); 132 | tft.println(1234.56); 133 | tft.setTextColor(ILI9341_RED); tft.setTextSize(3); 134 | tft.println(0xDEADBEEF, HEX); 135 | tft.println(); 136 | tft.setTextColor(ILI9341_GREEN); 137 | tft.setTextSize(5); 138 | tft.println("Groop"); 139 | tft.setTextSize(2); 140 | tft.println("I implore thee,"); 141 | tft.setTextSize(1); 142 | tft.println("my foonting turlingdromes."); 143 | tft.println("And hooptiously drangle me"); 144 | tft.println("with crinkly bindlewurdles,"); 145 | tft.println("Or I will rend thee"); 146 | tft.println("in the gobberwarts"); 147 | tft.println("with my blurglecruncheon,"); 148 | tft.println("see if I don't!"); 149 | return micros() - start; 150 | } 151 | 152 | unsigned long testLines(uint16_t color) { 153 | unsigned long start, t; 154 | int x1, y1, x2, y2, 155 | w = tft.width(), 156 | h = tft.height(); 157 | 158 | tft.fillScreen(ILI9341_BLACK); 159 | yield(); 160 | 161 | x1 = y1 = 0; 162 | y2 = h - 1; 163 | start = micros(); 164 | for(x2=0; x20; i-=6) { 249 | i2 = i / 2; 250 | start = micros(); 251 | tft.fillRect(cx-i2, cy-i2, i, i, color1); 252 | t += micros() - start; 253 | // Outlines are not included in timing results 254 | tft.drawRect(cx-i2, cy-i2, i, i, color2); 255 | yield(); 256 | } 257 | 258 | return t; 259 | } 260 | 261 | unsigned long testFilledCircles(uint8_t radius, uint16_t color) { 262 | unsigned long start; 263 | int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2; 264 | 265 | tft.fillScreen(ILI9341_BLACK); 266 | start = micros(); 267 | for(x=radius; x10; i-=5) { 321 | start = micros(); 322 | tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 323 | tft.color565(0, i*10, i*10)); 324 | t += micros() - start; 325 | tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 326 | tft.color565(i*10, i*10, 0)); 327 | yield(); 328 | } 329 | 330 | return t; 331 | } 332 | 333 | unsigned long testRoundRects() { 334 | unsigned long start; 335 | int w, i, i2, 336 | cx = tft.width() / 2 - 1, 337 | cy = tft.height() / 2 - 1; 338 | 339 | tft.fillScreen(ILI9341_BLACK); 340 | w = min(tft.width(), tft.height()); 341 | start = micros(); 342 | for(i=0; i20; i-=6) { 359 | i2 = i / 2; 360 | tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0)); 361 | yield(); 362 | } 363 | 364 | return micros() - start; 365 | } -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/fontconvert/Makefile: -------------------------------------------------------------------------------- 1 | all: fontconvert 2 | 3 | CC = gcc 4 | CFLAGS = -Wall -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I/usr/include 5 | LIBS = -lfreetype 6 | 7 | fontconvert: fontconvert.c 8 | $(CC) $(CFLAGS) $< $(LIBS) -o $@ 9 | strip $@ 10 | 11 | clean: 12 | rm -f fontconvert 13 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/fontconvert/fontconvert.c: -------------------------------------------------------------------------------- 1 | /* 2 | TrueType to Adafruit_GFX font converter. Derived from Peter Jakobs' 3 | Adafruit_ftGFX fork & makefont tool, and Paul Kourany's Adafruit_mfGFX. 4 | 5 | NOT AN ARDUINO SKETCH. This is a command-line tool for preprocessing 6 | fonts to be used with the Adafruit_GFX Arduino library. 7 | 8 | For UNIX-like systems. Outputs to stdout; redirect to header file, e.g.: 9 | ./fontconvert ~/Library/Fonts/FreeSans.ttf 18 > FreeSans18pt7b.h 10 | 11 | REQUIRES FREETYPE LIBRARY. www.freetype.org 12 | 13 | Currently this only extracts the printable 7-bit ASCII chars of a font. 14 | Will eventually extend with some int'l chars a la ftGFX, not there yet. 15 | Keep 7-bit fonts around as an option in that case, more compact. 16 | 17 | See notes at end for glyph nomenclature & other tidbits. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include FT_GLYPH_H 25 | #include "../gfxfont.h" // Adafruit_GFX font structures 26 | 27 | #define DPI 141 // Approximate res. of Adafruit 2.8" TFT 28 | 29 | // Accumulate bits for output, with periodic hexadecimal byte write 30 | void enbit(uint8_t value) { 31 | static uint8_t row = 0, sum = 0, bit = 0x80, firstCall = 1; 32 | if(value) sum |= bit; // Set bit if needed 33 | if(!(bit >>= 1)) { // Advance to next bit, end of byte reached? 34 | if(!firstCall) { // Format output table nicely 35 | if(++row >= 12) { // Last entry on line? 36 | printf(",\n "); // Newline format output 37 | row = 0; // Reset row counter 38 | } else { // Not end of line 39 | printf(", "); // Simple comma delim 40 | } 41 | } 42 | printf("0x%02X", sum); // Write byte value 43 | sum = 0; // Clear for next byte 44 | bit = 0x80; // Reset bit counter 45 | firstCall = 0; // Formatting flag 46 | } 47 | } 48 | 49 | int main(int argc, char *argv[]) { 50 | int i, j, err, size, first=' ', last='~', 51 | bitmapOffset = 0, x, y, byte; 52 | char *fontName, c, *ptr; 53 | FT_Library library; 54 | FT_Face face; 55 | FT_Glyph glyph; 56 | FT_Bitmap *bitmap; 57 | FT_BitmapGlyphRec *g; 58 | GFXglyph *table; 59 | uint8_t bit; 60 | 61 | // Parse command line. Valid syntaxes are: 62 | // fontconvert [filename] [size] 63 | // fontconvert [filename] [size] [last char] 64 | // fontconvert [filename] [size] [first char] [last char] 65 | // Unless overridden, default first and last chars are 66 | // ' ' (space) and '~', respectively 67 | 68 | if(argc < 3) { 69 | fprintf(stderr, "Usage: %s fontfile size [first] [last]\n", 70 | argv[0]); 71 | return 1; 72 | } 73 | 74 | size = atoi(argv[2]); 75 | 76 | if(argc == 4) { 77 | last = atoi(argv[3]); 78 | } else if(argc == 5) { 79 | first = atoi(argv[3]); 80 | last = atoi(argv[4]); 81 | } 82 | 83 | if(last < first) { 84 | i = first; 85 | first = last; 86 | last = i; 87 | } 88 | 89 | ptr = strrchr(argv[1], '/'); // Find last slash in filename 90 | if(ptr) ptr++; // First character of filename (path stripped) 91 | else ptr = argv[1]; // No path; font in local dir. 92 | 93 | // Allocate space for font name and glyph table 94 | if((!(fontName = malloc(strlen(ptr) + 20))) || 95 | (!(table = (GFXglyph *)malloc((last - first + 1) * 96 | sizeof(GFXglyph))))) { 97 | fprintf(stderr, "Malloc error\n"); 98 | return 1; 99 | } 100 | 101 | // Derive font table names from filename. Period (filename 102 | // extension) is truncated and replaced with the font size & bits. 103 | strcpy(fontName, ptr); 104 | ptr = strrchr(fontName, '.'); // Find last period (file ext) 105 | if(!ptr) ptr = &fontName[strlen(fontName)]; // If none, append 106 | // Insert font size and 7/8 bit. fontName was alloc'd w/extra 107 | // space to allow this, we're not sprintfing into Forbidden Zone. 108 | sprintf(ptr, "%dpt%db", size, (last > 127) ? 8 : 7); 109 | // Space and punctuation chars in name replaced w/ underscores. 110 | for(i=0; (c=fontName[i]); i++) { 111 | if(isspace(c) || ispunct(c)) fontName[i] = '_'; 112 | } 113 | 114 | // Init FreeType lib, load font 115 | if((err = FT_Init_FreeType(&library))) { 116 | fprintf(stderr, "FreeType init error: %d", err); 117 | return err; 118 | } 119 | if((err = FT_New_Face(library, argv[1], 0, &face))) { 120 | fprintf(stderr, "Font load error: %d", err); 121 | FT_Done_FreeType(library); 122 | return err; 123 | } 124 | 125 | // << 6 because '26dot6' fixed-point format 126 | FT_Set_Char_Size(face, size << 6, 0, DPI, 0); 127 | 128 | // Currently all symbols from 'first' to 'last' are processed. 129 | // Fonts may contain WAY more glyphs than that, but this code 130 | // will need to handle encoding stuff to deal with extracting 131 | // the right symbols, and that's not done yet. 132 | // fprintf(stderr, "%ld glyphs\n", face->num_glyphs); 133 | 134 | printf("const uint8_t %sBitmaps[] PROGMEM = {\n ", fontName); 135 | 136 | // Process glyphs and output huge bitmap data array 137 | for(i=first, j=0; i<=last; i++, j++) { 138 | // MONO renderer provides clean image with perfect crop 139 | // (no wasted pixels) via bitmap struct. 140 | if((err = FT_Load_Char(face, i, FT_LOAD_TARGET_MONO))) { 141 | fprintf(stderr, "Error %d loading char '%c'\n", 142 | err, i); 143 | continue; 144 | } 145 | 146 | if((err = FT_Render_Glyph(face->glyph, 147 | FT_RENDER_MODE_MONO))) { 148 | fprintf(stderr, "Error %d rendering char '%c'\n", 149 | err, i); 150 | continue; 151 | } 152 | 153 | if((err = FT_Get_Glyph(face->glyph, &glyph))) { 154 | fprintf(stderr, "Error %d getting glyph '%c'\n", 155 | err, i); 156 | continue; 157 | } 158 | 159 | bitmap = &face->glyph->bitmap; 160 | g = (FT_BitmapGlyphRec *)glyph; 161 | 162 | // Minimal font and per-glyph information is stored to 163 | // reduce flash space requirements. Glyph bitmaps are 164 | // fully bit-packed; no per-scanline pad, though end of 165 | // each character may be padded to next byte boundary 166 | // when needed. 16-bit offset means 64K max for bitmaps, 167 | // code currently doesn't check for overflow. (Doesn't 168 | // check that size & offsets are within bounds either for 169 | // that matter...please convert fonts responsibly.) 170 | table[j].bitmapOffset = bitmapOffset; 171 | table[j].width = bitmap->width; 172 | table[j].height = bitmap->rows; 173 | table[j].xAdvance = face->glyph->advance.x >> 6; 174 | table[j].xOffset = g->left; 175 | table[j].yOffset = 1 - g->top; 176 | 177 | for(y=0; y < bitmap->rows; y++) { 178 | for(x=0;x < bitmap->width; x++) { 179 | byte = x / 8; 180 | bit = 0x80 >> (x & 7); 181 | enbit(bitmap->buffer[ 182 | y * bitmap->pitch + byte] & bit); 183 | } 184 | } 185 | 186 | // Pad end of char bitmap to next byte boundary if needed 187 | int n = (bitmap->width * bitmap->rows) & 7; 188 | if(n) { // Pixel count not an even multiple of 8? 189 | n = 8 - n; // # bits to next multiple 190 | while(n--) enbit(0); 191 | } 192 | bitmapOffset += (bitmap->width * bitmap->rows + 7) / 8; 193 | 194 | FT_Done_Glyph(glyph); 195 | } 196 | 197 | printf(" };\n\n"); // End bitmap array 198 | 199 | // Output glyph attributes table (one per character) 200 | printf("const GFXglyph %sGlyphs[] PROGMEM = {\n", fontName); 201 | for(i=first, j=0; i<=last; i++, j++) { 202 | printf(" { %5d, %3d, %3d, %3d, %4d, %4d }", 203 | table[j].bitmapOffset, 204 | table[j].width, 205 | table[j].height, 206 | table[j].xAdvance, 207 | table[j].xOffset, 208 | table[j].yOffset); 209 | if(i < last) { 210 | printf(", // 0x%02X", i); 211 | if((i >= ' ') && (i <= '~')) { 212 | printf(" '%c'", i); 213 | } 214 | putchar('\n'); 215 | } 216 | } 217 | printf(" }; // 0x%02X", last); 218 | if((last >= ' ') && (last <= '~')) printf(" '%c'", last); 219 | printf("\n\n"); 220 | 221 | // Output font structure 222 | printf("const GFXfont %s PROGMEM = {\n", fontName); 223 | printf(" (uint8_t *)%sBitmaps,\n", fontName); 224 | printf(" (GFXglyph *)%sGlyphs,\n", fontName); 225 | if (face->size->metrics.height == 0) { 226 | // No face height info, assume fixed width and get from a glyph. 227 | printf(" 0x%02X, 0x%02X, %d };\n\n", 228 | first, last, table[0].height); 229 | } else { 230 | printf(" 0x%02X, 0x%02X, %ld };\n\n", 231 | first, last, face->size->metrics.height >> 6); 232 | } 233 | printf("// Approx. %d bytes\n", 234 | bitmapOffset + (last - first + 1) * 7 + 7); 235 | // Size estimate is based on AVR struct and pointer sizes; 236 | // actual size may vary. 237 | 238 | FT_Done_FreeType(library); 239 | 240 | return 0; 241 | } 242 | 243 | /* ------------------------------------------------------------------------- 244 | 245 | Character metrics are slightly different from classic GFX & ftGFX. 246 | In classic GFX: cursor position is the upper-left pixel of each 5x7 247 | character; lower extent of most glyphs (except those w/descenders) 248 | is +6 pixels in Y direction. 249 | W/new GFX fonts: cursor position is on baseline, where baseline is 250 | 'inclusive' (containing the bottom-most row of pixels in most symbols, 251 | except those with descenders; ftGFX is one pixel lower). 252 | 253 | Cursor Y will be moved automatically when switching between classic 254 | and new fonts. If you switch fonts, any print() calls will continue 255 | along the same baseline. 256 | 257 | ...........#####.. -- yOffset 258 | ..........######.. 259 | ..........######.. 260 | .........#######.. 261 | ........#########. 262 | * = Cursor pos. ........#########. 263 | .......##########. 264 | ......#####..####. 265 | ......#####..####. 266 | *.#.. .....#####...####. 267 | .#.#. ....############## 268 | #...# ...############### 269 | #...# ...############### 270 | ##### ..#####......##### 271 | #...# .#####.......##### 272 | ====== #...# ====== #*###.........#### ======= Baseline 273 | || xOffset 274 | 275 | glyph->xOffset and yOffset are pixel offsets, in GFX coordinate space 276 | (+Y is down), from the cursor position to the top-left pixel of the 277 | glyph bitmap. i.e. yOffset is typically negative, xOffset is typically 278 | zero but a few glyphs will have other values (even negative xOffsets 279 | sometimes, totally normal). glyph->xAdvance is the distance to move 280 | the cursor on the X axis after drawing the corresponding symbol. 281 | 282 | There's also some changes with regard to 'background' color and new GFX 283 | fonts (classic fonts unchanged). See Adafruit_GFX.cpp for explanation. 284 | */ 285 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/fontconvert/fontconvert_win.md: -------------------------------------------------------------------------------- 1 | ### A short guide to use fontconvert.c to create your own fonts using MinGW. 2 | 3 | #### STEP 1: INSTALL MinGW 4 | 5 | Install MinGW (Minimalist GNU for Windows) from [MinGW.org](http://www.mingw.org/). 6 | Please read carefully the instructions found on [Getting started page](http://www.mingw.org/wiki/Getting_Started). 7 | I suggest installing with the "Graphical User Interface Installer". 8 | To complete your initial installation you should further install some "packages". 9 | For our purpose you should only install the "Basic Setup" packages. 10 | To do that: 11 | 12 | 1. Open the MinGW Installation Manager 13 | 2. From the left panel click "Basic Setup". 14 | 3. On the right panel choose "mingw32-base", "mingw-gcc-g++", "mingw-gcc-objc" and "msys-base" 15 | and click "Mark for installation" 16 | 4. From the Menu click "Installation" and then "Apply changes". In the pop-up window select "Apply". 17 | 18 | 19 | #### STEP 2: INSTALL Freetype Library 20 | 21 | To read about the freetype project visit [freetype.org](https://www.freetype.org/). 22 | To Download the latest version of freetype go to [download page](http://download.savannah.gnu.org/releases/freetype/) 23 | and choose "freetype-2.7.tar.gz" file (or a newer version if available). 24 | To avoid long cd commands later in the command prompt, I suggest you unzip the file in the C:\ directory. 25 | (I also renamed the folder to "ft27") 26 | Before you build the library it's good to read these articles: 27 | * [Using MSYS with MinGW](http://www.mingw.org/wiki/MSYS) 28 | * [Installation and Use of Supplementary Libraries with MinGW](http://www.mingw.org/wiki/LibraryPathHOWTO) 29 | * [Include Path](http://www.mingw.org/wiki/IncludePathHOWTO) 30 | 31 | Inside the unzipped folder there is another folder named "docs". Open it and read the INSTALL.UNIX (using notepad). 32 | Pay attention to paragraph 3 (Build and Install the Library). So, let's begin the installation. 33 | To give the appropriate commands we will use the MSYS command prompt (not cmd.exe of windows) which is UNIX like. 34 | Follow the path C:\MinGW\msys\1.0 and double click "msys.bat". The command prompt environment appears. 35 | Enter "ft27" directory using the cd commands: 36 | ``` 37 | cd /c 38 | cd ft27 39 | ``` 40 | 41 | and then type one by one the commands: 42 | ``` 43 | ./configure --prefix=/mingw 44 | make 45 | make install 46 | ``` 47 | Once you're finished, go inside "C:\MinGW\include" and there should be a new folder named "freetype2". 48 | That, hopefully, means that you have installed the library correctly !! 49 | 50 | #### STEP 3: Build fontconvert.c 51 | 52 | Before proceeding I suggest you make a copy of Adafruit_GFX_library folder in C:\ directory. 53 | Then, inside "fontconvert" folder open the "makefile" with an editor ( I used notepad++). 54 | Change the commands so in the end the program looks like : 55 | ``` 56 | all: fontconvert 57 | 58 | CC = gcc 59 | CFLAGS = -Wall -I c:/mingw/include/freetype2 60 | LIBS = -lfreetype 61 | 62 | fontconvert: fontconvert.c 63 | $(CC) $(CFLAGS) $< $(LIBS) -o $@ 64 | 65 | clean: 66 | rm -f fontconvert 67 | ``` 68 | Go back in the command prompt and with a cd command enter the fontconvert directory. 69 | ``` 70 | cd /c/adafruit_gfx_library\fontconvert 71 | ``` 72 | Give the command: 73 | ``` 74 | make 75 | ``` 76 | This command will, eventually, create a "fontconvert.exe" file inside fontconvert directory. 77 | 78 | #### STEP 4: Create your own font header files 79 | 80 | Now that you have an executable file, you can use it to create your own fonts to work with Adafruit GFX lib. 81 | So, if we suppose that you already have a .ttf file with your favorite fonts, jump to the command prompt and type: 82 | ``` 83 | ./fontconvert yourfonts.ttf 9 > yourfonts9pt7b.h 84 | ``` 85 | You can read more details at: [learn.adafruit](https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts). 86 | 87 | Taraaaaaammm !! you've just created your new font header file. Put it inside the "Fonts" folder, grab a cup of coffee 88 | and start playing with your Arduino (or whatever else ....)+ display module project. 89 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/fontconvert/makefonts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Ugly little Bash script, generates a set of .h files for GFX using 4 | # GNU FreeFont sources. There are three fonts: 'Mono' (Courier-like), 5 | # 'Sans' (Helvetica-like) and 'Serif' (Times-like); four styles: regular, 6 | # bold, oblique or italic, and bold+oblique or bold+italic; and four 7 | # sizes: 9, 12, 18 and 24 point. No real error checking or anything, 8 | # this just powers through all the combinations, calling the fontconvert 9 | # utility and redirecting the output to a .h file for each combo. 10 | 11 | # Adafruit_GFX repository does not include the source outline fonts 12 | # (huge zipfile, different license) but they're easily acquired: 13 | # http://savannah.gnu.org/projects/freefont/ 14 | 15 | convert=./fontconvert 16 | inpath=~/Desktop/freefont/ 17 | outpath=../Fonts/ 18 | fonts=(FreeMono FreeSans FreeSerif) 19 | styles=("" Bold Italic BoldItalic Oblique BoldOblique) 20 | sizes=(9 12 18 24) 21 | 22 | for f in ${fonts[*]} 23 | do 24 | for index in ${!styles[*]} 25 | do 26 | st=${styles[$index]} 27 | for si in ${sizes[*]} 28 | do 29 | infile=$inpath$f$st".ttf" 30 | if [ -f $infile ] # Does source combination exist? 31 | then 32 | outfile=$outpath$f$st$si"pt7b.h" 33 | # printf "%s %s %s > %s\n" $convert $infile $si $outfile 34 | $convert $infile $si > $outfile 35 | fi 36 | done 37 | done 38 | done 39 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/gfxfont.h: -------------------------------------------------------------------------------- 1 | // Font structures for newer Adafruit_GFX (1.1 and later). 2 | // Example fonts are included in 'Fonts' directory. 3 | // To use a font in your Arduino sketch, #include the corresponding .h 4 | // file and pass address of GFXfont struct to setFont(). Pass NULL to 5 | // revert to 'classic' fixed-space bitmap font. 6 | 7 | #ifndef _GFXFONT_H_ 8 | #define _GFXFONT_H_ 9 | 10 | /// Font data stored PER GLYPH 11 | typedef struct { 12 | uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap 13 | uint8_t width; ///< Bitmap dimensions in pixels 14 | uint8_t height; ///< Bitmap dimensions in pixels 15 | uint8_t xAdvance; ///< Distance to advance cursor (x axis) 16 | int8_t xOffset; ///< X dist from cursor pos to UL corner 17 | int8_t yOffset; ///< Y dist from cursor pos to UL corner 18 | } GFXglyph; 19 | 20 | /// Data stored for FONT AS A WHOLE 21 | typedef struct { 22 | uint8_t *bitmap; ///< Glyph bitmaps, concatenated 23 | GFXglyph *glyph; ///< Glyph array 24 | uint8_t first; ///< ASCII extents (first char) 25 | uint8_t last; ///< ASCII extents (last char) 26 | uint8_t yAdvance; ///< Newline distance (y axis) 27 | } GFXfont; 28 | 29 | #endif // _GFXFONT_H_ 30 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/glcdfont.c: -------------------------------------------------------------------------------- 1 | // This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. 2 | // See gfxfont.h for newer custom bitmap font info. 3 | 4 | #ifndef FONT5X7_H 5 | #define FONT5X7_H 6 | 7 | #ifdef __AVR__ 8 | #include 9 | #include 10 | #elif defined(ESP8266) 11 | #include 12 | #else 13 | #define PROGMEM 14 | #endif 15 | 16 | // Standard ASCII 5x7 font 17 | 18 | static const unsigned char font[] PROGMEM = { 19 | 0x00, 0x00, 0x00, 0x00, 0x00, 20 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 21 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 22 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 23 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, 24 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, 25 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 26 | 0x00, 0x18, 0x3C, 0x18, 0x00, 27 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 28 | 0x00, 0x18, 0x24, 0x18, 0x00, 29 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 30 | 0x30, 0x48, 0x3A, 0x06, 0x0E, 31 | 0x26, 0x29, 0x79, 0x29, 0x26, 32 | 0x40, 0x7F, 0x05, 0x05, 0x07, 33 | 0x40, 0x7F, 0x05, 0x25, 0x3F, 34 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 35 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 36 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 37 | 0x14, 0x22, 0x7F, 0x22, 0x14, 38 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 39 | 0x06, 0x09, 0x7F, 0x01, 0x7F, 40 | 0x00, 0x66, 0x89, 0x95, 0x6A, 41 | 0x60, 0x60, 0x60, 0x60, 0x60, 42 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, 43 | 0x08, 0x04, 0x7E, 0x04, 0x08, 44 | 0x10, 0x20, 0x7E, 0x20, 0x10, 45 | 0x08, 0x08, 0x2A, 0x1C, 0x08, 46 | 0x08, 0x1C, 0x2A, 0x08, 0x08, 47 | 0x1E, 0x10, 0x10, 0x10, 0x10, 48 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 49 | 0x30, 0x38, 0x3E, 0x38, 0x30, 50 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x5F, 0x00, 0x00, 53 | 0x00, 0x07, 0x00, 0x07, 0x00, 54 | 0x14, 0x7F, 0x14, 0x7F, 0x14, 55 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, 56 | 0x23, 0x13, 0x08, 0x64, 0x62, 57 | 0x36, 0x49, 0x56, 0x20, 0x50, 58 | 0x00, 0x08, 0x07, 0x03, 0x00, 59 | 0x00, 0x1C, 0x22, 0x41, 0x00, 60 | 0x00, 0x41, 0x22, 0x1C, 0x00, 61 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 62 | 0x08, 0x08, 0x3E, 0x08, 0x08, 63 | 0x00, 0x80, 0x70, 0x30, 0x00, 64 | 0x08, 0x08, 0x08, 0x08, 0x08, 65 | 0x00, 0x00, 0x60, 0x60, 0x00, 66 | 0x20, 0x10, 0x08, 0x04, 0x02, 67 | 0x3E, 0x51, 0x49, 0x45, 0x3E, 68 | 0x00, 0x42, 0x7F, 0x40, 0x00, 69 | 0x72, 0x49, 0x49, 0x49, 0x46, 70 | 0x21, 0x41, 0x49, 0x4D, 0x33, 71 | 0x18, 0x14, 0x12, 0x7F, 0x10, 72 | 0x27, 0x45, 0x45, 0x45, 0x39, 73 | 0x3C, 0x4A, 0x49, 0x49, 0x31, 74 | 0x41, 0x21, 0x11, 0x09, 0x07, 75 | 0x36, 0x49, 0x49, 0x49, 0x36, 76 | 0x46, 0x49, 0x49, 0x29, 0x1E, 77 | 0x00, 0x00, 0x14, 0x00, 0x00, 78 | 0x00, 0x40, 0x34, 0x00, 0x00, 79 | 0x00, 0x08, 0x14, 0x22, 0x41, 80 | 0x14, 0x14, 0x14, 0x14, 0x14, 81 | 0x00, 0x41, 0x22, 0x14, 0x08, 82 | 0x02, 0x01, 0x59, 0x09, 0x06, 83 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, 84 | 0x7C, 0x12, 0x11, 0x12, 0x7C, 85 | 0x7F, 0x49, 0x49, 0x49, 0x36, 86 | 0x3E, 0x41, 0x41, 0x41, 0x22, 87 | 0x7F, 0x41, 0x41, 0x41, 0x3E, 88 | 0x7F, 0x49, 0x49, 0x49, 0x41, 89 | 0x7F, 0x09, 0x09, 0x09, 0x01, 90 | 0x3E, 0x41, 0x41, 0x51, 0x73, 91 | 0x7F, 0x08, 0x08, 0x08, 0x7F, 92 | 0x00, 0x41, 0x7F, 0x41, 0x00, 93 | 0x20, 0x40, 0x41, 0x3F, 0x01, 94 | 0x7F, 0x08, 0x14, 0x22, 0x41, 95 | 0x7F, 0x40, 0x40, 0x40, 0x40, 96 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, 97 | 0x7F, 0x04, 0x08, 0x10, 0x7F, 98 | 0x3E, 0x41, 0x41, 0x41, 0x3E, 99 | 0x7F, 0x09, 0x09, 0x09, 0x06, 100 | 0x3E, 0x41, 0x51, 0x21, 0x5E, 101 | 0x7F, 0x09, 0x19, 0x29, 0x46, 102 | 0x26, 0x49, 0x49, 0x49, 0x32, 103 | 0x03, 0x01, 0x7F, 0x01, 0x03, 104 | 0x3F, 0x40, 0x40, 0x40, 0x3F, 105 | 0x1F, 0x20, 0x40, 0x20, 0x1F, 106 | 0x3F, 0x40, 0x38, 0x40, 0x3F, 107 | 0x63, 0x14, 0x08, 0x14, 0x63, 108 | 0x03, 0x04, 0x78, 0x04, 0x03, 109 | 0x61, 0x59, 0x49, 0x4D, 0x43, 110 | 0x00, 0x7F, 0x41, 0x41, 0x41, 111 | 0x02, 0x04, 0x08, 0x10, 0x20, 112 | 0x00, 0x41, 0x41, 0x41, 0x7F, 113 | 0x04, 0x02, 0x01, 0x02, 0x04, 114 | 0x40, 0x40, 0x40, 0x40, 0x40, 115 | 0x00, 0x03, 0x07, 0x08, 0x00, 116 | 0x20, 0x54, 0x54, 0x78, 0x40, 117 | 0x7F, 0x28, 0x44, 0x44, 0x38, 118 | 0x38, 0x44, 0x44, 0x44, 0x28, 119 | 0x38, 0x44, 0x44, 0x28, 0x7F, 120 | 0x38, 0x54, 0x54, 0x54, 0x18, 121 | 0x00, 0x08, 0x7E, 0x09, 0x02, 122 | 0x18, 0xA4, 0xA4, 0x9C, 0x78, 123 | 0x7F, 0x08, 0x04, 0x04, 0x78, 124 | 0x00, 0x44, 0x7D, 0x40, 0x00, 125 | 0x20, 0x40, 0x40, 0x3D, 0x00, 126 | 0x7F, 0x10, 0x28, 0x44, 0x00, 127 | 0x00, 0x41, 0x7F, 0x40, 0x00, 128 | 0x7C, 0x04, 0x78, 0x04, 0x78, 129 | 0x7C, 0x08, 0x04, 0x04, 0x78, 130 | 0x38, 0x44, 0x44, 0x44, 0x38, 131 | 0xFC, 0x18, 0x24, 0x24, 0x18, 132 | 0x18, 0x24, 0x24, 0x18, 0xFC, 133 | 0x7C, 0x08, 0x04, 0x04, 0x08, 134 | 0x48, 0x54, 0x54, 0x54, 0x24, 135 | 0x04, 0x04, 0x3F, 0x44, 0x24, 136 | 0x3C, 0x40, 0x40, 0x20, 0x7C, 137 | 0x1C, 0x20, 0x40, 0x20, 0x1C, 138 | 0x3C, 0x40, 0x30, 0x40, 0x3C, 139 | 0x44, 0x28, 0x10, 0x28, 0x44, 140 | 0x4C, 0x90, 0x90, 0x90, 0x7C, 141 | 0x44, 0x64, 0x54, 0x4C, 0x44, 142 | 0x00, 0x08, 0x36, 0x41, 0x00, 143 | 0x00, 0x00, 0x77, 0x00, 0x00, 144 | 0x00, 0x41, 0x36, 0x08, 0x00, 145 | 0x02, 0x01, 0x02, 0x04, 0x02, 146 | 0x3C, 0x26, 0x23, 0x26, 0x3C, 147 | 0x1E, 0xA1, 0xA1, 0x61, 0x12, 148 | 0x3A, 0x40, 0x40, 0x20, 0x7A, 149 | 0x38, 0x54, 0x54, 0x55, 0x59, 150 | 0x21, 0x55, 0x55, 0x79, 0x41, 151 | 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut 152 | 0x21, 0x55, 0x54, 0x78, 0x40, 153 | 0x20, 0x54, 0x55, 0x79, 0x40, 154 | 0x0C, 0x1E, 0x52, 0x72, 0x12, 155 | 0x39, 0x55, 0x55, 0x55, 0x59, 156 | 0x39, 0x54, 0x54, 0x54, 0x59, 157 | 0x39, 0x55, 0x54, 0x54, 0x58, 158 | 0x00, 0x00, 0x45, 0x7C, 0x41, 159 | 0x00, 0x02, 0x45, 0x7D, 0x42, 160 | 0x00, 0x01, 0x45, 0x7C, 0x40, 161 | 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut 162 | 0xF0, 0x28, 0x25, 0x28, 0xF0, 163 | 0x7C, 0x54, 0x55, 0x45, 0x00, 164 | 0x20, 0x54, 0x54, 0x7C, 0x54, 165 | 0x7C, 0x0A, 0x09, 0x7F, 0x49, 166 | 0x32, 0x49, 0x49, 0x49, 0x32, 167 | 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut 168 | 0x32, 0x4A, 0x48, 0x48, 0x30, 169 | 0x3A, 0x41, 0x41, 0x21, 0x7A, 170 | 0x3A, 0x42, 0x40, 0x20, 0x78, 171 | 0x00, 0x9D, 0xA0, 0xA0, 0x7D, 172 | 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut 173 | 0x3D, 0x40, 0x40, 0x40, 0x3D, 174 | 0x3C, 0x24, 0xFF, 0x24, 0x24, 175 | 0x48, 0x7E, 0x49, 0x43, 0x66, 176 | 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, 177 | 0xFF, 0x09, 0x29, 0xF6, 0x20, 178 | 0xC0, 0x88, 0x7E, 0x09, 0x03, 179 | 0x20, 0x54, 0x54, 0x79, 0x41, 180 | 0x00, 0x00, 0x44, 0x7D, 0x41, 181 | 0x30, 0x48, 0x48, 0x4A, 0x32, 182 | 0x38, 0x40, 0x40, 0x22, 0x7A, 183 | 0x00, 0x7A, 0x0A, 0x0A, 0x72, 184 | 0x7D, 0x0D, 0x19, 0x31, 0x7D, 185 | 0x26, 0x29, 0x29, 0x2F, 0x28, 186 | 0x26, 0x29, 0x29, 0x29, 0x26, 187 | 0x30, 0x48, 0x4D, 0x40, 0x20, 188 | 0x38, 0x08, 0x08, 0x08, 0x08, 189 | 0x08, 0x08, 0x08, 0x08, 0x38, 190 | 0x2F, 0x10, 0xC8, 0xAC, 0xBA, 191 | 0x2F, 0x10, 0x28, 0x34, 0xFA, 192 | 0x00, 0x00, 0x7B, 0x00, 0x00, 193 | 0x08, 0x14, 0x2A, 0x14, 0x22, 194 | 0x22, 0x14, 0x2A, 0x14, 0x08, 195 | 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code 196 | 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block 197 | 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block 198 | 0x00, 0x00, 0x00, 0xFF, 0x00, 199 | 0x10, 0x10, 0x10, 0xFF, 0x00, 200 | 0x14, 0x14, 0x14, 0xFF, 0x00, 201 | 0x10, 0x10, 0xFF, 0x00, 0xFF, 202 | 0x10, 0x10, 0xF0, 0x10, 0xF0, 203 | 0x14, 0x14, 0x14, 0xFC, 0x00, 204 | 0x14, 0x14, 0xF7, 0x00, 0xFF, 205 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 206 | 0x14, 0x14, 0xF4, 0x04, 0xFC, 207 | 0x14, 0x14, 0x17, 0x10, 0x1F, 208 | 0x10, 0x10, 0x1F, 0x10, 0x1F, 209 | 0x14, 0x14, 0x14, 0x1F, 0x00, 210 | 0x10, 0x10, 0x10, 0xF0, 0x00, 211 | 0x00, 0x00, 0x00, 0x1F, 0x10, 212 | 0x10, 0x10, 0x10, 0x1F, 0x10, 213 | 0x10, 0x10, 0x10, 0xF0, 0x10, 214 | 0x00, 0x00, 0x00, 0xFF, 0x10, 215 | 0x10, 0x10, 0x10, 0x10, 0x10, 216 | 0x10, 0x10, 0x10, 0xFF, 0x10, 217 | 0x00, 0x00, 0x00, 0xFF, 0x14, 218 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 219 | 0x00, 0x00, 0x1F, 0x10, 0x17, 220 | 0x00, 0x00, 0xFC, 0x04, 0xF4, 221 | 0x14, 0x14, 0x17, 0x10, 0x17, 222 | 0x14, 0x14, 0xF4, 0x04, 0xF4, 223 | 0x00, 0x00, 0xFF, 0x00, 0xF7, 224 | 0x14, 0x14, 0x14, 0x14, 0x14, 225 | 0x14, 0x14, 0xF7, 0x00, 0xF7, 226 | 0x14, 0x14, 0x14, 0x17, 0x14, 227 | 0x10, 0x10, 0x1F, 0x10, 0x1F, 228 | 0x14, 0x14, 0x14, 0xF4, 0x14, 229 | 0x10, 0x10, 0xF0, 0x10, 0xF0, 230 | 0x00, 0x00, 0x1F, 0x10, 0x1F, 231 | 0x00, 0x00, 0x00, 0x1F, 0x14, 232 | 0x00, 0x00, 0x00, 0xFC, 0x14, 233 | 0x00, 0x00, 0xF0, 0x10, 0xF0, 234 | 0x10, 0x10, 0xFF, 0x10, 0xFF, 235 | 0x14, 0x14, 0x14, 0xFF, 0x14, 236 | 0x10, 0x10, 0x10, 0x1F, 0x00, 237 | 0x00, 0x00, 0x00, 0xF0, 0x10, 238 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 239 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 240 | 0xFF, 0xFF, 0xFF, 0x00, 0x00, 241 | 0x00, 0x00, 0x00, 0xFF, 0xFF, 242 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 243 | 0x38, 0x44, 0x44, 0x38, 0x44, 244 | 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta 245 | 0x7E, 0x02, 0x02, 0x06, 0x06, 246 | 0x02, 0x7E, 0x02, 0x7E, 0x02, 247 | 0x63, 0x55, 0x49, 0x41, 0x63, 248 | 0x38, 0x44, 0x44, 0x3C, 0x04, 249 | 0x40, 0x7E, 0x20, 0x1E, 0x20, 250 | 0x06, 0x02, 0x7E, 0x02, 0x02, 251 | 0x99, 0xA5, 0xE7, 0xA5, 0x99, 252 | 0x1C, 0x2A, 0x49, 0x2A, 0x1C, 253 | 0x4C, 0x72, 0x01, 0x72, 0x4C, 254 | 0x30, 0x4A, 0x4D, 0x4D, 0x30, 255 | 0x30, 0x48, 0x78, 0x48, 0x30, 256 | 0xBC, 0x62, 0x5A, 0x46, 0x3D, 257 | 0x3E, 0x49, 0x49, 0x49, 0x00, 258 | 0x7E, 0x01, 0x01, 0x01, 0x7E, 259 | 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 260 | 0x44, 0x44, 0x5F, 0x44, 0x44, 261 | 0x40, 0x51, 0x4A, 0x44, 0x40, 262 | 0x40, 0x44, 0x4A, 0x51, 0x40, 263 | 0x00, 0x00, 0xFF, 0x01, 0x03, 264 | 0xE0, 0x80, 0xFF, 0x00, 0x00, 265 | 0x08, 0x08, 0x6B, 0x6B, 0x08, 266 | 0x36, 0x12, 0x36, 0x24, 0x36, 267 | 0x06, 0x0F, 0x09, 0x0F, 0x06, 268 | 0x00, 0x00, 0x18, 0x18, 0x00, 269 | 0x00, 0x00, 0x10, 0x10, 0x00, 270 | 0x30, 0x40, 0xFF, 0x01, 0x01, 271 | 0x00, 0x1F, 0x01, 0x01, 0x1E, 272 | 0x00, 0x19, 0x1D, 0x17, 0x12, 273 | 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 274 | 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP 275 | }; 276 | #endif // FONT5X7_H 277 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/library.properties: -------------------------------------------------------------------------------- 1 | name=Adafruit GFX Library 2 | version=1.2.7 3 | author=Adafruit 4 | maintainer=Adafruit 5 | sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from. 6 | paragraph=Install this library in addition to the display library for your hardware. 7 | category=Display 8 | url=https://github.com/adafruit/Adafruit-GFX-Library 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/Adafruit_GFX_Library/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2012 Adafruit Industries. All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | - Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /libraries/Adafruit_SSD1306/Adafruit_SSD1306.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | This is a library for our Monochrome OLEDs based on SSD1306 drivers 3 | 4 | Pick one up today in the adafruit shop! 5 | ------> http://www.adafruit.com/category/63_98 6 | 7 | These displays use SPI to communicate, 4 or 5 pins are required to 8 | interface 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | #ifndef _Adafruit_SSD1306_H_ 19 | #define _Adafruit_SSD1306_H_ 20 | 21 | #if ARDUINO >= 100 22 | #include "Arduino.h" 23 | #define WIRE_WRITE Wire.write 24 | #else 25 | #include "WProgram.h" 26 | #define WIRE_WRITE Wire.send 27 | #endif 28 | 29 | #if defined(__SAM3X8E__) 30 | typedef volatile RwReg PortReg; 31 | typedef uint32_t PortMask; 32 | #define HAVE_PORTREG 33 | #elif defined(ARDUINO_ARCH_SAMD) 34 | // not supported 35 | #elif defined(ESP8266) || defined(ARDUINO_STM32_FEATHER) 36 | typedef volatile uint32_t PortReg; 37 | typedef uint32_t PortMask; 38 | #else 39 | typedef volatile uint8_t PortReg; 40 | typedef uint8_t PortMask; 41 | #define HAVE_PORTREG 42 | #endif 43 | 44 | #include 45 | #include 46 | 47 | #define BLACK 0 48 | #define WHITE 1 49 | #define INVERSE 2 50 | 51 | #define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D 52 | // Address for 128x32 is 0x3C 53 | // Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded) 54 | 55 | /*========================================================================= 56 | SSD1306 Displays 57 | ----------------------------------------------------------------------- 58 | The driver is used in multiple displays (128x64, 128x32, etc.). 59 | Select the appropriate display below to create an appropriately 60 | sized framebuffer, etc. 61 | 62 | SSD1306_128_64 128x64 pixel display 63 | 64 | SSD1306_128_32 128x32 pixel display 65 | 66 | SSD1306_96_16 67 | 68 | -----------------------------------------------------------------------*/ 69 | // #define SSD1306_128_64 70 | // #define SSD1306_128_32 71 | // #define SSD1306_96_16 72 | #define SSD1306_64_32 73 | /*=========================================================================*/ 74 | 75 | #if defined SSD1306_128_64 && defined SSD1306_128_32 76 | #error "Only one SSD1306 display can be specified at once in SSD1306.h" 77 | #endif 78 | #if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16 && !defined SSD1306_64_32 79 | #error "At least one SSD1306 display must be specified in SSD1306.h" 80 | #endif 81 | 82 | #if defined SSD1306_128_64 83 | #define SSD1306_LCDWIDTH 128 84 | #define SSD1306_LCDHEIGHT 64 85 | #endif 86 | #if defined SSD1306_128_32 87 | #define SSD1306_LCDWIDTH 128 88 | #define SSD1306_LCDHEIGHT 32 89 | #endif 90 | #if defined SSD1306_96_16 91 | #define SSD1306_LCDWIDTH 96 92 | #define SSD1306_LCDHEIGHT 16 93 | #endif 94 | #if defined SSD1306_64_32 95 | #define SSD1306_LCDWIDTH 64 96 | #define SSD1306_LCDHEIGHT 32 97 | #endif 98 | 99 | #define SSD1306_SETCONTRAST 0x81 100 | #define SSD1306_DISPLAYALLON_RESUME 0xA4 101 | #define SSD1306_DISPLAYALLON 0xA5 102 | #define SSD1306_NORMALDISPLAY 0xA6 103 | #define SSD1306_INVERTDISPLAY 0xA7 104 | #define SSD1306_DISPLAYOFF 0xAE 105 | #define SSD1306_DISPLAYON 0xAF 106 | 107 | #define SSD1306_SETDISPLAYOFFSET 0xD3 108 | #define SSD1306_SETCOMPINS 0xDA 109 | 110 | #define SSD1306_SETVCOMDETECT 0xDB 111 | 112 | #define SSD1306_SETDISPLAYCLOCKDIV 0xD5 113 | #define SSD1306_SETPRECHARGE 0xD9 114 | 115 | #define SSD1306_SETMULTIPLEX 0xA8 116 | 117 | #define SSD1306_SETLOWCOLUMN 0x00 118 | #define SSD1306_SETHIGHCOLUMN 0x10 119 | 120 | #define SSD1306_SETSTARTLINE 0x40 121 | 122 | #define SSD1306_MEMORYMODE 0x20 123 | #define SSD1306_COLUMNADDR 0x21 124 | #define SSD1306_PAGEADDR 0x22 125 | 126 | #define SSD1306_COMSCANINC 0xC0 127 | #define SSD1306_COMSCANDEC 0xC8 128 | 129 | #define SSD1306_SEGREMAP 0xA0 130 | 131 | #define SSD1306_CHARGEPUMP 0x8D 132 | 133 | #define SSD1306_EXTERNALVCC 0x1 134 | #define SSD1306_SWITCHCAPVCC 0x2 135 | 136 | // Scrolling #defines 137 | #define SSD1306_ACTIVATE_SCROLL 0x2F 138 | #define SSD1306_DEACTIVATE_SCROLL 0x2E 139 | #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3 140 | #define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26 141 | #define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27 142 | #define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29 143 | #define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A 144 | 145 | class Adafruit_SSD1306 : public Adafruit_GFX { 146 | public: 147 | Adafruit_SSD1306(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS); 148 | Adafruit_SSD1306(int8_t DC, int8_t RST, int8_t CS); 149 | Adafruit_SSD1306(int8_t RST = -1); 150 | 151 | void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool reset=true); 152 | void ssd1306_command(uint8_t c); 153 | 154 | void clearDisplay(void); 155 | void invertDisplay(uint8_t i); 156 | void display(); 157 | 158 | void startscrollright(uint8_t start, uint8_t stop); 159 | void startscrollleft(uint8_t start, uint8_t stop); 160 | 161 | void startscrolldiagright(uint8_t start, uint8_t stop); 162 | void startscrolldiagleft(uint8_t start, uint8_t stop); 163 | void stopscroll(void); 164 | 165 | void dim(boolean dim); 166 | 167 | void drawPixel(int16_t x, int16_t y, uint16_t color); 168 | 169 | virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); 170 | virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); 171 | 172 | private: 173 | int8_t _i2caddr, _vccstate, sid, sclk, dc, rst, cs; 174 | void fastSPIwrite(uint8_t c); 175 | 176 | boolean hwSPI; 177 | #ifdef HAVE_PORTREG 178 | PortReg *mosiport, *clkport, *csport, *dcport; 179 | PortMask mosipinmask, clkpinmask, cspinmask, dcpinmask; 180 | #endif 181 | 182 | inline void drawFastVLineInternal(int16_t x, int16_t y, int16_t h, uint16_t color) __attribute__((always_inline)); 183 | inline void drawFastHLineInternal(int16_t x, int16_t y, int16_t w, uint16_t color) __attribute__((always_inline)); 184 | 185 | }; 186 | 187 | #endif /* _Adafruit_SSD1306_H_ */ 188 | -------------------------------------------------------------------------------- /libraries/Adafruit_SSD1306/README.md: -------------------------------------------------------------------------------- 1 | # Adafruit_SSD1306 2 | 3 | 4 | ## Compatibility 5 | 6 | MCU | Tested Works | Doesn't Work | Not Tested | Notes 7 | ------------------ | :----------: | :----------: | :---------: | ----- 8 | Atmega328 @ 16MHz | X | | | 9 | Atmega328 @ 12MHz | X | | | 10 | Atmega32u4 @ 16MHz | X | | | 11 | Atmega32u4 @ 8MHz | X | | | 12 | ESP8266 | X | | | change OLED_RESET to different pin if using default I2C pins D4/D5. 13 | Atmega2560 @ 16MHz | X | | | 14 | ATSAM3X8E | X | | | 15 | ATSAM21D | X | | | 16 | ATtiny85 @ 16MHz | | X | | 17 | ATtiny85 @ 8MHz | | X | | 18 | Intel Curie @ 32MHz | | | X | 19 | STM32F2 | | | X | 20 | 21 | * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini 22 | * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V 23 | * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 24 | * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro 25 | * ESP8266 : Adafruit Huzzah 26 | * ATmega2560 @ 16MHz : Arduino Mega 27 | * ATSAM3X8E : Arduino Due 28 | * ATSAM21D : Arduino Zero, M0 Pro 29 | * ATtiny85 @ 16MHz : Adafruit Trinket 5V 30 | * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V 31 | 32 | 33 | -------------------------------------------------------------------------------- /libraries/Adafruit_SSD1306/README.txt: -------------------------------------------------------------------------------- 1 | This is a library for our Monochrome OLEDs based on SSD1306 drivers 2 | 3 | Pick one up today in the adafruit shop! 4 | ------> http://www.adafruit.com/category/63_98 5 | 6 | These displays use SPI to communicate, 4 or 5 pins are required to 7 | interface 8 | 9 | Adafruit invests time and resources providing this open source code, 10 | please support Adafruit and open-source hardware by purchasing 11 | products from Adafruit! 12 | 13 | Written by Limor Fried/Ladyada for Adafruit Industries. 14 | Scrolling code contributed by Michael Gregg 15 | BSD license, check license.txt for more information 16 | All text above must be included in any redistribution 17 | 18 | To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_SSD1306. Check that the Adafruit_SSD1306 folder contains Adafruit_SSD1306.cpp and Adafruit_SSD1306.h 19 | 20 | Place the Adafruit_SSD1306 library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. 21 | 22 | You will also have to download the Adafruit GFX Graphics core which does all the circles, text, rectangles, etc. You can get it from 23 | https://github.com/adafruit/Adafruit-GFX-Library 24 | and download/install that library as well -------------------------------------------------------------------------------- /libraries/Adafruit_SSD1306/examples/ssd1306_128x32_i2c/ssd1306_128x32_i2c.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | This is an example for our Monochrome OLEDs based on SSD1306 drivers 3 | 4 | Pick one up today in the adafruit shop! 5 | ------> http://www.adafruit.com/category/63_98 6 | 7 | This example is for a 128x32 size display using I2C to communicate 8 | 3 pins are required to interface (2 I2C and one reset) 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #define OLED_RESET 4 25 | Adafruit_SSD1306 display(OLED_RESET); 26 | 27 | #define NUMFLAKES 10 28 | #define XPOS 0 29 | #define YPOS 1 30 | #define DELTAY 2 31 | 32 | 33 | #define LOGO16_GLCD_HEIGHT 16 34 | #define LOGO16_GLCD_WIDTH 16 35 | static const unsigned char PROGMEM logo16_glcd_bmp[] = 36 | { B00000000, B11000000, 37 | B00000001, B11000000, 38 | B00000001, B11000000, 39 | B00000011, B11100000, 40 | B11110011, B11100000, 41 | B11111110, B11111000, 42 | B01111110, B11111111, 43 | B00110011, B10011111, 44 | B00011111, B11111100, 45 | B00001101, B01110000, 46 | B00011011, B10100000, 47 | B00111111, B11100000, 48 | B00111111, B11110000, 49 | B01111100, B11110000, 50 | B01110000, B01110000, 51 | B00000000, B00110000 }; 52 | 53 | #if (SSD1306_LCDHEIGHT != 32) 54 | #error("Height incorrect, please fix Adafruit_SSD1306.h!"); 55 | #endif 56 | 57 | void setup() { 58 | Serial.begin(9600); 59 | 60 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) 61 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) 62 | // init done 63 | 64 | // Show image buffer on the display hardware. 65 | // Since the buffer is intialized with an Adafruit splashscreen 66 | // internally, this will display the splashscreen. 67 | display.display(); 68 | delay(2000); 69 | 70 | // Clear the buffer. 71 | display.clearDisplay(); 72 | 73 | // draw a single pixel 74 | display.drawPixel(10, 10, WHITE); 75 | // Show the display buffer on the hardware. 76 | // NOTE: You _must_ call display after making any drawing commands 77 | // to make them visible on the display hardware! 78 | display.display(); 79 | delay(2000); 80 | display.clearDisplay(); 81 | 82 | // draw many lines 83 | testdrawline(); 84 | display.display(); 85 | delay(2000); 86 | display.clearDisplay(); 87 | 88 | // draw rectangles 89 | testdrawrect(); 90 | display.display(); 91 | delay(2000); 92 | display.clearDisplay(); 93 | 94 | // draw multiple rectangles 95 | testfillrect(); 96 | display.display(); 97 | delay(2000); 98 | display.clearDisplay(); 99 | 100 | // draw mulitple circles 101 | testdrawcircle(); 102 | display.display(); 103 | delay(2000); 104 | display.clearDisplay(); 105 | 106 | // draw a white circle, 10 pixel radius 107 | display.fillCircle(display.width()/2, display.height()/2, 10, WHITE); 108 | display.display(); 109 | delay(2000); 110 | display.clearDisplay(); 111 | 112 | testdrawroundrect(); 113 | delay(2000); 114 | display.clearDisplay(); 115 | 116 | testfillroundrect(); 117 | delay(2000); 118 | display.clearDisplay(); 119 | 120 | testdrawtriangle(); 121 | delay(2000); 122 | display.clearDisplay(); 123 | 124 | testfilltriangle(); 125 | delay(2000); 126 | display.clearDisplay(); 127 | 128 | // draw the first ~12 characters in the font 129 | testdrawchar(); 130 | display.display(); 131 | delay(2000); 132 | display.clearDisplay(); 133 | 134 | // draw scrolling text 135 | testscrolltext(); 136 | delay(2000); 137 | display.clearDisplay(); 138 | 139 | // text display tests 140 | display.setTextSize(1); 141 | display.setTextColor(WHITE); 142 | display.setCursor(0,0); 143 | display.println("Hello, world!"); 144 | display.setTextColor(BLACK, WHITE); // 'inverted' text 145 | display.println(3.141592); 146 | display.setTextSize(2); 147 | display.setTextColor(WHITE); 148 | display.print("0x"); display.println(0xDEADBEEF, HEX); 149 | display.display(); 150 | delay(2000); 151 | display.clearDisplay(); 152 | 153 | // miniature bitmap display 154 | display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1); 155 | display.display(); 156 | delay(1); 157 | 158 | // invert the display 159 | display.invertDisplay(true); 160 | delay(1000); 161 | display.invertDisplay(false); 162 | delay(1000); 163 | display.clearDisplay(); 164 | 165 | // draw a bitmap icon and 'animate' movement 166 | testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH); 167 | } 168 | 169 | 170 | void loop() { 171 | 172 | } 173 | 174 | 175 | void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) { 176 | uint8_t icons[NUMFLAKES][3]; 177 | 178 | // initialize 179 | for (uint8_t f=0; f< NUMFLAKES; f++) { 180 | icons[f][XPOS] = random(display.width()); 181 | icons[f][YPOS] = 0; 182 | icons[f][DELTAY] = random(5) + 1; 183 | 184 | Serial.print("x: "); 185 | Serial.print(icons[f][XPOS], DEC); 186 | Serial.print(" y: "); 187 | Serial.print(icons[f][YPOS], DEC); 188 | Serial.print(" dy: "); 189 | Serial.println(icons[f][DELTAY], DEC); 190 | } 191 | 192 | while (1) { 193 | // draw each icon 194 | for (uint8_t f=0; f< NUMFLAKES; f++) { 195 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, WHITE); 196 | } 197 | display.display(); 198 | delay(200); 199 | 200 | // then erase it + move it 201 | for (uint8_t f=0; f< NUMFLAKES; f++) { 202 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, BLACK); 203 | // move it 204 | icons[f][YPOS] += icons[f][DELTAY]; 205 | // if its gone, reinit 206 | if (icons[f][YPOS] > display.height()) { 207 | icons[f][XPOS] = random(display.width()); 208 | icons[f][YPOS] = 0; 209 | icons[f][DELTAY] = random(5) + 1; 210 | } 211 | } 212 | } 213 | } 214 | 215 | 216 | void testdrawchar(void) { 217 | display.setTextSize(1); 218 | display.setTextColor(WHITE); 219 | display.setCursor(0,0); 220 | 221 | for (uint8_t i=0; i < 168; i++) { 222 | if (i == '\n') continue; 223 | display.write(i); 224 | if ((i > 0) && (i % 21 == 0)) 225 | display.println(); 226 | } 227 | display.display(); 228 | delay(1); 229 | } 230 | 231 | void testdrawcircle(void) { 232 | for (int16_t i=0; i0; i-=5) { 263 | display.fillTriangle(display.width()/2, display.height()/2-i, 264 | display.width()/2-i, display.height()/2+i, 265 | display.width()/2+i, display.height()/2+i, WHITE); 266 | if (color == WHITE) color = BLACK; 267 | else color = WHITE; 268 | display.display(); 269 | delay(1); 270 | } 271 | } 272 | 273 | void testdrawroundrect(void) { 274 | for (int16_t i=0; i=0; i-=4) { 320 | display.drawLine(0, display.height()-1, display.width()-1, i, WHITE); 321 | display.display(); 322 | delay(1); 323 | } 324 | delay(250); 325 | 326 | display.clearDisplay(); 327 | for (int16_t i=display.width()-1; i>=0; i-=4) { 328 | display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE); 329 | display.display(); 330 | delay(1); 331 | } 332 | for (int16_t i=display.height()-1; i>=0; i-=4) { 333 | display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE); 334 | display.display(); 335 | delay(1); 336 | } 337 | delay(250); 338 | 339 | display.clearDisplay(); 340 | for (int16_t i=0; i http://www.adafruit.com/category/63_98 6 | 7 | This example is for a 128x32 size display using SPI to communicate 8 | 4 or 5 pins are required to interface 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | // If using software SPI (the default case): 25 | #define OLED_MOSI 9 26 | #define OLED_CLK 10 27 | #define OLED_DC 11 28 | #define OLED_CS 12 29 | #define OLED_RESET 13 30 | Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); 31 | 32 | /* Uncomment this block to use hardware SPI 33 | #define OLED_DC 6 34 | #define OLED_CS 7 35 | #define OLED_RESET 8 36 | Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS); 37 | */ 38 | 39 | #define NUMFLAKES 10 40 | #define XPOS 0 41 | #define YPOS 1 42 | #define DELTAY 2 43 | 44 | #define LOGO16_GLCD_HEIGHT 16 45 | #define LOGO16_GLCD_WIDTH 16 46 | static const unsigned char PROGMEM logo16_glcd_bmp[] = 47 | { B00000000, B11000000, 48 | B00000001, B11000000, 49 | B00000001, B11000000, 50 | B00000011, B11100000, 51 | B11110011, B11100000, 52 | B11111110, B11111000, 53 | B01111110, B11111111, 54 | B00110011, B10011111, 55 | B00011111, B11111100, 56 | B00001101, B01110000, 57 | B00011011, B10100000, 58 | B00111111, B11100000, 59 | B00111111, B11110000, 60 | B01111100, B11110000, 61 | B01110000, B01110000, 62 | B00000000, B00110000 }; 63 | 64 | #if (SSD1306_LCDHEIGHT != 32) 65 | #error("Height incorrect, please fix Adafruit_SSD1306.h!"); 66 | #endif 67 | 68 | void setup() { 69 | Serial.begin(9600); 70 | 71 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) 72 | display.begin(SSD1306_SWITCHCAPVCC); 73 | // init done 74 | 75 | // Show image buffer on the display hardware. 76 | // Since the buffer is intialized with an Adafruit splashscreen 77 | // internally, this will display the splashscreen. 78 | display.display(); 79 | delay(2000); 80 | 81 | // Clear the buffer. 82 | display.clearDisplay(); 83 | 84 | // draw a single pixel 85 | display.drawPixel(10, 10, WHITE); 86 | // Show the display buffer on the hardware. 87 | // NOTE: You _must_ call display after making any drawing commands 88 | // to make them visible on the display hardware! 89 | display.display(); 90 | delay(2000); 91 | display.clearDisplay(); 92 | 93 | // draw many lines 94 | testdrawline(); 95 | display.display(); 96 | delay(2000); 97 | display.clearDisplay(); 98 | 99 | // draw rectangles 100 | testdrawrect(); 101 | display.display(); 102 | delay(2000); 103 | display.clearDisplay(); 104 | 105 | // draw multiple rectangles 106 | testfillrect(); 107 | display.display(); 108 | delay(2000); 109 | display.clearDisplay(); 110 | 111 | // draw mulitple circles 112 | testdrawcircle(); 113 | display.display(); 114 | delay(2000); 115 | display.clearDisplay(); 116 | 117 | // draw a white circle, 10 pixel radius 118 | display.fillCircle(display.width()/2, display.height()/2, 10, WHITE); 119 | display.display(); 120 | delay(2000); 121 | display.clearDisplay(); 122 | 123 | testdrawroundrect(); 124 | delay(2000); 125 | display.clearDisplay(); 126 | 127 | testfillroundrect(); 128 | delay(2000); 129 | display.clearDisplay(); 130 | 131 | testdrawtriangle(); 132 | delay(2000); 133 | display.clearDisplay(); 134 | 135 | testfilltriangle(); 136 | delay(2000); 137 | display.clearDisplay(); 138 | 139 | // draw the first ~12 characters in the font 140 | testdrawchar(); 141 | display.display(); 142 | delay(2000); 143 | display.clearDisplay(); 144 | 145 | // draw scrolling text 146 | testscrolltext(); 147 | delay(2000); 148 | display.clearDisplay(); 149 | 150 | // text display tests 151 | display.setTextSize(1); 152 | display.setTextColor(WHITE); 153 | display.setCursor(0,0); 154 | display.println("Hello, world!"); 155 | display.setTextColor(BLACK, WHITE); // 'inverted' text 156 | display.println(3.141592); 157 | display.setTextSize(2); 158 | display.setTextColor(WHITE); 159 | display.print("0x"); display.println(0xDEADBEEF, HEX); 160 | display.display(); 161 | delay(2000); 162 | display.clearDisplay(); 163 | 164 | // miniature bitmap display 165 | display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1); 166 | display.display(); 167 | 168 | // invert the display 169 | display.invertDisplay(true); 170 | delay(1000); 171 | display.invertDisplay(false); 172 | delay(1000); 173 | display.clearDisplay(); 174 | 175 | // draw a bitmap icon and 'animate' movement 176 | testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH); 177 | } 178 | 179 | 180 | void loop() { 181 | 182 | } 183 | 184 | 185 | void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) { 186 | uint8_t icons[NUMFLAKES][3]; 187 | 188 | // initialize 189 | for (uint8_t f=0; f< NUMFLAKES; f++) { 190 | icons[f][XPOS] = random(display.width()); 191 | icons[f][YPOS] = 0; 192 | icons[f][DELTAY] = random(5) + 1; 193 | 194 | Serial.print("x: "); 195 | Serial.print(icons[f][XPOS], DEC); 196 | Serial.print(" y: "); 197 | Serial.print(icons[f][YPOS], DEC); 198 | Serial.print(" dy: "); 199 | Serial.println(icons[f][DELTAY], DEC); 200 | } 201 | 202 | while (1) { 203 | // draw each icon 204 | for (uint8_t f=0; f< NUMFLAKES; f++) { 205 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, WHITE); 206 | } 207 | display.display(); 208 | delay(200); 209 | 210 | // then erase it + move it 211 | for (uint8_t f=0; f< NUMFLAKES; f++) { 212 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, BLACK); 213 | // move it 214 | icons[f][YPOS] += icons[f][DELTAY]; 215 | // if its gone, reinit 216 | if (icons[f][YPOS] > display.height()) { 217 | icons[f][XPOS] = random(display.width()); 218 | icons[f][YPOS] = 0; 219 | icons[f][DELTAY] = random(5) + 1; 220 | } 221 | } 222 | } 223 | } 224 | 225 | 226 | void testdrawchar(void) { 227 | display.setTextSize(1); 228 | display.setTextColor(WHITE); 229 | display.setCursor(0,0); 230 | 231 | for (uint8_t i=0; i < 168; i++) { 232 | if (i == '\n') continue; 233 | display.write(i); 234 | if ((i > 0) && (i % 21 == 0)) 235 | display.println(); 236 | } 237 | display.display(); 238 | } 239 | 240 | void testdrawcircle(void) { 241 | for (int16_t i=0; i0; i-=5) { 269 | display.fillTriangle(display.width()/2, display.height()/2-i, 270 | display.width()/2-i, display.height()/2+i, 271 | display.width()/2+i, display.height()/2+i, WHITE); 272 | if (color == WHITE) color = BLACK; 273 | else color = WHITE; 274 | display.display(); 275 | } 276 | } 277 | 278 | void testdrawroundrect(void) { 279 | for (int16_t i=0; i=0; i-=4) { 319 | display.drawLine(0, display.height()-1, display.width()-1, i, WHITE); 320 | display.display(); 321 | } 322 | delay(250); 323 | 324 | display.clearDisplay(); 325 | for (int16_t i=display.width()-1; i>=0; i-=4) { 326 | display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE); 327 | display.display(); 328 | } 329 | for (int16_t i=display.height()-1; i>=0; i-=4) { 330 | display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE); 331 | display.display(); 332 | } 333 | delay(250); 334 | 335 | display.clearDisplay(); 336 | for (int16_t i=0; i http://www.adafruit.com/category/63_98 6 | 7 | This example is for a 128x64 size display using I2C to communicate 8 | 3 pins are required to interface (2 I2C and one reset) 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #define OLED_RESET 4 25 | Adafruit_SSD1306 display(OLED_RESET); 26 | 27 | #define NUMFLAKES 10 28 | #define XPOS 0 29 | #define YPOS 1 30 | #define DELTAY 2 31 | 32 | 33 | #define LOGO16_GLCD_HEIGHT 16 34 | #define LOGO16_GLCD_WIDTH 16 35 | static const unsigned char PROGMEM logo16_glcd_bmp[] = 36 | { B00000000, B11000000, 37 | B00000001, B11000000, 38 | B00000001, B11000000, 39 | B00000011, B11100000, 40 | B11110011, B11100000, 41 | B11111110, B11111000, 42 | B01111110, B11111111, 43 | B00110011, B10011111, 44 | B00011111, B11111100, 45 | B00001101, B01110000, 46 | B00011011, B10100000, 47 | B00111111, B11100000, 48 | B00111111, B11110000, 49 | B01111100, B11110000, 50 | B01110000, B01110000, 51 | B00000000, B00110000 }; 52 | 53 | #if (SSD1306_LCDHEIGHT != 64) 54 | #error("Height incorrect, please fix Adafruit_SSD1306.h!"); 55 | #endif 56 | 57 | void setup() { 58 | Serial.begin(9600); 59 | 60 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) 61 | display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64) 62 | // init done 63 | 64 | // Show image buffer on the display hardware. 65 | // Since the buffer is intialized with an Adafruit splashscreen 66 | // internally, this will display the splashscreen. 67 | display.display(); 68 | delay(2000); 69 | 70 | // Clear the buffer. 71 | display.clearDisplay(); 72 | 73 | // draw a single pixel 74 | display.drawPixel(10, 10, WHITE); 75 | // Show the display buffer on the hardware. 76 | // NOTE: You _must_ call display after making any drawing commands 77 | // to make them visible on the display hardware! 78 | display.display(); 79 | delay(2000); 80 | display.clearDisplay(); 81 | 82 | // draw many lines 83 | testdrawline(); 84 | display.display(); 85 | delay(2000); 86 | display.clearDisplay(); 87 | 88 | // draw rectangles 89 | testdrawrect(); 90 | display.display(); 91 | delay(2000); 92 | display.clearDisplay(); 93 | 94 | // draw multiple rectangles 95 | testfillrect(); 96 | display.display(); 97 | delay(2000); 98 | display.clearDisplay(); 99 | 100 | // draw mulitple circles 101 | testdrawcircle(); 102 | display.display(); 103 | delay(2000); 104 | display.clearDisplay(); 105 | 106 | // draw a white circle, 10 pixel radius 107 | display.fillCircle(display.width()/2, display.height()/2, 10, WHITE); 108 | display.display(); 109 | delay(2000); 110 | display.clearDisplay(); 111 | 112 | testdrawroundrect(); 113 | delay(2000); 114 | display.clearDisplay(); 115 | 116 | testfillroundrect(); 117 | delay(2000); 118 | display.clearDisplay(); 119 | 120 | testdrawtriangle(); 121 | delay(2000); 122 | display.clearDisplay(); 123 | 124 | testfilltriangle(); 125 | delay(2000); 126 | display.clearDisplay(); 127 | 128 | // draw the first ~12 characters in the font 129 | testdrawchar(); 130 | display.display(); 131 | delay(2000); 132 | display.clearDisplay(); 133 | 134 | // draw scrolling text 135 | testscrolltext(); 136 | delay(2000); 137 | display.clearDisplay(); 138 | 139 | // text display tests 140 | display.setTextSize(1); 141 | display.setTextColor(WHITE); 142 | display.setCursor(0,0); 143 | display.println("Hello, world!"); 144 | display.setTextColor(BLACK, WHITE); // 'inverted' text 145 | display.println(3.141592); 146 | display.setTextSize(2); 147 | display.setTextColor(WHITE); 148 | display.print("0x"); display.println(0xDEADBEEF, HEX); 149 | display.display(); 150 | delay(2000); 151 | display.clearDisplay(); 152 | 153 | // miniature bitmap display 154 | display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1); 155 | display.display(); 156 | delay(1); 157 | 158 | // invert the display 159 | display.invertDisplay(true); 160 | delay(1000); 161 | display.invertDisplay(false); 162 | delay(1000); 163 | display.clearDisplay(); 164 | 165 | // draw a bitmap icon and 'animate' movement 166 | testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH); 167 | } 168 | 169 | 170 | void loop() { 171 | 172 | } 173 | 174 | 175 | void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) { 176 | uint8_t icons[NUMFLAKES][3]; 177 | 178 | // initialize 179 | for (uint8_t f=0; f< NUMFLAKES; f++) { 180 | icons[f][XPOS] = random(display.width()); 181 | icons[f][YPOS] = 0; 182 | icons[f][DELTAY] = random(5) + 1; 183 | 184 | Serial.print("x: "); 185 | Serial.print(icons[f][XPOS], DEC); 186 | Serial.print(" y: "); 187 | Serial.print(icons[f][YPOS], DEC); 188 | Serial.print(" dy: "); 189 | Serial.println(icons[f][DELTAY], DEC); 190 | } 191 | 192 | while (1) { 193 | // draw each icon 194 | for (uint8_t f=0; f< NUMFLAKES; f++) { 195 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, WHITE); 196 | } 197 | display.display(); 198 | delay(200); 199 | 200 | // then erase it + move it 201 | for (uint8_t f=0; f< NUMFLAKES; f++) { 202 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, BLACK); 203 | // move it 204 | icons[f][YPOS] += icons[f][DELTAY]; 205 | // if its gone, reinit 206 | if (icons[f][YPOS] > display.height()) { 207 | icons[f][XPOS] = random(display.width()); 208 | icons[f][YPOS] = 0; 209 | icons[f][DELTAY] = random(5) + 1; 210 | } 211 | } 212 | } 213 | } 214 | 215 | 216 | void testdrawchar(void) { 217 | display.setTextSize(1); 218 | display.setTextColor(WHITE); 219 | display.setCursor(0,0); 220 | 221 | for (uint8_t i=0; i < 168; i++) { 222 | if (i == '\n') continue; 223 | display.write(i); 224 | if ((i > 0) && (i % 21 == 0)) 225 | display.println(); 226 | } 227 | display.display(); 228 | delay(1); 229 | } 230 | 231 | void testdrawcircle(void) { 232 | for (int16_t i=0; i0; i-=5) { 263 | display.fillTriangle(display.width()/2, display.height()/2-i, 264 | display.width()/2-i, display.height()/2+i, 265 | display.width()/2+i, display.height()/2+i, WHITE); 266 | if (color == WHITE) color = BLACK; 267 | else color = WHITE; 268 | display.display(); 269 | delay(1); 270 | } 271 | } 272 | 273 | void testdrawroundrect(void) { 274 | for (int16_t i=0; i=0; i-=4) { 320 | display.drawLine(0, display.height()-1, display.width()-1, i, WHITE); 321 | display.display(); 322 | delay(1); 323 | } 324 | delay(250); 325 | 326 | display.clearDisplay(); 327 | for (int16_t i=display.width()-1; i>=0; i-=4) { 328 | display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE); 329 | display.display(); 330 | delay(1); 331 | } 332 | for (int16_t i=display.height()-1; i>=0; i-=4) { 333 | display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE); 334 | display.display(); 335 | delay(1); 336 | } 337 | delay(250); 338 | 339 | display.clearDisplay(); 340 | for (int16_t i=0; i http://www.adafruit.com/category/63_98 6 | 7 | This example is for a 128x64 size display using SPI to communicate 8 | 4 or 5 pins are required to interface 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | // If using software SPI (the default case): 25 | #define OLED_MOSI 9 26 | #define OLED_CLK 10 27 | #define OLED_DC 11 28 | #define OLED_CS 12 29 | #define OLED_RESET 13 30 | Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); 31 | 32 | /* Uncomment this block to use hardware SPI 33 | #define OLED_DC 6 34 | #define OLED_CS 7 35 | #define OLED_RESET 8 36 | Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS); 37 | */ 38 | 39 | #define NUMFLAKES 10 40 | #define XPOS 0 41 | #define YPOS 1 42 | #define DELTAY 2 43 | 44 | #define LOGO16_GLCD_HEIGHT 16 45 | #define LOGO16_GLCD_WIDTH 16 46 | static const unsigned char PROGMEM logo16_glcd_bmp[] = 47 | { B00000000, B11000000, 48 | B00000001, B11000000, 49 | B00000001, B11000000, 50 | B00000011, B11100000, 51 | B11110011, B11100000, 52 | B11111110, B11111000, 53 | B01111110, B11111111, 54 | B00110011, B10011111, 55 | B00011111, B11111100, 56 | B00001101, B01110000, 57 | B00011011, B10100000, 58 | B00111111, B11100000, 59 | B00111111, B11110000, 60 | B01111100, B11110000, 61 | B01110000, B01110000, 62 | B00000000, B00110000 }; 63 | 64 | #if (SSD1306_LCDHEIGHT != 64) 65 | #error("Height incorrect, please fix Adafruit_SSD1306.h!"); 66 | #endif 67 | 68 | void setup() { 69 | Serial.begin(9600); 70 | 71 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) 72 | display.begin(SSD1306_SWITCHCAPVCC); 73 | // init done 74 | 75 | // Show image buffer on the display hardware. 76 | // Since the buffer is intialized with an Adafruit splashscreen 77 | // internally, this will display the splashscreen. 78 | display.display(); 79 | delay(2000); 80 | 81 | // Clear the buffer. 82 | display.clearDisplay(); 83 | 84 | // draw a single pixel 85 | display.drawPixel(10, 10, WHITE); 86 | // Show the display buffer on the hardware. 87 | // NOTE: You _must_ call display after making any drawing commands 88 | // to make them visible on the display hardware! 89 | display.display(); 90 | delay(2000); 91 | display.clearDisplay(); 92 | 93 | // draw many lines 94 | testdrawline(); 95 | display.display(); 96 | delay(2000); 97 | display.clearDisplay(); 98 | 99 | // draw rectangles 100 | testdrawrect(); 101 | display.display(); 102 | delay(2000); 103 | display.clearDisplay(); 104 | 105 | // draw multiple rectangles 106 | testfillrect(); 107 | display.display(); 108 | delay(2000); 109 | display.clearDisplay(); 110 | 111 | // draw mulitple circles 112 | testdrawcircle(); 113 | display.display(); 114 | delay(2000); 115 | display.clearDisplay(); 116 | 117 | // draw a white circle, 10 pixel radius 118 | display.fillCircle(display.width()/2, display.height()/2, 10, WHITE); 119 | display.display(); 120 | delay(2000); 121 | display.clearDisplay(); 122 | 123 | testdrawroundrect(); 124 | delay(2000); 125 | display.clearDisplay(); 126 | 127 | testfillroundrect(); 128 | delay(2000); 129 | display.clearDisplay(); 130 | 131 | testdrawtriangle(); 132 | delay(2000); 133 | display.clearDisplay(); 134 | 135 | testfilltriangle(); 136 | delay(2000); 137 | display.clearDisplay(); 138 | 139 | // draw the first ~12 characters in the font 140 | testdrawchar(); 141 | display.display(); 142 | delay(2000); 143 | display.clearDisplay(); 144 | 145 | // draw scrolling text 146 | testscrolltext(); 147 | delay(2000); 148 | display.clearDisplay(); 149 | 150 | // text display tests 151 | display.setTextSize(1); 152 | display.setTextColor(WHITE); 153 | display.setCursor(0,0); 154 | display.println("Hello, world!"); 155 | display.setTextColor(BLACK, WHITE); // 'inverted' text 156 | display.println(3.141592); 157 | display.setTextSize(2); 158 | display.setTextColor(WHITE); 159 | display.print("0x"); display.println(0xDEADBEEF, HEX); 160 | display.display(); 161 | delay(2000); 162 | display.clearDisplay(); 163 | 164 | // miniature bitmap display 165 | display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1); 166 | display.display(); 167 | 168 | // invert the display 169 | display.invertDisplay(true); 170 | delay(1000); 171 | display.invertDisplay(false); 172 | delay(1000); 173 | display.clearDisplay(); 174 | 175 | // draw a bitmap icon and 'animate' movement 176 | testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH); 177 | } 178 | 179 | 180 | void loop() { 181 | 182 | } 183 | 184 | 185 | void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) { 186 | uint8_t icons[NUMFLAKES][3]; 187 | 188 | // initialize 189 | for (uint8_t f=0; f< NUMFLAKES; f++) { 190 | icons[f][XPOS] = random(display.width()); 191 | icons[f][YPOS] = 0; 192 | icons[f][DELTAY] = random(5) + 1; 193 | 194 | Serial.print("x: "); 195 | Serial.print(icons[f][XPOS], DEC); 196 | Serial.print(" y: "); 197 | Serial.print(icons[f][YPOS], DEC); 198 | Serial.print(" dy: "); 199 | Serial.println(icons[f][DELTAY], DEC); 200 | } 201 | 202 | while (1) { 203 | // draw each icon 204 | for (uint8_t f=0; f< NUMFLAKES; f++) { 205 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, WHITE); 206 | } 207 | display.display(); 208 | delay(200); 209 | 210 | // then erase it + move it 211 | for (uint8_t f=0; f< NUMFLAKES; f++) { 212 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, BLACK); 213 | // move it 214 | icons[f][YPOS] += icons[f][DELTAY]; 215 | // if its gone, reinit 216 | if (icons[f][YPOS] > display.height()) { 217 | icons[f][XPOS] = random(display.width()); 218 | icons[f][YPOS] = 0; 219 | icons[f][DELTAY] = random(5) + 1; 220 | } 221 | } 222 | } 223 | } 224 | 225 | 226 | void testdrawchar(void) { 227 | display.setTextSize(1); 228 | display.setTextColor(WHITE); 229 | display.setCursor(0,0); 230 | 231 | for (uint8_t i=0; i < 168; i++) { 232 | if (i == '\n') continue; 233 | display.write(i); 234 | if ((i > 0) && (i % 21 == 0)) 235 | display.println(); 236 | } 237 | display.display(); 238 | } 239 | 240 | void testdrawcircle(void) { 241 | for (int16_t i=0; i0; i-=5) { 269 | display.fillTriangle(display.width()/2, display.height()/2-i, 270 | display.width()/2-i, display.height()/2+i, 271 | display.width()/2+i, display.height()/2+i, WHITE); 272 | if (color == WHITE) color = BLACK; 273 | else color = WHITE; 274 | display.display(); 275 | } 276 | } 277 | 278 | void testdrawroundrect(void) { 279 | for (int16_t i=0; i=0; i-=4) { 319 | display.drawLine(0, display.height()-1, display.width()-1, i, WHITE); 320 | display.display(); 321 | } 322 | delay(250); 323 | 324 | display.clearDisplay(); 325 | for (int16_t i=display.width()-1; i>=0; i-=4) { 326 | display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE); 327 | display.display(); 328 | } 329 | for (int16_t i=display.height()-1; i>=0; i-=4) { 330 | display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE); 331 | display.display(); 332 | } 333 | delay(250); 334 | 335 | display.clearDisplay(); 336 | for (int16_t i=0; i 5 | sentence=SSD1306 oled driver library for 'monochrome' 128x64 and 128x32 OLEDs! 6 | paragraph=SSD1306 oled driver library for 'monochrome' 128x64 and 128x32 OLEDs! 7 | category=Display 8 | url=https://github.com/adafruit/Adafruit_SSD1306 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/Adafruit_SSD1306/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2012, Adafruit Industries 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. Neither the name of the copyright holders nor the 14 | names of its contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## SparkFun Useful stuff 3 | ################# 4 | 5 | ## AVR Development 6 | *.eep 7 | *.elf 8 | *.lst 9 | *.lss 10 | *.sym 11 | *.d 12 | *.o 13 | *.srec 14 | *.map 15 | 16 | ## Notepad++ backup files 17 | *.bak 18 | 19 | ## BOM files 20 | *bom* 21 | 22 | ################# 23 | ## Eclipse 24 | ################# 25 | 26 | *.pydevproject 27 | .project 28 | .metadata 29 | bin/ 30 | tmp/ 31 | *.tmp 32 | *.bak 33 | *.swp 34 | *~.nib 35 | local.properties 36 | .classpath 37 | .settings/ 38 | .loadpath 39 | 40 | # External tool builders 41 | .externalToolBuilders/ 42 | 43 | # Locally stored "Eclipse launch configurations" 44 | *.launch 45 | 46 | # CDT-specific 47 | .cproject 48 | 49 | # PDT-specific 50 | .buildpath 51 | 52 | 53 | ############# 54 | ## Eagle 55 | ############# 56 | 57 | # Ignore the board and schematic backup files 58 | *.b#? 59 | *.s#? 60 | 61 | 62 | ################# 63 | ## Visual Studio 64 | ################# 65 | 66 | ## Ignore Visual Studio temporary files, build results, and 67 | ## files generated by popular Visual Studio add-ons. 68 | 69 | # User-specific files 70 | *.suo 71 | *.user 72 | *.sln.docstates 73 | 74 | # Build results 75 | [Dd]ebug/ 76 | [Rr]elease/ 77 | *_i.c 78 | *_p.c 79 | *.ilk 80 | *.meta 81 | *.obj 82 | *.pch 83 | *.pdb 84 | *.pgc 85 | *.pgd 86 | *.rsp 87 | *.sbr 88 | *.tlb 89 | *.tli 90 | *.tlh 91 | *.tmp 92 | *.vspscc 93 | .builds 94 | *.dotCover 95 | 96 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 97 | #packages/ 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opensdf 104 | *.sdf 105 | 106 | # Visual Studio profiler 107 | *.psess 108 | *.vsp 109 | 110 | # ReSharper is a .NET coding add-in 111 | _ReSharper* 112 | 113 | # Installshield output folder 114 | [Ee]xpress 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish 128 | 129 | # Others 130 | [Bb]in 131 | [Oo]bj 132 | sql 133 | TestResults 134 | *.Cache 135 | ClientBin 136 | stylecop.* 137 | ~$* 138 | *.dbmdl 139 | Generated_Code #added for RIA/Silverlight projects 140 | 141 | # Backup & report files from converting an old project file to a newer 142 | # Visual Studio version. Backup files are not needed, because we have git ;-) 143 | _UpgradeReport_Files/ 144 | Backup*/ 145 | UpgradeLog*.XML 146 | 147 | 148 | ############ 149 | ## Windows 150 | ############ 151 | 152 | # Windows image file caches 153 | Thumbs.db 154 | 155 | # Folder config file 156 | Desktop.ini 157 | 158 | 159 | ############# 160 | ## Python 161 | ############# 162 | 163 | *.py[co] 164 | 165 | # Packages 166 | *.egg 167 | *.egg-info 168 | dist 169 | build 170 | eggs 171 | parts 172 | bin 173 | var 174 | sdist 175 | develop-eggs 176 | .installed.cfg 177 | 178 | # Installer logs 179 | pip-log.txt 180 | 181 | # Unit test / coverage reports 182 | .coverage 183 | .tox 184 | 185 | #Translations 186 | *.mo 187 | 188 | #Mr Developer 189 | .mr.developer.cfg 190 | 191 | # Mac crap 192 | .DS_Store 193 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/LICENSE.md: -------------------------------------------------------------------------------- 1 | SparkFun License Information 2 | ============================ 3 | 4 | SparkFun uses two different licenses for our files -one for hardware and one for code. 5 | 6 | Hardware 7 | --------- 8 | 9 | **SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).** 10 | 11 | Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode). 12 | 13 | You are free to: 14 | 15 | Share — copy and redistribute the material in any medium or format 16 | Adapt — remix, transform, and build upon the material 17 | for any purpose, even commercially. 18 | The licensor cannot revoke these freedoms as long as you follow the license terms. 19 | Under the following terms: 20 | 21 | Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 22 | ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. 23 | No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 24 | Notices: 25 | 26 | You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation. 27 | No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material. 28 | 29 | 30 | Code 31 | -------- 32 | 33 | **SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT). ** 34 | 35 | The MIT License (MIT) 36 | 37 | Copyright (c) 2015 SparkFun Electronics 38 | 39 | Permission is hereby granted, free of charge, to any person obtaining a copy 40 | of this software and associated documentation files (the "Software"), to deal 41 | in the Software without restriction, including without limitation the rights 42 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 43 | copies of the Software, and to permit persons to whom the Software is 44 | furnished to do so, subject to the following conditions: 45 | 46 | The above copyright notice and this permission notice shall be included in all 47 | copies or substantial portions of the Software. 48 | 49 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 50 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 51 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 52 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 53 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 54 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 55 | SOFTWARE. 56 | 57 | 58 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/README.md: -------------------------------------------------------------------------------- 1 | SparkFun CAN-Bus Arduino Library 2 | ======================================== 3 | 4 | ![SparkFun CAN-Bus Shield](https://cdn.sparkfun.com//assets/parts/1/0/4/6/6/13262-01.jpg) 5 | 6 | [*SparkFun CAN-Bus Shield (DEV-13262)*](https://www.sparkfun.com/products/13262) 7 | 8 | Arduino library for using all features of the CAN-Bus Shield. 9 | 10 | Repository Contents 11 | ------------------- 12 | 13 | * **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE. 14 | * **/extras** - Additional documentation for the user. These files are ignored by the IDE. 15 | * **/src** - Source files for the library (.cpp, .h). 16 | * **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE. 17 | * **library.properties** - General library properties for the Arduino package manager. 18 | 19 | Documentation 20 | -------------- 21 | 22 | * **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library. 23 | * **[Product Repository](https://github.com/sparkfun/CAN-Bus_Shield)** - Main repository (including hardware files) for the CAN-Bus Shield. 24 | * **[Hookup Guide](https://learn.sparkfun.com/tutorials/can-bus-shield-hookup-guide)** - Basic hookup guide for the CAN-Bus Shield. 25 | 26 | Products that use this Library 27 | --------------------------------- 28 | 29 | * [DEV-13262](https://www.sparkfun.com/products/13262)- CAN-Bus Shield. 30 | 31 | 32 | License Information 33 | ------------------- 34 | 35 | This product is _**open source**_! 36 | 37 | Please review the LICENSE.md file for license information. 38 | 39 | If you have any questions or concerns on licensing, please contact techsupport@sparkfun.com. 40 | 41 | Distributed as-is; no warranty is given. 42 | 43 | - Your friends at SparkFun. 44 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/examples/CAN_Read_Demo/CAN_Read_Demo.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | CAN Read Demo for the SparkFun CAN Bus Shield. 3 | 4 | Written by Stephen McCoy. 5 | Original tutorial available here: http://www.instructables.com/id/CAN-Bus-Sniffing-and-Broadcasting-with-Arduino 6 | Used with permission 2016. License CC By SA. 7 | 8 | Distributed as-is; no warranty is given. 9 | *************************************************************************/ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | //********************************Setup Loop*********************************// 18 | 19 | void setup() { 20 | Serial.begin(9600); // For debug use 21 | Serial.println("CAN Read - Testing receival of CAN Bus message"); 22 | delay(1000); 23 | 24 | if(Canbus.init(CANSPEED_500)) //Initialise MCP2515 CAN controller at the specified speed 25 | Serial.println("CAN Init ok"); 26 | else 27 | Serial.println("Can't init CAN"); 28 | 29 | delay(1000); 30 | } 31 | 32 | //********************************Main Loop*********************************// 33 | 34 | void loop(){ 35 | 36 | tCAN message; 37 | if (mcp2515_check_message()) 38 | { 39 | if (mcp2515_get_message(&message)) 40 | { 41 | //if(message.id == 0x620 and message.data[2] == 0xFF) //uncomment when you want to filter 42 | //{ 43 | 44 | Serial.print("ID: "); 45 | Serial.print(message.id,HEX); 46 | Serial.print(", "); 47 | Serial.print("Data: "); 48 | Serial.print(message.header.length,DEC); 49 | for(int i=0;i 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | //********************************Setup Loop*********************************// 18 | 19 | void setup() { 20 | Serial.begin(9600); 21 | Serial.println("CAN Write - Testing transmission of CAN Bus messages"); 22 | delay(1000); 23 | 24 | if(Canbus.init(CANSPEED_500)) //Initialise MCP2515 CAN controller at the specified speed 25 | Serial.println("CAN Init ok"); 26 | else 27 | Serial.println("Can't init CAN"); 28 | 29 | delay(1000); 30 | } 31 | 32 | //********************************Main Loop*********************************// 33 | 34 | void loop() 35 | { 36 | tCAN message; 37 | 38 | message.id = 0x631; //formatted in HEX 39 | message.header.rtr = 0; 40 | message.header.length = 8; //formatted in DEC 41 | message.data[0] = 0x40; 42 | message.data[1] = 0x05; 43 | message.data[2] = 0x30; 44 | message.data[3] = 0xFF; //formatted in HEX 45 | message.data[4] = 0x00; 46 | message.data[5] = 0x40; 47 | message.data[6] = 0x00; 48 | message.data[7] = 0x00; 49 | 50 | mcp2515_bit_modify(CANCTRL, (1< 31 | char UserInput; 32 | int data; 33 | char buffer[456]; //Data will be temporarily stored to this buffer before being written to the file 34 | 35 | //********************************Setup Loop*********************************// 36 | 37 | void setup(){ 38 | Serial.begin(9600); 39 | Serial.println("CAN-Bus Demo"); 40 | 41 | if(Canbus.init(CANSPEED_500)) /* Initialise MCP2515 CAN controller at the specified speed */ 42 | { 43 | Serial.println("CAN Init ok"); 44 | } else 45 | { 46 | Serial.println("Can't init CAN"); 47 | } 48 | 49 | delay(1000); 50 | 51 | Serial.println("Please choose a menu option."); 52 | Serial.println("1.Speed"); 53 | Serial.println("2.RPM"); 54 | Serial.println("3.Throttle"); 55 | Serial.println("4.Coolant Temperature"); 56 | Serial.println("5.O2 Voltage"); 57 | Serial.println("6.MAF Sensor"); 58 | 59 | } 60 | 61 | 62 | 63 | //********************************Main Loop*********************************// 64 | 65 | void loop(){ 66 | 67 | while(Serial.available()){ 68 | UserInput = Serial.read(); 69 | 70 | if (UserInput=='1'){ 71 | Canbus.ecu_req(VEHICLE_SPEED, buffer); 72 | Serial.print("Vehicle Speed: "); 73 | Serial.println(buffer); 74 | delay(500); 75 | } 76 | else if (UserInput=='2'){ 77 | Canbus.ecu_req(ENGINE_RPM, buffer); 78 | Serial.print("Engine RPM: "); 79 | Serial.println(buffer); 80 | delay(500); 81 | 82 | } 83 | else if (UserInput=='3'){ 84 | Canbus.ecu_req(THROTTLE, buffer); 85 | Serial.print("Throttle: "); 86 | Serial.println(buffer); 87 | delay(500); 88 | 89 | } 90 | else if (UserInput=='4'){ 91 | Canbus.ecu_req(ENGINE_COOLANT_TEMP, buffer); 92 | Serial.print("Engine Coolant Temp: "); 93 | Serial.println(buffer); 94 | delay(500); 95 | 96 | } 97 | else if (UserInput=='5'){ 98 | Canbus.ecu_req(O2_VOLTAGE, buffer); 99 | Serial.print("O2 Voltage: "); 100 | Serial.println(buffer); 101 | delay(500); 102 | 103 | } 104 | else if (UserInput=='6'){ 105 | Canbus.ecu_req(MAF_SENSOR, buffer); 106 | Serial.print("MAF Sensor: "); 107 | Serial.println(buffer); 108 | delay(500); 109 | 110 | } 111 | else 112 | { 113 | Serial.println(UserInput); 114 | Serial.println("Not a valid input."); 115 | Serial.println("Please enter a valid option."); 116 | } 117 | 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/examples/SparkFun_ECU_Demo/SparkFun_ECU_Demo.ino: -------------------------------------------------------------------------------- 1 | 2 | /**************************************************************************** 3 | ECU CAN-Bus Reader and Logger 4 | 5 | Toni Klopfenstein @ SparkFun Electronics 6 | September 2015 7 | https://github.com/sparkfun/CAN-Bus_Shield 8 | 9 | This example sketch works with the CAN-Bus shield from SparkFun Electronics. 10 | 11 | It enables reading of the MCP2515 CAN controller and MCP2551 CAN-Bus driver. 12 | This sketch also enables logging of GPS data, and output to a serial-enabled LCD screen. 13 | All data is logged to the uSD card. 14 | 15 | Resources: 16 | Additional libraries to install for functionality of sketch. 17 | -SD library by William Greiman. https://github.com/greiman/SdFat 18 | 19 | Development environment specifics: 20 | Developed for Arduino 1.65 21 | 22 | Based off of original example ecu_reader_logger by: 23 | Sukkin Pang 24 | SK Pang Electronics www.skpang.co.uk 25 | 26 | This code is beerware; if you see me (or any other SparkFun employee) at the local, 27 | and you've found our code helpful, please buy us a round! 28 | 29 | For the official license, please check out the license file included with the library. 30 | 31 | Distributed as-is; no warranty is given. 32 | *************************************************************************/ 33 | 34 | //Include necessary libraries for compilation 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | //Initialize uSD pins 42 | const int chipSelect = 9; 43 | 44 | 45 | //Initialize lcd pins 46 | SoftwareSerial lcd(3, 6); 47 | 48 | //Initialize GPS pins 49 | SoftwareSerial uart_gps(4,5); 50 | 51 | // Define Joystick connection pins 52 | #define UP A1 53 | #define DOWN A3 54 | #define LEFT A2 55 | #define RIGHT A5 56 | #define CLICK A4 57 | 58 | //Define LED pins 59 | #define LED2 8 60 | #define LED3 7 61 | 62 | //Define baud rates. GPS should be slower than serial to ensure valid sentences coming through 63 | #define GPSRATE 4800 64 | #define LCD_Rate 115200 65 | 66 | //Create instance of TinyGPS 67 | TinyGPS gps; 68 | 69 | //Declare prototype for TinyGPS library functions 70 | void getgps(TinyGPS &gps); 71 | 72 | //Declare GPS variables 73 | float latitude; 74 | float longitude; 75 | int year; 76 | byte month; 77 | byte day; 78 | byte hour; 79 | byte minute; 80 | byte second; 81 | byte hundredths; 82 | float gps_speed; 83 | 84 | 85 | //Declare SD File 86 | File dataFile; 87 | 88 | //Declare CAN variables for communication 89 | char *EngineRPM; 90 | char buffer[64]; //Data will be temporarily stored to this buffer before being written to the file 91 | 92 | //Define LCD Positions 93 | #define COMMAND 0xFE 94 | #define CLEAR 0x01 95 | #define LINE1 0x80 96 | #define LINE2 0xC0 97 | 98 | 99 | //********************************Setup Loop*********************************// 100 | void setup() { 101 | //Initialize Serial communication for debugging 102 | Serial.begin(9600); 103 | Serial.println("ECU Demo"); 104 | 105 | //Begin LCD serial communication 106 | lcd.begin(9600); 107 | 108 | //Begin GPS communcation 109 | uart_gps.begin(GPSRATE); 110 | 111 | //Initialize pins as necessary 112 | pinMode(chipSelect, OUTPUT); 113 | pinMode(CLICK,INPUT); 114 | pinMode(LED2, OUTPUT); 115 | pinMode(LED3, OUTPUT); 116 | 117 | //Pull analog pins high to enable reading of joystick movements 118 | digitalWrite(CLICK, HIGH); 119 | 120 | //Write LED pins low to turn them off by default 121 | digitalWrite(LED2, LOW); 122 | digitalWrite(LED3, LOW); 123 | 124 | //Initialize CAN Controller 125 | if(Canbus.init(CANSPEED_500)) /* Initialize MCP2515 CAN controller at the specified speed */ 126 | { 127 | clear_lcd(); 128 | lcd.print("CAN Init ok"); 129 | Serial.println("CAN Init Ok"); 130 | delay(1500); 131 | } 132 | else 133 | { 134 | lcd.print("Can't init CAN"); 135 | Serial.println("Can't init CAN"); 136 | return; 137 | } 138 | 139 | //Check if uSD card initialized 140 | if (!SD.begin(chipSelect)) { 141 | Serial.println("uSD card failed to initialize, or is not present"); 142 | clear_lcd(); 143 | lcd.print("uSD failed."); 144 | return; 145 | } 146 | else{ 147 | Serial.println("uSD card initialized."); 148 | clear_lcd(); 149 | lcd.print("uSD success!"); 150 | delay(1500); 151 | } 152 | 153 | //Print menu to LCD screen 154 | clear_lcd(); 155 | lcd.print("Click to begin"); 156 | lcd.write(COMMAND); 157 | lcd.write(LINE2); 158 | lcd.print("Logging Data"); 159 | 160 | while(digitalRead(CLICK)==HIGH) 161 | { 162 | //Wait for user to click joystick to begin logging 163 | } 164 | 165 | delay(1000); 166 | 167 | } 168 | 169 | //********************************Main Loop*********************************// 170 | void loop(){ 171 | 172 | while(digitalRead(CLICK)==HIGH){ 173 | 174 | digitalWrite(LED3, HIGH); //Turn on LED to indicate CAN Bus traffic 175 | 176 | Canbus.ecu_req(ENGINE_RPM,buffer); //Request engine RPM 177 | EngineRPM = buffer; 178 | Serial.print("Engine RPM: "); //Uncomment for Serial debugging 179 | Serial.println(buffer); 180 | delay(100); 181 | 182 | 183 | digitalWrite(LED3, LOW); //Turn off LED3 184 | delay(500); 185 | 186 | File dataFile = SD.open("data.txt", FILE_WRITE); //Open uSD file to log data 187 | 188 | //If data file can't be opened, throw error. 189 | if (!dataFile){ 190 | clear_lcd(); 191 | lcd.print("Error opening"); 192 | lcd.write(COMMAND); 193 | lcd.write(LINE2); 194 | lcd.print("data.txt"); 195 | while(1); 196 | } 197 | 198 | clear_lcd(); 199 | lcd.print("Logging.Click"); 200 | lcd.write(COMMAND); 201 | lcd.write(LINE2); 202 | lcd.print("to stop logging"); 203 | 204 | if(uart_gps.available()) // While there is data on the RX pin... 205 | { 206 | digitalWrite(LED2, HIGH); //Signal on D8 that GPS data received. 207 | 208 | //Print Latitude/Longitude to SD card 209 | dataFile.print("Lat/Long: "); 210 | dataFile.print(latitude,5); 211 | dataFile.print(", "); 212 | dataFile.println(longitude,5); 213 | 214 | // Print data and time to SD card 215 | dataFile.print("Date: "); dataFile.print(month, DEC); dataFile.print("/"); 216 | dataFile.print(day, DEC); dataFile.print("/"); dataFile.print(year); 217 | dataFile.print(" Time: "); dataFile.print(hour, DEC); dataFile.print(":"); 218 | dataFile.print(minute, DEC); dataFile.print(":"); dataFile.print(second, DEC); 219 | dataFile.print("."); dataFile.println(hundredths, DEC); 220 | 221 | //Print GPS speed to SD card 222 | dataFile.print("GPS Speed(kmph): "); 223 | dataFile.println(gps_speed); 224 | 225 | digitalWrite(LED2, LOW); //Turn off D8 LED. 226 | } 227 | 228 | dataFile.print("Engine RPM: "); 229 | dataFile.println(EngineRPM); 230 | 231 | dataFile.println(); 232 | dataFile.flush(); 233 | dataFile.close(); //Close data logging file 234 | } 235 | clear_lcd(); 236 | lcd.print("Logging stopped."); 237 | while(1); //Stop logging if joystick is clicked 238 | 239 | } 240 | 241 | //********************************LCD Functions*********************************// 242 | void clear_lcd(void) 243 | { 244 | lcd.write(COMMAND); 245 | lcd.write(CLEAR); 246 | } 247 | 248 | //********************************GPS Functions*********************************// 249 | void getgps(TinyGPS &gps) 250 | { 251 | // Receive GPS latitude/longitude 252 | gps.f_get_position(&latitude, &longitude); 253 | 254 | //Call function to receive date and time from GPS 255 | gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths); 256 | 257 | //Also collect gps_speed 258 | gps_speed = gps.f_speed_kmph(); 259 | 260 | } 261 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/examples/SparkFun_GPS_Demo/SparkFun_GPS_Demo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 6-8-10 3 | Aaron Weiss 4 | SparkFun Electronics 5 | 6 | Example GPS Parser based off of arduiniana.org TinyGPS examples. 7 | 8 | Parses NMEA sentences from an EM406 running at 4800bps into readable 9 | values for latitude, longitude, elevation, date, time, course, and 10 | speed. 11 | 12 | For the SparkFun GPS Shield. Make sure the switch is set to DLINE. 13 | 14 | Once you get your longitude and latitude you can paste your 15 | coordinates from the terminal window into Google Maps. Here is the 16 | link for SparkFun's location. 17 | http://maps.google.com/maps?q=40.06477,+-105.20997 18 | 19 | Uses the NewSoftSerial library for serial communication with your GPS, 20 | so connect your GPS TX and RX pin to any digital pin on the Arduino, 21 | just be sure to define which pins you are using on the Arduino to 22 | communicate with the GPS module. 23 | 24 | REVISIONS: 25 | 1-17-11 26 | changed values to RXPIN = 2 and TXPIN = to correspond with 27 | hardware v14+. Hardware v13 used RXPIN = 3 and TXPIN = 2. 28 | 29 | */ 30 | 31 | // In order for this sketch to work, you will need to download 32 | // TinyGPS library from arduiniana.org and put them 33 | // into the hardware->libraries folder in your ardiuno directory. 34 | #include 35 | #include 36 | 37 | // Define which pins you will use on the Arduino to communicate with your 38 | // GPS. In this case, the GPS module's TX pin will connect to the 39 | // Arduino's RXPIN which is pin 3. 40 | #define RXPIN 4 41 | #define TXPIN 5 42 | //Set this value equal to the baud rate of your GPS 43 | #define GPSBAUD 4800 44 | 45 | // Create an instance of the TinyGPS object 46 | TinyGPS gps; 47 | // Initialize the NewSoftSerial library to the pins you defined above 48 | SoftwareSerial uart_gps(RXPIN, TXPIN); 49 | 50 | // This is where you declare prototypes for the functions that will be 51 | // using the TinyGPS library. 52 | void getgps(TinyGPS &gps); 53 | 54 | // In the setup function, you need to initialize two serial ports; the 55 | // standard hardware serial port (Serial()) to communicate with your 56 | // terminal program an another serial port (NewSoftSerial()) for your 57 | // GPS. 58 | void setup() 59 | { 60 | // This is the serial rate for your terminal program. It must be this 61 | // fast because we need to print everything before a new sentence 62 | // comes in. If you slow it down, the messages might not be valid and 63 | // you will likely get checksum errors. 64 | Serial.begin(115200); 65 | //Sets baud rate of your GPS 66 | uart_gps.begin(GPSBAUD); 67 | 68 | Serial.println(""); 69 | Serial.println("GPS Shield QuickStart Example Sketch v12"); 70 | Serial.println(" ...waiting for lock... "); 71 | Serial.println(""); 72 | } 73 | 74 | // This is the main loop of the code. All it does is check for data on 75 | // the RX pin of the ardiuno, makes sure the data is valid NMEA sentences, 76 | // then jumps to the getgps() function. 77 | void loop() 78 | { 79 | while(uart_gps.available()) // While there is data on the RX pin... 80 | { 81 | int c = uart_gps.read(); // load the data into a variable... 82 | if(gps.encode(c)) // if there is a new valid sentence... 83 | { 84 | getgps(gps); // then grab the data. 85 | } 86 | } 87 | } 88 | 89 | // The getgps function will get and print the values we want. 90 | void getgps(TinyGPS &gps) 91 | { 92 | // To get all of the data into varialbes that you can use in your code, 93 | // all you need to do is define variables and query the object for the 94 | // data. To see the complete list of functions see keywords.txt file in 95 | // the TinyGPS and NewSoftSerial libs. 96 | 97 | // Define the variables that will be used 98 | float latitude, longitude; 99 | // Then call this function 100 | gps.f_get_position(&latitude, &longitude); 101 | // You can now print variables latitude and longitude 102 | Serial.print("Lat/Long: "); 103 | Serial.print(latitude,5); 104 | Serial.print(", "); 105 | Serial.println(longitude,5); 106 | 107 | // Same goes for date and time 108 | int year; 109 | byte month, day, hour, minute, second, hundredths; 110 | gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths); 111 | // Print data and time 112 | Serial.print("Date: "); Serial.print(month, DEC); Serial.print("/"); 113 | Serial.print(day, DEC); Serial.print("/"); Serial.print(year); 114 | Serial.print(" Time: "); Serial.print(hour, DEC); Serial.print(":"); 115 | Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC); 116 | Serial.print("."); Serial.println(hundredths, DEC); 117 | //Since month, day, hour, minute, second, and hundr 118 | 119 | // Here you can print the altitude and course values directly since 120 | // there is only one value for the function 121 | Serial.print("Altitude (meters): "); Serial.println(gps.f_altitude()); 122 | // Same goes for course 123 | Serial.print("Course (degrees): "); Serial.println(gps.f_course()); 124 | // And same goes for speed 125 | Serial.print("Speed(kmph): "); Serial.println(gps.f_speed_kmph()); 126 | Serial.println(); 127 | 128 | // Here you can print statistics on the sentences. 129 | unsigned long chars; 130 | unsigned short sentences, failed_checksum; 131 | gps.stats(&chars, &sentences, &failed_checksum); 132 | //Serial.print("Failed Checksums: ");Serial.print(failed_checksum); 133 | //Serial.println(); Serial.println(); 134 | } 135 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/examples/SparkFun_Joystick_Demo/SparkFun_Joystick_Demo.ino: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Toni Klopfenstein @ SparkFun Electronics 3 | September 2015 4 | https://github.com/sparkfun/CAN-Bus_Shield 5 | 6 | This example sketch works with the CAN-Bus shield from SparkFun Electronics. 7 | 8 | It reads the joystick for user inputs. 9 | 10 | Based off of joystick_demo.pde by Sukkin Pang. 11 | Original file available at http://skpang.co.uk/catalog/arduino-canbus-shield-with-usd-card-holder-p-706.html 12 | 13 | This code is beerware; if you see me (or any other SparkFun employee) at the local, 14 | and you've found our code helpful, please buy us a round! 15 | 16 | For the official license, please check out the license file included with the library. 17 | 18 | Distributed as-is; no warranty is given. 19 | ********************************************************************************/ 20 | 21 | 22 | /* Define Joystick connection pins */ 23 | #define UP A1 24 | #define DOWN A3 25 | #define LEFT A2 26 | #define RIGHT A5 27 | #define CLICK A4 28 | 29 | 30 | void setup() { 31 | //Initialize analog pins as inputs 32 | pinMode(UP,INPUT); 33 | pinMode(DOWN,INPUT); 34 | pinMode(LEFT,INPUT); 35 | pinMode(RIGHT,INPUT); 36 | pinMode(CLICK,INPUT); 37 | 38 | //Pull analog pins high to enable reading of joystick movements 39 | digitalWrite(UP, HIGH); 40 | digitalWrite(DOWN, HIGH); 41 | digitalWrite(LEFT, HIGH); 42 | digitalWrite(RIGHT, HIGH); 43 | digitalWrite(CLICK, HIGH); 44 | 45 | //Initialize serial terminal connection 46 | Serial.begin(9600); 47 | Serial.println("Joystick Demo"); 48 | 49 | } 50 | 51 | 52 | 53 | void loop() { 54 | 55 | //Scan analog pins. If pin reads low, print the corresponding joystick movement. 56 | if (digitalRead(UP) == 0) { 57 | Serial.println("Up");} 58 | 59 | if (digitalRead(DOWN) == 0) { 60 | Serial.println("Down");} 61 | 62 | if (digitalRead(LEFT) == 0) { 63 | Serial.println("Left");} 64 | 65 | if (digitalRead(RIGHT) == 0) { 66 | Serial.println("Right");} 67 | 68 | if (digitalRead(CLICK) == 0) { 69 | Serial.println("Click");} 70 | delay(250); 71 | 72 | } 73 | 74 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/examples/SparkFun_SD_Demo/SparkFun_SD_Demo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | created 24 Nov 2010 3 | modified 9 Apr 2012 4 | by Tom Igoe 5 | 6 | modified 18 Sep 2014 7 | by Bobby Chan @ SparkFun Electronics Inc. 8 | 9 | Modified by Toni Klopfenstein @ SparkFun Electronics 10 | September 2015 11 | https://github.com/sparkfun/CAN-Bus_Shield 12 | 13 | SD Card Datalogger 14 | 15 | This example is based off an example code from Arduino's site 16 | http://arduino.cc/en/Tutorial/Datalogger and it shows how to 17 | log data from three analog sensors with a timestamp based on when 18 | the Arduino began running the current program to an SD card using 19 | the SD library https://github.com/greiman/SdFat by William 20 | Greiman. This example code also includes an output to the 21 | Serial Monitor for debugging. 22 | 23 | The circuit: 24 | * analog sensors on analog pins 0, 1, and 2 25 | * SD card attached to SPI bus as follows: 26 | ** MOSI - pin 11 27 | ** MISO - pin 12 28 | ** CLK - pin 13 29 | ** CS - pin 4 30 | 31 | This example code is in the public domain. 32 | */ 33 | 34 | #include 35 | #include 36 | 37 | // On the Ethernet Shield, CS is pin 4. Note that even if it's not 38 | // used as the CS pin, the hardware CS pin (10 on most Arduino boards, 39 | // 53 on the Mega) must be left as an output or the SD library 40 | // functions will not work. 41 | 42 | // Chip Select pin is tied to pin 9 on the SparkFun CAN-Bus Shield 43 | const int chipSelect = 9; 44 | 45 | void setup() 46 | { 47 | // Open serial communications and wait for port to open: 48 | Serial.begin(9600); 49 | while (!Serial) { 50 | ; // wait for serial port to connect. Needed for Leonardo only 51 | } 52 | 53 | Serial.print("Initializing SD card..."); 54 | // make sure that the default chip select pin is set to 55 | // output, even if you don't use it: 56 | pinMode(chipSelect, OUTPUT); 57 | 58 | // see if the card is present and can be initialized: 59 | if (!SD.begin(chipSelect)) { 60 | Serial.println("Card failed, or not present"); 61 | // don't do anything more: 62 | return; 63 | } 64 | Serial.println("card initialized."); 65 | } 66 | 67 | void loop() 68 | { 69 | // make a string for assembling the data to log: 70 | String dataString = ""; 71 | 72 | // open the file. note that only one file can be open at a time, 73 | // so you have to close this one before opening another. 74 | // this opens the file and appends to the end of file 75 | // if the file does not exist, this will create a new file. 76 | File dataFile = SD.open("datalog.txt", FILE_WRITE); 77 | 78 | // if the file is available, write to it: 79 | if (dataFile) { 80 | int timeStamp = millis(); 81 | //write to uSD card 82 | dataFile.print(timeStamp); 83 | dataFile.print(" ms"); 84 | dataFile.print(", "); 85 | //output also on Serial monitor for debugging 86 | Serial.print(timeStamp); 87 | Serial.print(","); 88 | 89 | // read three sensors on A0, A1, and A2 while appending to the string: 90 | for (int analogPin = 0; analogPin < 3; analogPin++) 91 | { 92 | int sensorVal = analogRead(analogPin); 93 | //write analog sensor data to uSD card 94 | dataFile.print(" Analog Pin A"); 95 | dataFile.print(analogPin); 96 | dataFile.print(" = "); 97 | dataFile.print(sensorVal); 98 | //output also on Serial monitor for debugging 99 | Serial.print(" Analog Pin A"); 100 | Serial.print(analogPin); 101 | Serial.print(" = "); 102 | Serial.print(sensorVal); 103 | //place comma between the analog sensor data 104 | if (analogPin < 3) 105 | { 106 | dataString += ","; 107 | } 108 | } 109 | dataFile.println(); //create a new row to read data more clearly 110 | dataFile.close(); //close file 111 | Serial.println(); //print to the serial port too: 112 | 113 | } 114 | // if the file isn't open, pop up an error: 115 | else 116 | { 117 | Serial.println("error opening datalog.txt"); 118 | 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/examples/SparkFun_SerialLCD_Demo/SparkFun_SerialLCD_Demo.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | SparkFun Serial LCD example 1 3 | Clear the display and say "Hello World!" 4 | 5 | This sketch is for Arduino versions 1.0 and later 6 | If you're using an Arduino version older than 1.0, use 7 | the other example code available on the tutorial page. 8 | 9 | Modified: 10 | 11 | Toni Klopfenstein @ SparkFun Electronics 12 | September 2015 13 | https://github.com/sparkfun/CAN-Bus_Shield 14 | 15 | This code is beerware; if you see me (or any other SparkFun employee) at the local, 16 | and you've found our code helpful, please buy us a round! 17 | 18 | For the official license, please check out the license file included with the library. 19 | 20 | Distributed as-is; no warranty is given. 21 | *************************************************************************/ 22 | #include //LCD screen connects via Software Serial to 23 | //prevent display corruption 24 | 25 | // Attach the serial display's RX line to digital pin 6 for connection 26 | //on the CAN-Bus shield 27 | 28 | SoftwareSerial mySerial(3,6); // pin 6 = TX, pin 3 = RX (unused) 29 | 30 | 31 | void setup() 32 | { 33 | mySerial.begin(9600); // set up serial port for 9600 baud 34 | delay(500); // wait for display to boot up 35 | } 36 | 37 | void loop() 38 | { 39 | mySerial.write(254); // move cursor to beginning of first line 40 | mySerial.write(128); 41 | 42 | mySerial.write(" "); // clear display 43 | mySerial.write(" "); 44 | 45 | mySerial.write(254); // move cursor to beginning of first line 46 | mySerial.write(128); 47 | 48 | mySerial.write("Hello, world!"); 49 | 50 | while(1); // wait forever 51 | } 52 | 53 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For DmxSimple 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Canbus KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | init KEYWORD2 16 | maxChannel KEYWORD2 17 | usePin KEYWORD2 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | 23 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Canbus", 3 | "keywords": "can, bus, mcp2515, MCP-2515", 4 | "description": "Library provies basic functionality of all hardware features on the CAN-Bus Shield (CAN communication, serial LCD functionality, uSD logging, GPS tracking, and joystick input).", 5 | "authors": [ 6 | { 7 | "name": "SparkFun Electronics", 8 | "maintainer": true 9 | }, 10 | { 11 | "name": "Sukking Pang", 12 | "url": "http://skpang.co.uk/" 13 | }, 14 | { 15 | "name": "Fabian Greif" 16 | } 17 | ], 18 | "repository": 19 | { 20 | "type": "git", 21 | "url": "https://github.com/aaronmitti/SparkFun_CAN-Bus_Arduino_Library.git" 22 | }, 23 | "version": "5.1.0", 24 | "frameworks": "arduino", 25 | "platforms": "*" 26 | } 27 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/library.properties: -------------------------------------------------------------------------------- 1 | name=SparkFun CAN-Bus 2 | version=5.1.0 3 | author=SparkFun , Sukking Pang 4 | maintainer=SparkFun Electronics 5 | sentence=Library provies basic functionality of all hardware features on the CAN-Bus Shield. 6 | paragraph=ALlows user to leverage CAN communication, serial LCD functionality, uSD logging, GPS tracking, and joystick input. 7 | category=Other 8 | url=https://github.com/sparkfun/SparkFun_CAN-Bus_Arduino_Library 9 | architectures=avr -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/src/Canbus.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * 4 | * Copyright (c) 2008-2009 All rights reserved. 5 | */ 6 | 7 | #if ARDUINO>=100 8 | #include // Arduino 1.0 9 | #else 10 | #include // Arduino 0022 11 | #endif 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "pins_arduino.h" 20 | #include 21 | #include "global.h" 22 | #include "mcp2515.h" 23 | #include "defaults.h" 24 | #include "Canbus.h" 25 | 26 | /* C++ wrapper */ 27 | CanbusClass::CanbusClass() { 28 | 29 | } 30 | 31 | char CanbusClass::message_rx(unsigned char *buffer) { 32 | tCAN message; 33 | 34 | if (mcp2515_check_message()) { 35 | // Lese die Nachricht aus dem Puffern des MCP2515 36 | if (mcp2515_get_message(&message)) { 37 | buffer[0] = message.data[0]; 38 | buffer[1] = message.data[1]; 39 | buffer[2] = message.data[2]; 40 | buffer[3] = message.data[3]; 41 | buffer[4] = message.data[4]; 42 | buffer[5] = message.data[5]; 43 | buffer[6] = message.data[6]; 44 | buffer[7] = message.data[7]; 45 | } 46 | else { 47 | // PRINT("Kann die Nachricht nicht auslesen\n\n"); 48 | } 49 | } 50 | } 51 | 52 | char CanbusClass::message_tx(void) { 53 | tCAN message; 54 | 55 | // einige Testwerte 56 | message.id = 0x7DF; 57 | message.header.rtr = 0; 58 | message.header.length = 8; 59 | message.data[0] = 0x02; 60 | message.data[1] = 0x01; 61 | message.data[2] = 0x05; 62 | message.data[3] = 0x00; 63 | message.data[4] = 0x00; 64 | message.data[5] = 0x00; 65 | message.data[6] = 0x00; 66 | message.data[7] = 0x00; 67 | 68 | mcp2515_bit_modify(CANCTRL, (1< 30 | #include 31 | 32 | #if ARDUINO>=100 33 | #include // Arduino 1.0 34 | #else 35 | #include // Arduino 0022 36 | #endif 37 | #include 38 | #include 39 | 40 | #include "global.h" 41 | #include "mcp2515.h" 42 | #include "mcp2515_defs.h" 43 | 44 | 45 | #include "defaults.h" 46 | 47 | // ------------------------------------------------------------------------- 48 | // Schreibt/liest ein Byte ueber den Hardware SPI Bus 49 | 50 | uint8_t spi_putc( uint8_t data ) 51 | { 52 | // put byte in send-buffer 53 | SPDR = data; 54 | 55 | // wait until byte was send 56 | while( !( SPSR & (1< is the chip accessible? 175 | if (mcp2515_read_register(CNF1) != speed) { 176 | SET(LED2_HIGH); 177 | 178 | return false; 179 | } 180 | 181 | // deaktivate the RXnBF Pins (High Impedance State) 182 | mcp2515_write_register(BFPCTRL, 0); 183 | 184 | // set TXnRTS as inputs 185 | mcp2515_write_register(TXRTSCTRL, 0); 186 | 187 | // turn off filters => receive any message 188 | mcp2515_write_register(RXB0CTRL, (1<id = (uint16_t) spi_putc(0xff) << 3; 244 | message->id |= spi_putc(0xff) >> 5; 245 | 246 | spi_putc(0xff); 247 | spi_putc(0xff); 248 | 249 | // read DLC 250 | uint8_t length = spi_putc(0xff) & 0x0f; 251 | 252 | message->header.length = length; 253 | message->header.rtr = (bit_is_set(status, 3)) ? 1 : 0; 254 | 255 | // read data 256 | for (t=0;tdata[t] = spi_putc(0xff); 258 | } 259 | SET(MCP2515_CS); 260 | 261 | // clear interrupt flag 262 | if (bit_is_set(status, 6)) { 263 | mcp2515_bit_modify(CANINTF, (1< could not send message 298 | return 0; 299 | } 300 | 301 | RESET(MCP2515_CS); 302 | spi_putc(SPI_WRITE_TX | address); 303 | 304 | spi_putc(message->id >> 3); 305 | spi_putc(message->id << 5); 306 | 307 | spi_putc(0); 308 | spi_putc(0); 309 | 310 | uint8_t length = message->header.length & 0x0f; 311 | 312 | if (message->header.rtr) { 313 | // a rtr-frame has a length, but contains no data 314 | spi_putc((1<data[t]); 323 | } 324 | } 325 | SET(MCP2515_CS); 326 | 327 | _delay_us(1); 328 | 329 | // send message 330 | RESET(MCP2515_CS); 331 | address = (address == 0) ? 1 : address; 332 | spi_putc(SPI_RTS | address); 333 | SET(MCP2515_CS); 334 | 335 | return address; 336 | } 337 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/src/mcp2515.h: -------------------------------------------------------------------------------- 1 | #ifndef MCP2515_H 2 | #define MCP2515_H 3 | 4 | // ---------------------------------------------------------------------------- 5 | /* Copyright (c) 2007 Fabian Greif 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | // ---------------------------------------------------------------------------- 31 | 32 | #include 33 | 34 | #include "mcp2515_defs.h" 35 | #include "global.h" 36 | #ifdef __cplusplus 37 | 38 | extern "C" 39 | { 40 | 41 | 42 | #endif 43 | // ---------------------------------------------------------------------------- 44 | typedef struct 45 | { 46 | uint16_t id; 47 | struct { 48 | int8_t rtr : 1; 49 | uint8_t length : 4; 50 | } header; 51 | uint8_t data[8]; 52 | } tCAN; 53 | 54 | // ---------------------------------------------------------------------------- 55 | uint8_t spi_putc( uint8_t data ); 56 | 57 | // ---------------------------------------------------------------------------- 58 | void mcp2515_write_register( uint8_t adress, uint8_t data ); 59 | 60 | // ---------------------------------------------------------------------------- 61 | uint8_t mcp2515_read_register(uint8_t adress); 62 | 63 | // ---------------------------------------------------------------------------- 64 | void mcp2515_bit_modify(uint8_t adress, uint8_t mask, uint8_t data); 65 | 66 | // ---------------------------------------------------------------------------- 67 | uint8_t mcp2515_read_status(uint8_t type); 68 | 69 | // ---------------------------------------------------------------------------- 70 | 71 | uint8_t mcp2515_init(uint8_t speed); 72 | 73 | // ---------------------------------------------------------------------------- 74 | // check if there are any new messages waiting 75 | uint8_t mcp2515_check_message(void); 76 | 77 | // ---------------------------------------------------------------------------- 78 | // check if there is a free buffer to send messages 79 | uint8_t mcp2515_check_free_buffer(void); 80 | 81 | // ---------------------------------------------------------------------------- 82 | uint8_t mcp2515_get_message(tCAN *message); 83 | 84 | // ---------------------------------------------------------------------------- 85 | uint8_t mcp2515_send_message(tCAN *message); 86 | 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif // MCP2515_H 93 | -------------------------------------------------------------------------------- /libraries/SparkFun_CAN-Bus_Arduino_Library/src/mcp2515_defs.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef MCP2515_DEFS_H 3 | #define MCP2515_DEFS_H 4 | 5 | /** \name SPI Kommandos */ 6 | /*@{*/ 7 | #define SPI_RESET 0xC0 8 | #define SPI_READ 0x03 9 | #define SPI_READ_RX 0x90 10 | #define SPI_WRITE 0x02 11 | #define SPI_WRITE_TX 0x40 12 | #define SPI_RTS 0x80 13 | #define SPI_READ_STATUS 0xA0 14 | #define SPI_RX_STATUS 0xB0 15 | #define SPI_BIT_MODIFY 0x05 16 | /*@}*/ 17 | 18 | /** \name Adressen der Register des MCP2515 19 | * 20 | * Die Redundanten Adressen von z.B. dem Register CANSTAT 21 | * (0x0E, 0x1E, 0x2E, ...) wurden dabei nicht mit aufgelistet. 22 | */ 23 | /*@{*/ 24 | #define RXF0SIDH 0x00 25 | #define RXF0SIDL 0x01 26 | #define RXF0EID8 0x02 27 | #define RXF0EID0 0x03 28 | #define RXF1SIDH 0x04 29 | #define RXF1SIDL 0x05 30 | #define RXF1EID8 0x06 31 | #define RXF1EID0 0x07 32 | #define RXF2SIDH 0x08 33 | #define RXF2SIDL 0x09 34 | #define RXF2EID8 0x0A 35 | #define RXF2EID0 0x0B 36 | #define BFPCTRL 0x0C 37 | #define TXRTSCTRL 0x0D 38 | #define CANSTAT 0x0E 39 | #define CANCTRL 0x0F 40 | 41 | #define RXF3SIDH 0x10 42 | #define RXF3SIDL 0x11 43 | #define RXF3EID8 0x12 44 | #define RXF3EID0 0x13 45 | #define RXF4SIDH 0x14 46 | #define RXF4SIDL 0x15 47 | #define RXF4EID8 0x16 48 | #define RXF4EID0 0x17 49 | #define RXF5SIDH 0x18 50 | #define RXF5SIDL 0x19 51 | #define RXF5EID8 0x1A 52 | #define RXF5EID0 0x1B 53 | #define TEC 0x1C 54 | #define REC 0x1D 55 | 56 | #define RXM0SIDH 0x20 57 | #define RXM0SIDL 0x21 58 | #define RXM0EID8 0x22 59 | #define RXM0EID0 0x23 60 | #define RXM1SIDH 0x24 61 | #define RXM1SIDL 0x25 62 | #define RXM1EID8 0x26 63 | #define RXM1EID0 0x27 64 | #define CNF3 0x28 65 | #define CNF2 0x29 66 | #define CNF1 0x2A 67 | #define CANINTE 0x2B 68 | #define CANINTF 0x2C 69 | #define EFLG 0x2D 70 | 71 | #define TXB0CTRL 0x30 72 | #define TXB0SIDH 0x31 73 | #define TXB0SIDL 0x32 74 | #define TXB0EID8 0x33 75 | #define TXB0EID0 0x34 76 | #define TXB0DLC 0x35 77 | #define TXB0D0 0x36 78 | #define TXB0D1 0x37 79 | #define TXB0D2 0x38 80 | #define TXB0D3 0x39 81 | #define TXB0D4 0x3A 82 | #define TXB0D5 0x3B 83 | #define TXB0D6 0x3C 84 | #define TXB0D7 0x3D 85 | 86 | #define TXB1CTRL 0x40 87 | #define TXB1SIDH 0x41 88 | #define TXB1SIDL 0x42 89 | #define TXB1EID8 0x43 90 | #define TXB1EID0 0x44 91 | #define TXB1DLC 0x45 92 | #define TXB1D0 0x46 93 | #define TXB1D1 0x47 94 | #define TXB1D2 0x48 95 | #define TXB1D3 0x49 96 | #define TXB1D4 0x4A 97 | #define TXB1D5 0x4B 98 | #define TXB1D6 0x4C 99 | #define TXB1D7 0x4D 100 | 101 | #define TXB2CTRL 0x50 102 | #define TXB2SIDH 0x51 103 | #define TXB2SIDL 0x52 104 | #define TXB2EID8 0x53 105 | #define TXB2EID0 0x54 106 | #define TXB2DLC 0x55 107 | #define TXB2D0 0x56 108 | #define TXB2D1 0x57 109 | #define TXB2D2 0x58 110 | #define TXB2D3 0x59 111 | #define TXB2D4 0x5A 112 | #define TXB2D5 0x5B 113 | #define TXB2D6 0x5C 114 | #define TXB2D7 0x5D 115 | 116 | #define RXB0CTRL 0x60 117 | #define RXB0SIDH 0x61 118 | #define RXB0SIDL 0x62 119 | #define RXB0EID8 0x63 120 | #define RXB0EID0 0x64 121 | #define RXB0DLC 0x65 122 | #define RXB0D0 0x66 123 | #define RXB0D1 0x67 124 | #define RXB0D2 0x68 125 | #define RXB0D3 0x69 126 | #define RXB0D4 0x6A 127 | #define RXB0D5 0x6B 128 | #define RXB0D6 0x6C 129 | #define RXB0D7 0x6D 130 | 131 | #define RXB1CTRL 0x70 132 | #define RXB1SIDH 0x71 133 | #define RXB1SIDL 0x72 134 | #define RXB1EID8 0x73 135 | #define RXB1EID0 0x74 136 | #define RXB1DLC 0x75 137 | #define RXB1D0 0x76 138 | #define RXB1D1 0x77 139 | #define RXB1D2 0x78 140 | #define RXB1D3 0x79 141 | #define RXB1D4 0x7A 142 | #define RXB1D5 0x7B 143 | #define RXB1D6 0x7C 144 | #define RXB1D7 0x7D 145 | /*@}*/ 146 | 147 | /** \name Bitdefinition der verschiedenen Register */ 148 | /*@{*/ 149 | 150 | /** \brief Bitdefinition von BFPCTRL */ 151 | #define B1BFS 5 152 | #define B0BFS 4 153 | #define B1BFE 3 154 | #define B0BFE 2 155 | #define B1BFM 1 156 | #define B0BFM 0 157 | 158 | /** \brief Bitdefinition von TXRTSCTRL */ 159 | #define B2RTS 5 160 | #define B1RTS 4 161 | #define B0RTS 3 162 | #define B2RTSM 2 163 | #define B1RTSM 1 164 | #define B0RTSM 0 165 | 166 | /** \brief Bitdefinition von CANSTAT */ 167 | #define OPMOD2 7 168 | #define OPMOD1 6 169 | #define OPMOD0 5 170 | #define ICOD2 3 171 | #define ICOD1 2 172 | #define ICOD0 1 173 | 174 | /** \brief Bitdefinition von CANCTRL */ 175 | #define REQOP2 7 176 | #define REQOP1 6 177 | #define REQOP0 5 178 | #define ABAT 4 179 | #define CLKEN 2 180 | #define CLKPRE1 1 181 | #define CLKPRE0 0 182 | 183 | /** \brief Bitdefinition von CNF3 */ 184 | #define WAKFIL 6 185 | #define PHSEG22 2 186 | #define PHSEG21 1 187 | #define PHSEG20 0 188 | 189 | /** \brief Bitdefinition von CNF2 */ 190 | #define BTLMODE 7 191 | #define SAM 6 192 | #define PHSEG12 5 193 | #define PHSEG11 4 194 | #define PHSEG10 3 195 | #define PHSEG2 2 196 | #define PHSEG1 1 197 | #define PHSEG0 0 198 | 199 | /** \brief Bitdefinition von CNF1 */ 200 | #define SJW1 7 201 | #define SJW0 6 202 | #define BRP5 5 203 | #define BRP4 4 204 | #define BRP3 3 205 | #define BRP2 2 206 | #define BRP1 1 207 | #define BRP0 0 208 | 209 | /** \brief Bitdefinition von CANINTE */ 210 | #define MERRE 7 211 | #define WAKIE 6 212 | #define ERRIE 5 213 | #define TX2IE 4 214 | #define TX1IE 3 215 | #define TX0IE 2 216 | #define RX1IE 1 217 | #define RX0IE 0 218 | 219 | /** \brief Bitdefinition von CANINTF */ 220 | #define MERRF 7 221 | #define WAKIF 6 222 | #define ERRIF 5 223 | #define TX2IF 4 224 | #define TX1IF 3 225 | #define TX0IF 2 226 | #define RX1IF 1 227 | #define RX0IF 0 228 | 229 | /** \brief Bitdefinition von EFLG */ 230 | #define RX1OVR 7 231 | #define RX0OVR 6 232 | #define TXB0 5 233 | #define TXEP 4 234 | #define RXEP 3 235 | #define TXWAR 2 236 | #define RXWAR 1 237 | #define EWARN 0 238 | 239 | /** \brief Bitdefinition von TXBnCTRL (n = 0, 1, 2) */ 240 | #define ABTF 6 241 | #define MLOA 5 242 | #define TXERR 4 243 | #define TXREQ 3 244 | #define TXP1 1 245 | #define TXP0 0 246 | 247 | /** \brief Bitdefinition von RXB0CTRL */ 248 | #define RXM1 6 249 | #define RXM0 5 250 | #define RXRTR 3 251 | #define BUKT 2 252 | #define BUKT1 1 253 | #define FILHIT0 0 254 | 255 | /** \brief Bitdefinition von TXBnSIDL (n = 0, 1) */ 256 | #define EXIDE 3 257 | 258 | /** 259 | * \brief Bitdefinition von RXB1CTRL 260 | * \see RXM1, RXM0, RXRTR und FILHIT0 sind schon fuer RXB0CTRL definiert 261 | */ 262 | #define FILHIT2 2 263 | #define FILHIT1 1 264 | 265 | /** \brief Bitdefinition von RXBnSIDL (n = 0, 1) */ 266 | #define SRR 4 267 | #define IDE 3 268 | 269 | /** 270 | * \brief Bitdefinition von RXBnDLC (n = 0, 1) 271 | * \see TXBnDLC (gleiche Bits) 272 | */ 273 | #define RTR 6 274 | #define DLC3 3 275 | #define DLC2 2 276 | #define DLC1 1 277 | #define DLC0 0 278 | 279 | /*@}*/ 280 | #endif // MCP2515_DEFS_H 281 | --------------------------------------------------------------------------------