Michael Parrish
/
EMBEDDED4180
part1
hardware.h@1:4bf1976e3a53, 2022-09-01 (annotated)
- Committer:
- mparrish33
- Date:
- Thu Sep 01 20:44:40 2022 +0000
- Revision:
- 1:4bf1976e3a53
- Parent:
- 0:b7d1c13154a3
part1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mparrish33 | 0:b7d1c13154a3 | 1 | #ifndef HARDWARE_H |
mparrish33 | 0:b7d1c13154a3 | 2 | #define HARDWARE_H |
mparrish33 | 0:b7d1c13154a3 | 3 | |
mparrish33 | 0:b7d1c13154a3 | 4 | /** |
mparrish33 | 0:b7d1c13154a3 | 5 | * Structure that represents all the inputs to the game. |
mparrish33 | 0:b7d1c13154a3 | 6 | * If additional hardware is added, new elements should be added to this struct. |
mparrish33 | 0:b7d1c13154a3 | 7 | */ |
mparrish33 | 0:b7d1c13154a3 | 8 | struct UserInputs { |
mparrish33 | 0:b7d1c13154a3 | 9 | int b1, b2, b3, b4; // Button presses |
mparrish33 | 0:b7d1c13154a3 | 10 | double ax, ay, az; // Accelerometer readings |
mparrish33 | 0:b7d1c13154a3 | 11 | }; |
mparrish33 | 0:b7d1c13154a3 | 12 | |
mparrish33 | 0:b7d1c13154a3 | 13 | /** |
mparrish33 | 0:b7d1c13154a3 | 14 | * Initialize all the hardware. |
mparrish33 | 0:b7d1c13154a3 | 15 | */ |
mparrish33 | 0:b7d1c13154a3 | 16 | int hardware_init(); |
mparrish33 | 0:b7d1c13154a3 | 17 | |
mparrish33 | 0:b7d1c13154a3 | 18 | /** |
mparrish33 | 0:b7d1c13154a3 | 19 | * Read all the user inputs. |
mparrish33 | 0:b7d1c13154a3 | 20 | * This is all input hardware interaction should happen. |
mparrish33 | 0:b7d1c13154a3 | 21 | * Returns a GameInputs struct that has all the inputs recorded. |
mparrish33 | 0:b7d1c13154a3 | 22 | * This GameInputs is used elsewhere to compute the game update. |
mparrish33 | 0:b7d1c13154a3 | 23 | */ |
mparrish33 | 0:b7d1c13154a3 | 24 | UserInputs read_inputs(); |
mparrish33 | 0:b7d1c13154a3 | 25 | |
mparrish33 | 0:b7d1c13154a3 | 26 | #endif // HARDWARE_H |