Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
ak7401ctrl.h@13:d008249f0359, 2016-08-12 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Fri Aug 12 00:04:48 2016 +0000
- Revision:
- 13:d008249f0359
- Parent:
- 10:5c69b067d88a
- Child:
- 23:50c98b286e41
- Child:
- 27:41aa9fb23a2f
Ver008. Modified for faster BLE connection, and sensor name in the BLE device name.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 10:5c69b067d88a | 1 | #ifndef AK7401CTRL_H |
masahikofukasawa | 10:5c69b067d88a | 2 | #define AK7401CTRL_H |
masahikofukasawa | 10:5c69b067d88a | 3 | |
masahikofukasawa | 10:5c69b067d88a | 4 | #include "mbed.h" |
masahikofukasawa | 10:5c69b067d88a | 5 | #include "SerialNano.h" |
masahikofukasawa | 10:5c69b067d88a | 6 | #include "akmsensor.h" |
masahikofukasawa | 10:5c69b067d88a | 7 | #include "ak7401.h" |
masahikofukasawa | 10:5c69b067d88a | 8 | |
masahikofukasawa | 10:5c69b067d88a | 9 | class Ak7401Ctrl : public AkmSensor |
masahikofukasawa | 10:5c69b067d88a | 10 | { |
masahikofukasawa | 10:5c69b067d88a | 11 | |
masahikofukasawa | 10:5c69b067d88a | 12 | public: |
masahikofukasawa | 10:5c69b067d88a | 13 | |
masahikofukasawa | 10:5c69b067d88a | 14 | typedef enum { |
masahikofukasawa | 10:5c69b067d88a | 15 | SUB_ID_AK7401 = 0x02, |
masahikofukasawa | 10:5c69b067d88a | 16 | } SubIdAngleSensor; |
masahikofukasawa | 10:5c69b067d88a | 17 | |
masahikofukasawa | 10:5c69b067d88a | 18 | /** |
masahikofukasawa | 10:5c69b067d88a | 19 | * Constructor. |
masahikofukasawa | 10:5c69b067d88a | 20 | * |
masahikofukasawa | 10:5c69b067d88a | 21 | */ |
masahikofukasawa | 10:5c69b067d88a | 22 | Ak7401Ctrl(); |
masahikofukasawa | 10:5c69b067d88a | 23 | |
masahikofukasawa | 10:5c69b067d88a | 24 | /** |
masahikofukasawa | 10:5c69b067d88a | 25 | * Destructor. |
masahikofukasawa | 10:5c69b067d88a | 26 | * |
masahikofukasawa | 10:5c69b067d88a | 27 | */ |
masahikofukasawa | 10:5c69b067d88a | 28 | virtual ~Ak7401Ctrl(); |
masahikofukasawa | 10:5c69b067d88a | 29 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
masahikofukasawa | 10:5c69b067d88a | 30 | virtual bool isEvent(); |
masahikofukasawa | 10:5c69b067d88a | 31 | virtual AkmSensor::Status startSensor(); |
masahikofukasawa | 10:5c69b067d88a | 32 | virtual AkmSensor::Status startSensor(const float sec); |
masahikofukasawa | 10:5c69b067d88a | 33 | virtual AkmSensor::Status stopSensor(); |
masahikofukasawa | 10:5c69b067d88a | 34 | virtual AkmSensor::Status readSensorData(Message* msg); |
masahikofukasawa | 10:5c69b067d88a | 35 | virtual Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 13:d008249f0359 | 36 | virtual char* getSensorName(); |
masahikofukasawa | 13:d008249f0359 | 37 | |
masahikofukasawa | 10:5c69b067d88a | 38 | void eventCallback(); |
masahikofukasawa | 10:5c69b067d88a | 39 | |
masahikofukasawa | 10:5c69b067d88a | 40 | private: |
masahikofukasawa | 10:5c69b067d88a | 41 | bool event; |
masahikofukasawa | 10:5c69b067d88a | 42 | uint8_t primaryId; |
masahikofukasawa | 10:5c69b067d88a | 43 | uint8_t subId; |
masahikofukasawa | 13:d008249f0359 | 44 | char* sensorName; |
masahikofukasawa | 10:5c69b067d88a | 45 | |
masahikofukasawa | 10:5c69b067d88a | 46 | Ticker ticker; |
masahikofukasawa | 10:5c69b067d88a | 47 | AK7401* ak7401; |
masahikofukasawa | 10:5c69b067d88a | 48 | float interval; |
masahikofukasawa | 10:5c69b067d88a | 49 | }; |
masahikofukasawa | 10:5c69b067d88a | 50 | |
masahikofukasawa | 10:5c69b067d88a | 51 | #endif |