![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
irira=
Dependencies: Adafruit_GFX mbed
Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by
main.cpp@12:d5fa8cb51bc0, 2017-02-21 (annotated)
- Committer:
- number_key
- Date:
- Tue Feb 21 09:46:42 2017 +0000
- Revision:
- 12:d5fa8cb51bc0
- Parent:
- 11:f4ecb5faeffe
irita
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaizen | 0:81a58b2fb28e | 1 | #include "mbed.h" |
kaizen | 0:81a58b2fb28e | 2 | #include "Adafruit_SSD1306.h" |
IOP | 8:e61e86355653 | 3 | |
IOP | 10:abbd34fe7ce1 | 4 | DigitalOut myled_R(LED_RED); |
kaizen | 0:81a58b2fb28e | 5 | |
IOP | 11:f4ecb5faeffe | 6 | // SPI sub-class that provides a constructed default |
number_key | 12:d5fa8cb51bc0 | 7 | class SPIPreInit : public SPI |
kaizen | 0:81a58b2fb28e | 8 | { |
kaizen | 0:81a58b2fb28e | 9 | public: |
number_key | 12:d5fa8cb51bc0 | 10 | SPIPreInit(PinName mosi, PinName miso, PinName clk) : SPI(mosi,miso,clk) |
kaizen | 0:81a58b2fb28e | 11 | { |
number_key | 12:d5fa8cb51bc0 | 12 | format(8,3); |
number_key | 12:d5fa8cb51bc0 | 13 | frequency(2000000); |
kaizen | 0:81a58b2fb28e | 14 | }; |
kaizen | 0:81a58b2fb28e | 15 | }; |
kaizen | 0:81a58b2fb28e | 16 | |
number_key | 12:d5fa8cb51bc0 | 17 | SPIPreInit gSpi(dp5,NC,dp6); |
number_key | 12:d5fa8cb51bc0 | 18 | Adafruit_SSD1306_Spi myOled(gSpi,dp2,dp3,dp4); |
kaizen | 0:81a58b2fb28e | 19 | |
kaizen | 0:81a58b2fb28e | 20 | int main() |
IOP | 9:a6021ca48d2e | 21 | { |
IOP | 9:a6021ca48d2e | 22 | uint16_t x=0; |
kaizen | 0:81a58b2fb28e | 23 | |
IOP | 9:a6021ca48d2e | 24 | myOled.begin(); |
IOP | 9:a6021ca48d2e | 25 | myOled.printf("%ux%u Hellow World\r\n", myOled.width(), myOled.height()); |
IOP | 9:a6021ca48d2e | 26 | myOled.display(); |
kaizen | 0:81a58b2fb28e | 27 | |
kaizen | 0:81a58b2fb28e | 28 | while(1) |
kaizen | 0:81a58b2fb28e | 29 | { |
IOP | 8:e61e86355653 | 30 | myled_R = !myled_R; |
number_key | 12:d5fa8cb51bc0 | 31 | myOled.printf("%Irita=%u\r",x); |
IOP | 9:a6021ca48d2e | 32 | myOled.display(); |
IOP | 9:a6021ca48d2e | 33 | x = x + 1; |
number_key | 12:d5fa8cb51bc0 | 34 | //wait(1.0); |
kaizen | 0:81a58b2fb28e | 35 | } |
kaizen | 0:81a58b2fb28e | 36 | } |