Kaoru Onoe
/
ST7565SPI_Test
Example of library ST7565SPI: Driver library for ST7565 graphics LCD controller over SPI interface.
Revision 0:d53b674e7f03, committed 2015-03-01
- Comitter:
- kayekss
- Date:
- Sun Mar 01 19:30:56 2015 +0000
- Commit message:
- Example of library ST7565SPI: Driver library for ST7565 graphics LCD controller over SPI interface.
Changed in this revision
diff -r 000000000000 -r d53b674e7f03 ST7565SPI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ST7565SPI.lib Sun Mar 01 19:30:56 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/kayekss/code/ST7565SPI/#2150513a5b18
diff -r 000000000000 -r d53b674e7f03 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 01 19:30:56 2015 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +#include "ST7565SPI.h" + +ST7565SPI lcd(/*MOSI*/ p5, /*SCK*/ p7, /*CS*/ p8, + /*RS*/ p11, /*RST*/ p12, /*Frequency*/ 1000000); + +// Dithered gray patterns +uint8_t const pattern[8][4] = { + { 0xff, 0xff, 0xff, 0xff }, // 100% + { 0x77, 0xff, 0xdd, 0xff }, // 87.5% + { 0x55, 0xff, 0x55, 0xff }, // 75% + { 0x55, 0xbb, 0x55, 0xee }, // 62.5% + { 0x55, 0xaa, 0x55, 0xaa }, // 50% + { 0x55, 0x22, 0x55, 0x88 }, // 37.5% + { 0x55, 0x00, 0x55, 0x00 }, // 25% + { 0x11, 0x00, 0x44, 0x00 } // 12.5% +}; + +int main(void) { + // Initialize LCD + lcd.init(/*V0*/ 3, /*Contrast*/ 48, /*Bias*/ ST7565SPI::Bias1_9); + + // Draw horizontal stripes + for (uint8_t j = 0; j < 8; j++) { + lcd.setPage(j); + lcd.setColumn(0); + for (uint8_t i = 0; i < 128 / 4; i++) { + lcd.data(pattern[j][0]); + lcd.data(pattern[j][1]); + lcd.data(pattern[j][2]); + lcd.data(pattern[j][3]); + } + } + + // Scroll entire display by changing line offset values + uint8_t c = 0; + while (1) { + lcd.command(ST7565SPI::COMMON_OFFSET + c); + if (c == 0) { + c = 63; + } else { + c--; + } + wait(.25); + } +}
diff -r 000000000000 -r d53b674e7f03 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 01 19:30:56 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file