A derived version of the BSD licensed Adafrut GFX library for the SSD1306 controller for an OLED 128x32 or 128x64 display using SPI or I2C.
Fork of Adafruit_GFX by
Adafruit_SharpMem.h@18:5942552bf2cd, 2015-06-03 (annotated)
- Committer:
- marcpl
- Date:
- Wed Jun 03 09:54:52 2015 +0000
- Revision:
- 18:5942552bf2cd
minor fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcpl | 18:5942552bf2cd | 1 | /********************************************************************* |
marcpl | 18:5942552bf2cd | 2 | This is an Arduino library for our Monochrome SHARP Memory Displays |
marcpl | 18:5942552bf2cd | 3 | Pick one up today in the adafruit shop! |
marcpl | 18:5942552bf2cd | 4 | ------> http://www.adafruit.com/products/1393 |
marcpl | 18:5942552bf2cd | 5 | These displays use SPI to communicate, 3 pins are required to |
marcpl | 18:5942552bf2cd | 6 | interface |
marcpl | 18:5942552bf2cd | 7 | Adafruit invests time and resources providing this open source code, |
marcpl | 18:5942552bf2cd | 8 | please support Adafruit and open-source hardware by purchasing |
marcpl | 18:5942552bf2cd | 9 | products from Adafruit! |
marcpl | 18:5942552bf2cd | 10 | Written by Limor Fried/Ladyada for Adafruit Industries. |
marcpl | 18:5942552bf2cd | 11 | BSD license, check license.txt for more information |
marcpl | 18:5942552bf2cd | 12 | All text above, and the splash screen must be included in any redistribution |
marcpl | 18:5942552bf2cd | 13 | *********************************************************************/ |
marcpl | 18:5942552bf2cd | 14 | |
marcpl | 18:5942552bf2cd | 15 | /** |
marcpl | 18:5942552bf2cd | 16 | * Modified by Marc Plouhinec 28/05/2015 for use in mbed. |
marcpl | 18:5942552bf2cd | 17 | * Original files at: https://github.com/adafruit/Adafruit_SHARP_Memory_Display |
marcpl | 18:5942552bf2cd | 18 | */ |
marcpl | 18:5942552bf2cd | 19 | |
marcpl | 18:5942552bf2cd | 20 | #ifndef _ADAFRUIT_SHARPMEM_H_ |
marcpl | 18:5942552bf2cd | 21 | #define _ADAFRUIT_SHARPMEM_H_ |
marcpl | 18:5942552bf2cd | 22 | |
marcpl | 18:5942552bf2cd | 23 | #include "mbed.h" |
marcpl | 18:5942552bf2cd | 24 | #include "Adafruit_GFX.h" |
marcpl | 18:5942552bf2cd | 25 | |
marcpl | 18:5942552bf2cd | 26 | // LCD Dimensions |
marcpl | 18:5942552bf2cd | 27 | #define SHARPMEM_LCDWIDTH (96) |
marcpl | 18:5942552bf2cd | 28 | #define SHARPMEM_LCDHEIGHT (96) |
marcpl | 18:5942552bf2cd | 29 | |
marcpl | 18:5942552bf2cd | 30 | class Adafruit_SharpMem : public Adafruit_GFX { |
marcpl | 18:5942552bf2cd | 31 | public: |
marcpl | 18:5942552bf2cd | 32 | Adafruit_SharpMem(uint8_t clk, uint8_t mosi, uint8_t ss); |
marcpl | 18:5942552bf2cd | 33 | void begin(void); |
marcpl | 18:5942552bf2cd | 34 | void drawPixel(int16_t x, int16_t y, uint16_t color); |
marcpl | 18:5942552bf2cd | 35 | uint8_t getPixel(uint16_t x, uint16_t y); |
marcpl | 18:5942552bf2cd | 36 | void clearDisplay(); |
marcpl | 18:5942552bf2cd | 37 | void refresh(void); |
marcpl | 18:5942552bf2cd | 38 | private: |
marcpl | 18:5942552bf2cd | 39 | uint8_t _ss, _clk, _mosi; |
marcpl | 18:5942552bf2cd | 40 | volatile uint8_t *dataport, *clkport; |
marcpl | 18:5942552bf2cd | 41 | uint8_t _sharpmem_vcom, datapinmask, clkpinmask; |
marcpl | 18:5942552bf2cd | 42 | void sendbyte(uint8_t data); |
marcpl | 18:5942552bf2cd | 43 | void sendbyteLSB(uint8_t data); |
marcpl | 18:5942552bf2cd | 44 | }; |
marcpl | 18:5942552bf2cd | 45 | |
marcpl | 18:5942552bf2cd | 46 | #endif |