This is test library which translated from code for arduino. Original code, and their product can be found in the link below. http://www.adafruit.com/products/250
Dependents: CH12864F-SPI2_Test
ST7565 LCD
!This is the test library.!
I translated arduino code to mbed. You can find the product and datasheet from the following link.
http://www.adafruit.com/products/250
void begin(uint8_t contrast);
- Initialize data with Adafruit Logo.
- contrast is needed
void clear_display(void);
- Clears only display data. RAM data kept remained.
void clear();
- Clears display data and RAM data.
void display();
- Update display with RAM data.
void setpixel(uint8_t x, uint8_t y, uint8_t color);
- Set a dot at (x, y)
void fillcircle(uint8_t x0, uint8_t y0, uint8_t r, uint8_t color);
- Draw a filled circle with its center coordinate (x0, y0) and radius r.
void fillrect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t color);
- Draw a filled rectangular with its top-left coordinate (x, y) and its width (w) and height (h).
void drawcircle(uint8_t x0, uint8_t y0, uint8_t r, uint8_t color);
- Draw a circle with its center coordinate (x0, y0) and radius r.
void drawrect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t color);
- Draw a rectangular with its top-left coordinate (x, y) and its width (w) and height (h).
void drawline(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color);
- Draw a line starts from (x0, y0) to (x1, y1)
void drawchar(uint8_t x, uint8_t line, char c);
- Set a character
void drawstring(uint8_t x, uint8_t line, char *c);
- Set string
Example code for main.cpp:
#include "mbed.h" #include "st7565LCD.h" ST7565 st7565(p11, p13, p21, p22, p23); // mosi, sclk, cs, rst, a0 int main() { //0x18 defines cntrast st7565.begin(0x18); //show initial data (Adafruit logo) st7565.display(); wait(1.0); //Clear all data st7565.clear(); //test code st7565.drawstring(1,1,"test"); //update RAM data st7565.display(); while(1) { } }