20170908
Dependencies: Hexi_OLED_SSD1351 W25Q64FVSSIG
main.cpp@0:87831c311089, 2017-09-08 (annotated)
- Committer:
- i_am_kitsune
- Date:
- Fri Sep 08 05:53:38 2017 +0000
- Revision:
- 0:87831c311089
20170908
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
i_am_kitsune | 0:87831c311089 | 1 | #include "mbed.h" |
i_am_kitsune | 0:87831c311089 | 2 | #include "W25Q64FV.h" |
i_am_kitsune | 0:87831c311089 | 3 | #include "Hexi_OLED_SSD1351.h" |
i_am_kitsune | 0:87831c311089 | 4 | #include "string.h" |
i_am_kitsune | 0:87831c311089 | 5 | |
i_am_kitsune | 0:87831c311089 | 6 | DigitalOut led1(LED1); |
i_am_kitsune | 0:87831c311089 | 7 | |
i_am_kitsune | 0:87831c311089 | 8 | Serial pc(USBTX, USBRX); |
i_am_kitsune | 0:87831c311089 | 9 | |
i_am_kitsune | 0:87831c311089 | 10 | /* Instantiate the SSD1351 OLED Driver */ |
i_am_kitsune | 0:87831c311089 | 11 | /* (MOSI,SCLK,POWER,CS,RST,DC) */ |
i_am_kitsune | 0:87831c311089 | 12 | SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); |
i_am_kitsune | 0:87831c311089 | 13 | |
i_am_kitsune | 0:87831c311089 | 14 | /** |
i_am_kitsune | 0:87831c311089 | 15 | |
i_am_kitsune | 0:87831c311089 | 16 | MOSI: PTD6 |
i_am_kitsune | 0:87831c311089 | 17 | MISO: PTD7 |
i_am_kitsune | 0:87831c311089 | 18 | SCL : PTD5 |
i_am_kitsune | 0:87831c311089 | 19 | CS : PTD4 |
i_am_kitsune | 0:87831c311089 | 20 | FREQ : 1000 000 HZ |
i_am_kitsune | 0:87831c311089 | 21 | |
i_am_kitsune | 0:87831c311089 | 22 | **/ |
i_am_kitsune | 0:87831c311089 | 23 | W25Q64FV flash(PTD6, PTD7, PTD5, PTD4, 8000000); |
i_am_kitsune | 0:87831c311089 | 24 | |
i_am_kitsune | 0:87831c311089 | 25 | // main() runs in its own thread in the OS |
i_am_kitsune | 0:87831c311089 | 26 | int main() |
i_am_kitsune | 0:87831c311089 | 27 | { |
i_am_kitsune | 0:87831c311089 | 28 | uint8_t buf[256] = {}; |
i_am_kitsune | 0:87831c311089 | 29 | |
i_am_kitsune | 0:87831c311089 | 30 | uint16_t mau_id = 0; |
i_am_kitsune | 0:87831c311089 | 31 | unsigned tesing_type = 0; |
i_am_kitsune | 0:87831c311089 | 32 | // mau_id = flash.Id(); |
i_am_kitsune | 0:87831c311089 | 33 | // pc.printf("%d\n",mau_id); |
i_am_kitsune | 0:87831c311089 | 34 | // pc.printf("%x\n",mau_id); |
i_am_kitsune | 0:87831c311089 | 35 | |
i_am_kitsune | 0:87831c311089 | 36 | flash.W25Q64_readManufacturer(buf); |
i_am_kitsune | 0:87831c311089 | 37 | pc.printf("JEDEC ID : "); |
i_am_kitsune | 0:87831c311089 | 38 | for (uint8_t i=0; i<5; i++) { |
i_am_kitsune | 0:87831c311089 | 39 | pc.printf("%x", buf[i]); |
i_am_kitsune | 0:87831c311089 | 40 | pc.printf(" "); |
i_am_kitsune | 0:87831c311089 | 41 | } |
i_am_kitsune | 0:87831c311089 | 42 | pc.printf("\n"); |
i_am_kitsune | 0:87831c311089 | 43 | |
i_am_kitsune | 0:87831c311089 | 44 | while (true) { |
i_am_kitsune | 0:87831c311089 | 45 | |
i_am_kitsune | 0:87831c311089 | 46 | led1 = !led1; |
i_am_kitsune | 0:87831c311089 | 47 | wait(0.5); |
i_am_kitsune | 0:87831c311089 | 48 | } |
i_am_kitsune | 0:87831c311089 | 49 | } |