I added some member functions to the OLED library.
Revision 6:881ee0c6dbda, committed 2019-12-11
- Comitter:
- dcj001
- Date:
- Wed Dec 11 17:02:09 2019 +0000
- Parent:
- 5:e564cde8e03e
- Commit message:
- I added some member functions to the OLED library. It's just for this project.
Changed in this revision
SSD1308.cpp | Show annotated file Show diff for this revision Revisions of this file |
SSD1308.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r e564cde8e03e -r 881ee0c6dbda SSD1308.cpp --- a/SSD1308.cpp Mon Dec 18 18:46:05 2017 +0000 +++ b/SSD1308.cpp Wed Dec 11 17:02:09 2019 +0000 @@ -43,6 +43,7 @@ */ #include "mbed.h" #include "SSD1308.h" +#include "logo.h" //#include "font_3x5.h" //#include "font_5x7.h" @@ -1064,3 +1065,99 @@ _sendCommand(SET_DISPLAY_POWER_ON); // 0xAF } +/////////////////// +void SSD1308::clearDisplay_zone() { + + int cl; + cl=127; + for(int m=127;m>=5;m--) + { + write_point(3,cl,32); + cl=cl-1; + //wait(0.1); + } + +} + + + +void SSD1308::write_point(uint8_t row, uint8_t col, uint8_t line){ + + + setVerticalAddressingMode(); + + //setPageAddress(row, MAX_PAGE); +// setColumnAddress(col, ); + + setPageAddress(row, 6); + setColumnAddress(col,MAX_COL); + + for(uint8_t i=0 ; i<4; i++) + { + _sendData(grah2_point[line][i]); + } + +} + +void SSD1308::graph(int *temp,int times,int count) +{ + int cl; + int m; + + if(count==1) + { cl=127; + for(m=times;m>=0;m--) + { + write_point(3,cl,temp[m]); + cl=cl-4; + //wait(0.1); + } + cl=127; + } + + else + { cl=7; + write_point(3,127,32); //clear the column127 + for(m=0;m<30;m++) + { + write_point(3,cl,temp[m]); + cl=cl+4; + //wait(0.1); + } + cl=7; + } + + +} + +void SSD1308::display_Axis_y() +{ + setVerticalAddressingMode(); + + setPageAddress(2,6); + setColumnAddress(0,4); + for(int j=0;j<5; j++) + { + for(uint8_t i=0 ; i<5; i++) + { + _sendData(Axis_y[j][i]); + } + } +} + +void SSD1308::display_Axis_x() +{ + setVerticalAddressingMode(); + + setPageAddress(7,7); + setColumnAddress(3,127); + for(uint8_t j=0; j<127; j++) + { + for(uint8_t i=0 ; i<8; i++) + { + _sendData(Axis_x[i]); + } + } +} + +
diff -r e564cde8e03e -r 881ee0c6dbda SSD1308.h --- a/SSD1308.h Mon Dec 18 18:46:05 2017 +0000 +++ b/SSD1308.h Wed Dec 11 17:02:09 2019 +0000 @@ -486,6 +486,14 @@ * @param uint8_t scrollRowsoffset scroll rows (topRowsFixed..MAX_ROW) */ void setVerticalScrollArea(uint8_t topRowsFixed, uint8_t scrollRows); + +///////////////////// + void write_point(uint8_t row, uint8_t col,uint8_t line); + void graph(int *temp,int times,int count); + void display_Axis_y(); + void display_Axis_x(); + void clearDisplay_zone(); +///////////////// private: