![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
인터럽트예제
Dependencies: Adafruit_GFX mbed
Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by
main.cpp@4:2eed16fd0e71, 2015-07-02 (annotated)
- Committer:
- eunkyoungkim
- Date:
- Thu Jul 02 07:45:54 2015 +0000
- Revision:
- 4:2eed16fd0e71
- Parent:
- 3:847c4451cc97
- Child:
- 6:357ffd6308e4
modify the output data(Hello World!)
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" |
kaizen | 0:81a58b2fb28e | 3 | |
kaizen | 0:81a58b2fb28e | 4 | DigitalOut myled(LED1); |
kaizen | 0:81a58b2fb28e | 5 | |
kaizen | 0:81a58b2fb28e | 6 | |
kaizen | 0:81a58b2fb28e | 7 | // an SPI sub-class that provides a constructed default |
kaizen | 0:81a58b2fb28e | 8 | class I2CPreInit : public I2C |
kaizen | 0:81a58b2fb28e | 9 | { |
kaizen | 0:81a58b2fb28e | 10 | public: |
kaizen | 0:81a58b2fb28e | 11 | I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl) |
kaizen | 0:81a58b2fb28e | 12 | { |
kaizen | 0:81a58b2fb28e | 13 | frequency(100000); |
kaizen | 0:81a58b2fb28e | 14 | start(); |
kaizen | 0:81a58b2fb28e | 15 | }; |
kaizen | 0:81a58b2fb28e | 16 | }; |
kaizen | 0:81a58b2fb28e | 17 | |
kaizen | 0:81a58b2fb28e | 18 | I2CPreInit gI2C(PA_10,PA_9); |
kaizen | 0:81a58b2fb28e | 19 | Adafruit_SSD1306_I2c gOled(gI2C,NC,0x78,64,128); |
kaizen | 0:81a58b2fb28e | 20 | Serial pc(USBTX,USBRX); |
kaizen | 0:81a58b2fb28e | 21 | |
kaizen | 0:81a58b2fb28e | 22 | int main() |
kaizen | 1:6b03b9f64311 | 23 | { uint16_t x=0; |
kaizen | 0:81a58b2fb28e | 24 | |
kaizen | 0:81a58b2fb28e | 25 | gOled.begin(); |
eunkyoungkim | 4:2eed16fd0e71 | 26 | gOled.printf("%ux%u Hello World!\r\n", gOled.width(), gOled.height()); |
kaizen | 0:81a58b2fb28e | 27 | gOled.display(); |
kaizen | 0:81a58b2fb28e | 28 | |
kaizen | 0:81a58b2fb28e | 29 | |
kaizen | 0:81a58b2fb28e | 30 | while(1) |
kaizen | 0:81a58b2fb28e | 31 | { |
kaizen | 0:81a58b2fb28e | 32 | myled = !myled; |
kaizen | 0:81a58b2fb28e | 33 | gOled.printf("%u\r",x); |
kaizen | 0:81a58b2fb28e | 34 | gOled.display(); |
kaizen | 0:81a58b2fb28e | 35 | x = x + 1; |
kaizen | 0:81a58b2fb28e | 36 | wait(1); |
kaizen | 0:81a58b2fb28e | 37 | } |
kaizen | 0:81a58b2fb28e | 38 | } |