Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
ak09970ctrl.h@27:41aa9fb23a2f, 2017-03-11 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Sat Mar 11 01:14:15 2017 +0000
- Revision:
- 27:41aa9fb23a2f
- Parent:
- 13:d008249f0359
- Child:
- 29:b488d2c89fba
modified for multi sensor demo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 10:5c69b067d88a | 1 | #ifndef AK09970CTRL_H |
masahikofukasawa | 10:5c69b067d88a | 2 | #define AK09970CTRL_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 "ak09970.h" |
masahikofukasawa | 10:5c69b067d88a | 8 | |
masahikofukasawa | 10:5c69b067d88a | 9 | class Ak09970Ctrl : public AkmSensor |
masahikofukasawa | 10:5c69b067d88a | 10 | { |
masahikofukasawa | 10:5c69b067d88a | 11 | |
masahikofukasawa | 10:5c69b067d88a | 12 | public: |
masahikofukasawa | 10:5c69b067d88a | 13 | |
masahikofukasawa | 10:5c69b067d88a | 14 | // SUB ID |
masahikofukasawa | 10:5c69b067d88a | 15 | typedef enum { // 5bit ID |
masahikofukasawa | 10:5c69b067d88a | 16 | SUB_ID_AK09970 = 0x03, // 3 |
masahikofukasawa | 10:5c69b067d88a | 17 | } SubIdSwitch; |
masahikofukasawa | 10:5c69b067d88a | 18 | |
masahikofukasawa | 10:5c69b067d88a | 19 | /** |
masahikofukasawa | 10:5c69b067d88a | 20 | * Constructor. |
masahikofukasawa | 10:5c69b067d88a | 21 | * |
masahikofukasawa | 10:5c69b067d88a | 22 | */ |
masahikofukasawa | 10:5c69b067d88a | 23 | Ak09970Ctrl(); |
masahikofukasawa | 10:5c69b067d88a | 24 | |
masahikofukasawa | 10:5c69b067d88a | 25 | /** |
masahikofukasawa | 10:5c69b067d88a | 26 | * Destructor. |
masahikofukasawa | 10:5c69b067d88a | 27 | * |
masahikofukasawa | 10:5c69b067d88a | 28 | */ |
masahikofukasawa | 10:5c69b067d88a | 29 | virtual ~Ak09970Ctrl(); |
masahikofukasawa | 10:5c69b067d88a | 30 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
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 AkmSensor::Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 10:5c69b067d88a | 36 | |
masahikofukasawa | 10:5c69b067d88a | 37 | void checkINT(); |
masahikofukasawa | 10:5c69b067d88a | 38 | void detectINT(); |
masahikofukasawa | 10:5c69b067d88a | 39 | |
masahikofukasawa | 10:5c69b067d88a | 40 | private: |
masahikofukasawa | 10:5c69b067d88a | 41 | AK09970* ak09970; |
masahikofukasawa | 10:5c69b067d88a | 42 | |
masahikofukasawa | 10:5c69b067d88a | 43 | // hold settings for AK09970 |
masahikofukasawa | 10:5c69b067d88a | 44 | AK09970::Threshold threshold; |
masahikofukasawa | 10:5c69b067d88a | 45 | AK09970::OperationMode mode; |
masahikofukasawa | 10:5c69b067d88a | 46 | AK09970::SensorDriveMode sensorDriveMode; |
masahikofukasawa | 10:5c69b067d88a | 47 | AK09970::SensorMeasurementRange sensorMeasurementRange; |
masahikofukasawa | 10:5c69b067d88a | 48 | AK09970::ReadConfig readConfig; |
masahikofukasawa | 10:5c69b067d88a | 49 | AK09970::SwitchConfig switchConfig; |
masahikofukasawa | 10:5c69b067d88a | 50 | |
masahikofukasawa | 10:5c69b067d88a | 51 | InterruptIn* sw; |
masahikofukasawa | 10:5c69b067d88a | 52 | }; |
masahikofukasawa | 10:5c69b067d88a | 53 | |
masahikofukasawa | 10:5c69b067d88a | 54 | #endif |
masahikofukasawa | 10:5c69b067d88a | 55 |