Testé pour projet BTS SN
Dependencies: MODMAX7456 mbed
Fork of MAX7456_HelloWorld by
main.cpp@2:e25ed18fa668, 2016-05-12 (annotated)
- Committer:
- cdupaty
- Date:
- Thu May 12 11:27:55 2016 +0000
- Revision:
- 2:e25ed18fa668
- Parent:
- 0:11828abc1244
- Child:
- 3:39577e90b8a2
Mise ? jour des exemples; Tests sur OSD click
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 | 2:e25ed18fa668 | 20 | |
cdupaty | 2:e25ed18fa668 | 21 | printf("Test MAX7456 avec OSB click\r\n"); |
cdupaty | 0:11828abc1244 | 22 | |
cdupaty | 0:11828abc1244 | 23 | osd = new OSD7456(MAX7456_MOSI, MAX7456_MISO, MAX7456_SCLK, MAX7456_CS, MAX7456_RST, MAX7456_VSYNC); |
cdupaty | 0:11828abc1244 | 24 | |
cdupaty | 0:11828abc1244 | 25 | // Set the character "local background" to 42% |
cdupaty | 2:e25ed18fa668 | 26 | osd->max7456->backGround(MAX7456::Percent_42); |
cdupaty | 0:11828abc1244 | 27 | |
cdupaty | 0:11828abc1244 | 28 | // Set the blink rate to 133ms with a duty cycle of 3:1 |
cdupaty | 2:e25ed18fa668 | 29 | osd->max7456->blinkRate(MAX7456::ms_133, MAX7456::BT3_BT); |
cdupaty | 0:11828abc1244 | 30 | |
cdupaty | 2:e25ed18fa668 | 31 | osd->print(1,1,"Incrustation sur STM32"); |
cdupaty | 2:e25ed18fa668 | 32 | osd->print(1,2,"----------------------"); |
cdupaty | 2:e25ed18fa668 | 33 | osd->print(7, 4, "Texte en 7-4"); |
cdupaty | 2:e25ed18fa668 | 34 | osd->print(7, 5, "Texte fond gris", MAX7456::LocalBG); |
cdupaty | 2:e25ed18fa668 | 35 | osd->print(2, 7, "clignotant fond gris", MAX7456::Blink | MAX7456::LocalBG); |
cdupaty | 2:e25ed18fa668 | 36 | osd->print(4, 9, "Texte Noir", MAX7456::Inverse); |
cdupaty | 2:e25ed18fa668 | 37 | osd->print(1, 10, "Noir-fond gris-clignotant", MAX7456::Inverse|MAX7456::LocalBG|MAX7456::Blink); |
cdupaty | 2:e25ed18fa668 | 38 | |
cdupaty | 0:11828abc1244 | 39 | printf("Fin du test\r\n"); |
cdupaty | 2:e25ed18fa668 | 40 | while(1); |
cdupaty | 0:11828abc1244 | 41 | } |