Testé pour projet BTS SN
Dependencies: MODMAX7456 mbed
Fork of MAX7456_HelloWorld by
main.cpp@0:11828abc1244, 2016-04-30 (annotated)
- Committer:
- cdupaty
- Date:
- Sat Apr 30 17:10:11 2016 +0000
- Revision:
- 0:11828abc1244
- Child:
- 2:e25ed18fa668
Test? pour projet BTS SN
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cdupaty | 0:11828abc1244 | 1 | #include "mbed.h" |
cdupaty | 0:11828abc1244 | 2 | #include "OSD7456.h" |
cdupaty | 0:11828abc1244 | 3 | #include "stdio.h" |
cdupaty | 0:11828abc1244 | 4 | |
cdupaty | 0:11828abc1244 | 5 | #define PCBAUD 9600 |
cdupaty | 0:11828abc1244 | 6 | #define MAX7456_MOSI SPI_MOSI |
cdupaty | 0:11828abc1244 | 7 | #define MAX7456_MISO SPI_MISO |
cdupaty | 0:11828abc1244 | 8 | #define MAX7456_SCLK SPI_SCK |
cdupaty | 0:11828abc1244 | 9 | #define MAX7456_CS SPI_CS |
cdupaty | 0:11828abc1244 | 10 | #define MAX7456_RST PA_0 |
cdupaty | 0:11828abc1244 | 11 | #define MAX7456_VSYNC PA_1 |
cdupaty | 0:11828abc1244 | 12 | |
cdupaty | 0:11828abc1244 | 13 | // with SPI1 activated don't use LED1 |
cdupaty | 0:11828abc1244 | 14 | DigitalOut led1(PA_2); |
cdupaty | 0:11828abc1244 | 15 | |
cdupaty | 0:11828abc1244 | 16 | OSD7456 *osd; |
cdupaty | 0:11828abc1244 | 17 | |
cdupaty | 0:11828abc1244 | 18 | int main() { |
cdupaty | 0:11828abc1244 | 19 | |
cdupaty | 0:11828abc1244 | 20 | printf("Test MAX7456\r\n"); |
cdupaty | 0:11828abc1244 | 21 | |
cdupaty | 0:11828abc1244 | 22 | osd = new OSD7456(MAX7456_MOSI, MAX7456_MISO, MAX7456_SCLK, MAX7456_CS, MAX7456_RST, MAX7456_VSYNC); |
cdupaty | 0:11828abc1244 | 23 | |
cdupaty | 0:11828abc1244 | 24 | // Set the character "local background" to 42% |
cdupaty | 0:11828abc1244 | 25 | //osd->max7456->backGround(MAX7456::Percent_42); |
cdupaty | 0:11828abc1244 | 26 | |
cdupaty | 0:11828abc1244 | 27 | // Set the blink rate to 133ms with a duty cycle of 3:1 |
cdupaty | 0:11828abc1244 | 28 | //osd->max7456->blinkRate(MAX7456::ms_133, MAX7456::BT3_BT); |
cdupaty | 0:11828abc1244 | 29 | |
cdupaty | 0:11828abc1244 | 30 | osd->print(1,2,"Bonjour STM32"); |
cdupaty | 0:11828abc1244 | 31 | //osd->print(7, 4, "Positioned text"); |
cdupaty | 0:11828abc1244 | 32 | //osd->print(7, 6, "Positioned text", MAX7456::LocalBG); |
cdupaty | 0:11828abc1244 | 33 | //osd->print(3, 8, "Positioned text blinks", MAX7456::Blink | MAX7456::LocalBG); |
cdupaty | 0:11828abc1244 | 34 | //osd->print(4, 10, " Blinks and inverse ", MAX7456::Blink | MAX7456::LocalBG | MAX7456::Inverse); |
cdupaty | 0:11828abc1244 | 35 | printf("Fin du test\r\n"); |
cdupaty | 0:11828abc1244 | 36 | while(1); |
cdupaty | 0:11828abc1244 | 37 | } |