Early commits of my project
Dependencies: mbed Gamepad N5110
main.cpp@1:c80162894831, 2019-03-11 (annotated)
- Committer:
- el17arm
- Date:
- Mon Mar 11 19:29:50 2019 +0000
- Revision:
- 1:c80162894831
- Parent:
- 0:9e5f9e1c8ef9
- Child:
- 2:ba653520a140
added contrast as a separate function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17arm | 0:9e5f9e1c8ef9 | 1 | #include "main.h" |
el17arm | 0:9e5f9e1c8ef9 | 2 | #include "N5110.h" |
el17arm | 0:9e5f9e1c8ef9 | 3 | #include "Joystick.h" |
el17arm | 0:9e5f9e1c8ef9 | 4 | |
el17arm | 0:9e5f9e1c8ef9 | 5 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
el17arm | 0:9e5f9e1c8ef9 | 6 | Joystick joystick(PTB10,PTB11,PTC16); |
el17arm | 1:c80162894831 | 7 | AnalogIn pot0(PTB2); |
el17arm | 0:9e5f9e1c8ef9 | 8 | DigitalIn joy_button(PTC16); |
el17arm | 0:9e5f9e1c8ef9 | 9 | BusOut front_leds(PTA1,PTA2,PTC2,PTC3,PTC4, PTD3); |
el17arm | 0:9e5f9e1c8ef9 | 10 | |
el17arm | 0:9e5f9e1c8ef9 | 11 | int main() |
el17arm | 0:9e5f9e1c8ef9 | 12 | { |
el17arm | 0:9e5f9e1c8ef9 | 13 | init(); |
el17arm | 0:9e5f9e1c8ef9 | 14 | |
el17arm | 1:c80162894831 | 15 | |
el17arm | 1:c80162894831 | 16 | |
el17arm | 0:9e5f9e1c8ef9 | 17 | while (1) { |
el17arm | 1:c80162894831 | 18 | |
el17arm | 1:c80162894831 | 19 | contrast(); |
el17arm | 0:9e5f9e1c8ef9 | 20 | } |
el17arm | 0:9e5f9e1c8ef9 | 21 | |
el17arm | 0:9e5f9e1c8ef9 | 22 | } |
el17arm | 0:9e5f9e1c8ef9 | 23 | |
el17arm | 0:9e5f9e1c8ef9 | 24 | void init() |
el17arm | 0:9e5f9e1c8ef9 | 25 | { |
el17arm | 0:9e5f9e1c8ef9 | 26 | lcd.init(); |
el17arm | 1:c80162894831 | 27 | lcd.normalMode(); // normal colour mode |
el17arm | 1:c80162894831 | 28 | lcd.setBrightness(0.5); // put LED backlight on 50% |
el17arm | 1:c80162894831 | 29 | lcd.refresh(); |
el17arm | 1:c80162894831 | 30 | |
el17arm | 1:c80162894831 | 31 | joystick.init(); |
el17arm | 0:9e5f9e1c8ef9 | 32 | front_leds = 0b111111; |
el17arm | 1:c80162894831 | 33 | } |
el17arm | 1:c80162894831 | 34 | |
el17arm | 1:c80162894831 | 35 | void contrast() |
el17arm | 1:c80162894831 | 36 | { |
el17arm | 1:c80162894831 | 37 | lcd.refresh(); |
el17arm | 1:c80162894831 | 38 | float con = pot0.read(); |
el17arm | 1:c80162894831 | 39 | lcd.setContrast(con); |
el17arm | 1:c80162894831 | 40 | |
el17arm | 0:9e5f9e1c8ef9 | 41 | } |