stm32l010 oled
Dependencies: mbed SMALL_SSD1308_128x64_I2C
main.cpp@0:cae0ae672424, 2022-08-05 (annotated)
- Committer:
- caa45040
- Date:
- Fri Aug 05 10:31:27 2022 +0000
- Revision:
- 0:cae0ae672424
stm32l010 oled
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
caa45040 | 0:cae0ae672424 | 1 | //oled_test2_16x24_767_1 |
caa45040 | 0:cae0ae672424 | 2 | |
caa45040 | 0:cae0ae672424 | 3 | #include "mbed.h" |
caa45040 | 0:cae0ae672424 | 4 | #include "SSD1308.h" |
caa45040 | 0:cae0ae672424 | 5 | |
caa45040 | 0:cae0ae672424 | 6 | //i2c initialization |
caa45040 | 0:cae0ae672424 | 7 | //I2C i2c(I2C_SDA, I2C_SCL); //767 |
caa45040 | 0:cae0ae672424 | 8 | I2C i2c(PA_10, PA_9); |
caa45040 | 0:cae0ae672424 | 9 | |
caa45040 | 0:cae0ae672424 | 10 | // Instantiate OLED |
caa45040 | 0:cae0ae672424 | 11 | //SSD1308 oled = SSD1308(SSD1308_SA0); |
caa45040 | 0:cae0ae672424 | 12 | |
caa45040 | 0:cae0ae672424 | 13 | // Host PC Communication channels |
caa45040 | 0:cae0ae672424 | 14 | //Serial pc(USBTX, USBRX); // tx, rx |
caa45040 | 0:cae0ae672424 | 15 | |
caa45040 | 0:cae0ae672424 | 16 | |
caa45040 | 0:cae0ae672424 | 17 | |
caa45040 | 0:cae0ae672424 | 18 | //メイン関数 |
caa45040 | 0:cae0ae672424 | 19 | int main() |
caa45040 | 0:cae0ae672424 | 20 | { |
caa45040 | 0:cae0ae672424 | 21 | |
caa45040 | 0:cae0ae672424 | 22 | |
caa45040 | 0:cae0ae672424 | 23 | |
caa45040 | 0:cae0ae672424 | 24 | int ii; //ループカウンター |
caa45040 | 0:cae0ae672424 | 25 | int nn; //文字カウンター |
caa45040 | 0:cae0ae672424 | 26 | |
caa45040 | 0:cae0ae672424 | 27 | //シリアルの初期化 |
caa45040 | 0:cae0ae672424 | 28 | // pc.baud(9600); |
caa45040 | 0:cae0ae672424 | 29 | |
caa45040 | 0:cae0ae672424 | 30 | // printf("\r\n<START>\r\n"); |
caa45040 | 0:cae0ae672424 | 31 | |
caa45040 | 0:cae0ae672424 | 32 | // Instantiate OLED |
caa45040 | 0:cae0ae672424 | 33 | SSD1308 oled = SSD1308( &i2c , SSD1308_SA0); |
caa45040 | 0:cae0ae672424 | 34 | |
caa45040 | 0:cae0ae672424 | 35 | |
caa45040 | 0:cae0ae672424 | 36 | //charge pump add=>ca45040 |
caa45040 | 0:cae0ae672424 | 37 | //i2c.write(SSD1308_SA0, "\200\215\200\024", 4); //0x80,0x8d,0x80,0x14 |
caa45040 | 0:cae0ae672424 | 38 | //set access |
caa45040 | 0:cae0ae672424 | 39 | //oled.setDisplayFlip(false, false); |
caa45040 | 0:cae0ae672424 | 40 | |
caa45040 | 0:cae0ae672424 | 41 | |
caa45040 | 0:cae0ae672424 | 42 | |
caa45040 | 0:cae0ae672424 | 43 | //char n1_8[] = "12345678"; |
caa45040 | 0:cae0ae672424 | 44 | char n1_8[] = "87654321"; |
caa45040 | 0:cae0ae672424 | 45 | //char n1_8[] = "88888888"; |
caa45040 | 0:cae0ae672424 | 46 | |
caa45040 | 0:cae0ae672424 | 47 | ii=0; |
caa45040 | 0:cae0ae672424 | 48 | for(nn=0; nn<8; nn++) { |
caa45040 | 0:cae0ae672424 | 49 | // y x |
caa45040 | 0:cae0ae672424 | 50 | oled.writeBigChar(0, ii*16,n1_8[nn]); |
caa45040 | 0:cae0ae672424 | 51 | ii = ii + 1; |
caa45040 | 0:cae0ae672424 | 52 | } //for |
caa45040 | 0:cae0ae672424 | 53 | //pc.printf("Printed something\r\n"); |
caa45040 | 0:cae0ae672424 | 54 | // printf("Printed something\r\n"); |
caa45040 | 0:cae0ae672424 | 55 | |
caa45040 | 0:cae0ae672424 | 56 | //oled.writeString(0, 0, "Hello World !"); |
caa45040 | 0:cae0ae672424 | 57 | |
caa45040 | 0:cae0ae672424 | 58 | while(1) {} |
caa45040 | 0:cae0ae672424 | 59 | |
caa45040 | 0:cae0ae672424 | 60 | }//main |
caa45040 | 0:cae0ae672424 | 61 | |
caa45040 | 0:cae0ae672424 | 62 | |
caa45040 | 0:cae0ae672424 | 63 | |
caa45040 | 0:cae0ae672424 | 64 | //容量削減 |
caa45040 | 0:cae0ae672424 | 65 | void error(const char* format, ...) {} |
caa45040 | 0:cae0ae672424 | 66 | |
caa45040 | 0:cae0ae672424 | 67 |