ECE2035 Project 2
Dependencies: mbed mbed-rtos SDFileSystem
hardware.h@10:1994adcfc86f, 2021-04-20 (annotated)
- Committer:
- kwengryn3
- Date:
- Tue Apr 20 18:15:22 2021 +0000
- Revision:
- 10:1994adcfc86f
- Parent:
- 0:bff8b9020128
adv features
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kwengryn3 | 0:bff8b9020128 | 1 | #ifndef HARDWARE_H |
kwengryn3 | 0:bff8b9020128 | 2 | #define HARDWARE_H |
kwengryn3 | 0:bff8b9020128 | 3 | |
kwengryn3 | 0:bff8b9020128 | 4 | /** |
kwengryn3 | 0:bff8b9020128 | 5 | * Structure that represents all the inputs to the game. |
kwengryn3 | 0:bff8b9020128 | 6 | * If additional hardware is added, new elements should be added to this struct. |
kwengryn3 | 0:bff8b9020128 | 7 | */ |
kwengryn3 | 0:bff8b9020128 | 8 | struct GameInputs { |
kwengryn3 | 0:bff8b9020128 | 9 | int b1, b2, b3; // Button presses |
kwengryn3 | 0:bff8b9020128 | 10 | double ax, ay, az; // Accelerometer readings |
kwengryn3 | 0:bff8b9020128 | 11 | }; |
kwengryn3 | 0:bff8b9020128 | 12 | |
kwengryn3 | 0:bff8b9020128 | 13 | /** |
kwengryn3 | 0:bff8b9020128 | 14 | * Initialize all the hardware. |
kwengryn3 | 0:bff8b9020128 | 15 | */ |
kwengryn3 | 0:bff8b9020128 | 16 | int hardware_init(); |
kwengryn3 | 0:bff8b9020128 | 17 | |
kwengryn3 | 0:bff8b9020128 | 18 | /** |
kwengryn3 | 0:bff8b9020128 | 19 | * Read all the user inputs. |
kwengryn3 | 0:bff8b9020128 | 20 | * This is all input hardware interaction should happen. |
kwengryn3 | 0:bff8b9020128 | 21 | * Returns a GameInputs struct that has all the inputs recorded. |
kwengryn3 | 0:bff8b9020128 | 22 | * This GameInputs is used elsewhere to compute the game update. |
kwengryn3 | 0:bff8b9020128 | 23 | */ |
kwengryn3 | 0:bff8b9020128 | 24 | GameInputs read_inputs(); |
kwengryn3 | 0:bff8b9020128 | 25 | |
kwengryn3 | 0:bff8b9020128 | 26 | #endif // HARDWARE_H |