Fork of Smoothie to port to mbed non-LPC targets.
Fork of Smoothie by
ST7565.h
00001 /* 00002 * ST7565.h 00003 * 00004 * Created on: 21-06-2013 00005 * Author: Wulfnor 00006 */ 00007 00008 #ifndef ST7565_H_ 00009 #define ST7565_H_ 00010 00011 #include "LcdBase.h" 00012 #include "mbed.h" 00013 #include "libs/Pin.h" 00014 00015 class ST7565: public LcdBase { 00016 public: 00017 ST7565(); 00018 virtual ~ST7565(); 00019 void home(); 00020 void clear(); 00021 void display(); 00022 void setCursor(uint8_t col, uint8_t row); 00023 void init(); 00024 void write_char(char value); 00025 void write(const char* line, int len); 00026 00027 void on_refresh(bool now=false); 00028 //encoder which dosent exist :/ 00029 uint8_t readButtons(); 00030 int readEncoderDelta(); 00031 int getEncoderResolution() { return 2; } 00032 uint16_t get_screen_lines() { return 8; } 00033 bool hasGraphics() { return true; } 00034 00035 //added ST7565 commands 00036 void send_commands(const unsigned char* buf, size_t size); 00037 void send_data(const unsigned char* buf, size_t size); 00038 // set column and page number 00039 void set_xy(int x, int y); 00040 //send pic to whole screen 00041 void send_pic(const unsigned char* data); 00042 //drawing char 00043 int drawChar(int x, int y, unsigned char c, int color); 00044 // blit a glyph of w pixels wide and h pixels high to x, y. offset pixel position in glyph by x_offset, y_offset. 00045 // span is the width in bytes of the src bitmap 00046 // The glyph bytes will be 8 bits of X pixels, msbit->lsbit from top left to bottom right 00047 void bltGlyph(int x, int y, int w, int h, const uint8_t *glyph, int span= 0, int x_offset=0, int y_offset=0); 00048 void renderGlyph(int x, int y, const uint8_t *g, int pixelWidth, int pixelHeight); 00049 void pixel(int x, int y, int colour); 00050 00051 private: 00052 //buffer 00053 unsigned char *framebuffer; 00054 mbed::SPI* spi; 00055 Pin cs; 00056 Pin rst; 00057 Pin a0; 00058 Pin click_pin; 00059 Pin up_pin; 00060 Pin down_pin; 00061 Pin encoder_a_pin; 00062 Pin encoder_b_pin; 00063 00064 // text cursor position 00065 uint8_t tx, ty; 00066 uint8_t contrast; 00067 bool reversed; 00068 }; 00069 00070 #endif /* ST7565_H_ */
Generated on Tue Jul 12 2022 20:09:02 by 1.7.2