Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmanalogsensor.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 | 11:cef8dc1cf010 | 1 | #ifndef AKMANALOGSENSOR_H |
masahikofukasawa | 11:cef8dc1cf010 | 2 | #define AKMANALOGSENSOR_H |
masahikofukasawa | 11:cef8dc1cf010 | 3 | |
masahikofukasawa | 11:cef8dc1cf010 | 4 | #include "mbed.h" |
masahikofukasawa | 11:cef8dc1cf010 | 5 | #include "SerialNano.h" |
masahikofukasawa | 11:cef8dc1cf010 | 6 | #include "akmsensor.h" |
masahikofukasawa | 11:cef8dc1cf010 | 7 | #include "mcp342x.h" |
masahikofukasawa | 11:cef8dc1cf010 | 8 | |
masahikofukasawa | 11:cef8dc1cf010 | 9 | class AkmAnalogSensor : public AkmSensor |
masahikofukasawa | 11:cef8dc1cf010 | 10 | { |
masahikofukasawa | 11:cef8dc1cf010 | 11 | |
masahikofukasawa | 11:cef8dc1cf010 | 12 | public: |
masahikofukasawa | 11:cef8dc1cf010 | 13 | typedef enum { |
masahikofukasawa | 13:d008249f0359 | 14 | SUB_ID_CQ3300 = 0x01, |
masahikofukasawa | 13:d008249f0359 | 15 | SUB_ID_CQ3301 = 0x02, |
masahikofukasawa | 13:d008249f0359 | 16 | SUB_ID_CQ3302 = 0x03, |
masahikofukasawa | 13:d008249f0359 | 17 | SUB_ID_CQ3303 = 0x04, |
masahikofukasawa | 13:d008249f0359 | 18 | SUB_ID_CQ330A = 0x05, |
masahikofukasawa | 13:d008249f0359 | 19 | SUB_ID_CQ330B = 0x06, |
masahikofukasawa | 13:d008249f0359 | 20 | SUB_ID_CQ330E = 0x07, |
masahikofukasawa | 13:d008249f0359 | 21 | SUB_ID_CQ330F = 0x08, |
masahikofukasawa | 13:d008249f0359 | 22 | SUB_ID_CQ330G = 0x09, |
masahikofukasawa | 13:d008249f0359 | 23 | SUB_ID_CQ330H = 0x0A, |
masahikofukasawa | 13:d008249f0359 | 24 | } SubIdCurrentSensor; |
masahikofukasawa | 13:d008249f0359 | 25 | |
masahikofukasawa | 13:d008249f0359 | 26 | typedef enum { |
masahikofukasawa | 13:d008249f0359 | 27 | SUB_ID_EM3242 = 0x01, |
masahikofukasawa | 13:d008249f0359 | 28 | SUB_ID_AK9710 = 0x08, |
masahikofukasawa | 13:d008249f0359 | 29 | } SubIdMisc; |
masahikofukasawa | 13:d008249f0359 | 30 | |
masahikofukasawa | 13:d008249f0359 | 31 | typedef enum { |
masahikofukasawa | 13:d008249f0359 | 32 | SUB_ID_EQ430L = 0x01, |
masahikofukasawa | 13:d008249f0359 | 33 | SUB_ID_EQ431L = 0x02, |
masahikofukasawa | 13:d008249f0359 | 34 | SUB_ID_EQ432L = 0x03, |
masahikofukasawa | 13:d008249f0359 | 35 | SUB_ID_EQ433L = 0x04, |
masahikofukasawa | 11:cef8dc1cf010 | 36 | } SubIdLinearSensor; |
masahikofukasawa | 11:cef8dc1cf010 | 37 | |
masahikofukasawa | 11:cef8dc1cf010 | 38 | /** |
masahikofukasawa | 11:cef8dc1cf010 | 39 | * Constructor. |
masahikofukasawa | 11:cef8dc1cf010 | 40 | * |
masahikofukasawa | 11:cef8dc1cf010 | 41 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 42 | AkmAnalogSensor(); |
masahikofukasawa | 11:cef8dc1cf010 | 43 | |
masahikofukasawa | 11:cef8dc1cf010 | 44 | /** |
masahikofukasawa | 11:cef8dc1cf010 | 45 | * Destructor. |
masahikofukasawa | 11:cef8dc1cf010 | 46 | * |
masahikofukasawa | 11:cef8dc1cf010 | 47 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 48 | virtual ~AkmAnalogSensor(); |
masahikofukasawa | 11:cef8dc1cf010 | 49 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
masahikofukasawa | 11:cef8dc1cf010 | 50 | virtual AkmSensor::Status startSensor(); |
masahikofukasawa | 11:cef8dc1cf010 | 51 | virtual AkmSensor::Status startSensor(const float sec); |
masahikofukasawa | 11:cef8dc1cf010 | 52 | virtual AkmSensor::Status stopSensor(); |
masahikofukasawa | 11:cef8dc1cf010 | 53 | virtual AkmSensor::Status readSensorData(Message* msg); |
masahikofukasawa | 11:cef8dc1cf010 | 54 | virtual Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 13:d008249f0359 | 55 | |
masahikofukasawa | 11:cef8dc1cf010 | 56 | void eventCallback(); |
masahikofukasawa | 11:cef8dc1cf010 | 57 | |
masahikofukasawa | 11:cef8dc1cf010 | 58 | private: |
masahikofukasawa | 11:cef8dc1cf010 | 59 | Ticker ticker; |
masahikofukasawa | 11:cef8dc1cf010 | 60 | AnalogIn* ain; |
masahikofukasawa | 11:cef8dc1cf010 | 61 | MCP342X* mcp3428; |
masahikofukasawa | 11:cef8dc1cf010 | 62 | float interval; |
masahikofukasawa | 11:cef8dc1cf010 | 63 | }; |
masahikofukasawa | 11:cef8dc1cf010 | 64 | |
masahikofukasawa | 11:cef8dc1cf010 | 65 | #endif |