Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial
Fork of APP3_Lab by
sensors.h@21:04fae6a95131, 2017-10-02 (annotated)
- Committer:
- Cheroukee
- Date:
- Mon Oct 02 16:54:00 2017 +0000
- Revision:
- 21:04fae6a95131
- Parent:
- 18:b5025ff33345
- Child:
- 28:322985c7e428
Working sensor specific formatting
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JayMcGee | 7:b054ce191070 | 1 | #include "mbed.h" |
| Cheroukee | 8:5955af1ee445 | 2 | #include "MMA8452Q/MMA8452Q.h" |
| JayMcGee | 7:b054ce191070 | 3 | |
| Cheroukee | 21:04fae6a95131 | 4 | typedef enum{ |
| Cheroukee | 21:04fae6a95131 | 5 | type_bouton = 1, |
| Cheroukee | 21:04fae6a95131 | 6 | type_accelerometre = 2 |
| Cheroukee | 21:04fae6a95131 | 7 | } sensor_type_t; |
| JayMcGee | 18:b5025ff33345 | 8 | |
| Cheroukee | 13:5f21dd134bd2 | 9 | struct Accel_result |
| Cheroukee | 13:5f21dd134bd2 | 10 | { |
| Cheroukee | 13:5f21dd134bd2 | 11 | float x; |
| Cheroukee | 13:5f21dd134bd2 | 12 | float y; |
| Cheroukee | 13:5f21dd134bd2 | 13 | float z; |
| Cheroukee | 13:5f21dd134bd2 | 14 | }; |
| Cheroukee | 13:5f21dd134bd2 | 15 | |
| Cheroukee | 13:5f21dd134bd2 | 16 | struct Bouton_result |
| Cheroukee | 13:5f21dd134bd2 | 17 | { |
| Cheroukee | 21:04fae6a95131 | 18 | int etat; |
| Cheroukee | 13:5f21dd134bd2 | 19 | }; |
| Cheroukee | 13:5f21dd134bd2 | 20 | |
| Cheroukee | 21:04fae6a95131 | 21 | typedef union |
| Cheroukee | 13:5f21dd134bd2 | 22 | { |
| Cheroukee | 13:5f21dd134bd2 | 23 | struct Accel_result Accelerometre; |
| Cheroukee | 13:5f21dd134bd2 | 24 | struct Bouton_result Bouton; |
| Cheroukee | 21:04fae6a95131 | 25 | } sensor_union_t; |
| Cheroukee | 13:5f21dd134bd2 | 26 | |
| Cheroukee | 21:04fae6a95131 | 27 | typedef struct { |
| Cheroukee | 21:04fae6a95131 | 28 | sensor_type_t sensor_type; |
| Cheroukee | 21:04fae6a95131 | 29 | sensor_union_t sensor_result; |
| Cheroukee | 21:04fae6a95131 | 30 | } sensor_t; |
| Cheroukee | 21:04fae6a95131 | 31 | |
| Cheroukee | 21:04fae6a95131 | 32 | extern sensor_t (*p[2])(); |
| Cheroukee | 13:5f21dd134bd2 | 33 | |
| JayMcGee | 7:b054ce191070 | 34 | // Accelerometer - SDA, SCL, and I2C address |
| Cheroukee | 9:3631d3685cfa | 35 | |
| Cheroukee | 21:04fae6a95131 | 36 | void initialize_sensors(); |
