takashi kadono
/
Nucleo_446
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
Diff: main.cpp
- Revision:
- 2:018812000e6e
- Parent:
- 1:e396a61d2631
- Child:
- 3:f3764f852aa8
--- a/main.cpp Wed Oct 10 00:56:53 2018 +0000 +++ b/main.cpp Thu Oct 11 01:58:50 2018 +0000 @@ -1,29 +1,9 @@ #include "mbed.h" +#include "ssd1331.h" + Thread thread; - -class SPI_LIB -{ -public: - SPI_LIB(PinName mosi,PinName miso,PinName sclk,PinName cs):_spi(mosi,miso,sclk),_cs(cs) { - _spi.format(8,3); - _spi.frequency(1000000); - } - - void SendData(uint8_t data) { - _cs=0; - _spi.write(data); - _cs=1; - } - - -private: - SPI _spi; - DigitalOut _cs; -}; - - void print_char(char c = '*') { printf("%c", c); @@ -38,17 +18,18 @@ } } -SPI_LIB SPIx(D11,D12,D13,D10); +ssd1331 oled(D11,D12,D13,D10,D9,D8); int main() { printf("\n\n*** RTOS basic example ***\n"); thread.start(print_thread); + + oled.Initssd1331(); + oled.ClearScreen(); + oled.DrawRectangleFill(4,4,91,59,RGB565_GREEN,RGB565_YELLOW); + while (true) { - for(uint8_t i=0; i<255; i++) { - SPIx.SendData(i); - wait_us(100); - } } } \ No newline at end of file