Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
ak9750ctrl.h@39:3821886c902e, 2017-07-18 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Tue Jul 18 23:20:26 2017 +0000
- Revision:
- 39:3821886c902e
- Parent:
- 34:1ea3357c8d9a
For AK09970 Small demo board. Takezawa-san's request.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 10:5c69b067d88a | 1 | #ifndef AK9750CTRL_H |
masahikofukasawa | 10:5c69b067d88a | 2 | #define AK9750CTRL_H |
masahikofukasawa | 10:5c69b067d88a | 3 | |
masahikofukasawa | 10:5c69b067d88a | 4 | #include "mbed.h" |
masahikofukasawa | 10:5c69b067d88a | 5 | #include "akmsensor.h" |
masahikofukasawa | 10:5c69b067d88a | 6 | #include "AK9750.h" |
masahikofukasawa | 10:5c69b067d88a | 7 | |
tkstreet | 23:50c98b286e41 | 8 | /** |
tkstreet | 23:50c98b286e41 | 9 | * Class for handling commands issued to the AK9750/AK9753. |
tkstreet | 23:50c98b286e41 | 10 | */ |
masahikofukasawa | 10:5c69b067d88a | 11 | class Ak9750Ctrl : public AkmSensor |
masahikofukasawa | 10:5c69b067d88a | 12 | { |
masahikofukasawa | 10:5c69b067d88a | 13 | |
masahikofukasawa | 10:5c69b067d88a | 14 | public: |
masahikofukasawa | 29:b488d2c89fba | 15 | |
masahikofukasawa | 29:b488d2c89fba | 16 | typedef AkmSensor base; |
masahikofukasawa | 10:5c69b067d88a | 17 | |
tkstreet | 23:50c98b286e41 | 18 | /** |
tkstreet | 23:50c98b286e41 | 19 | * Device Sub-IDs. |
tkstreet | 23:50c98b286e41 | 20 | */ |
masahikofukasawa | 10:5c69b067d88a | 21 | typedef enum { |
tkstreet | 23:50c98b286e41 | 22 | SUB_ID_AK9750 = 0x01, /**< AK9750: ID = 01h */ |
tkstreet | 23:50c98b286e41 | 23 | SUB_ID_AK9753 = 0x03, /**< AK9753: ID = 03h */ |
masahikofukasawa | 10:5c69b067d88a | 24 | } SubIdIrSensor; |
masahikofukasawa | 10:5c69b067d88a | 25 | |
masahikofukasawa | 10:5c69b067d88a | 26 | /** |
masahikofukasawa | 10:5c69b067d88a | 27 | * Constructor. |
masahikofukasawa | 10:5c69b067d88a | 28 | * |
masahikofukasawa | 10:5c69b067d88a | 29 | */ |
masahikofukasawa | 10:5c69b067d88a | 30 | Ak9750Ctrl(); |
masahikofukasawa | 10:5c69b067d88a | 31 | |
masahikofukasawa | 10:5c69b067d88a | 32 | /** |
masahikofukasawa | 10:5c69b067d88a | 33 | * Destructor. |
masahikofukasawa | 10:5c69b067d88a | 34 | * |
masahikofukasawa | 10:5c69b067d88a | 35 | */ |
masahikofukasawa | 10:5c69b067d88a | 36 | virtual ~Ak9750Ctrl(); |
tkstreet | 23:50c98b286e41 | 37 | |
tkstreet | 23:50c98b286e41 | 38 | /** |
tkstreet | 23:50c98b286e41 | 39 | * Process for intializing the selected sensor. |
tkstreet | 23:50c98b286e41 | 40 | * |
tkstreet | 23:50c98b286e41 | 41 | * @return Termination status type for debugging purposes. |
tkstreet | 23:50c98b286e41 | 42 | */ |
masahikofukasawa | 10:5c69b067d88a | 43 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
tkstreet | 23:50c98b286e41 | 44 | |
tkstreet | 23:50c98b286e41 | 45 | /** |
tkstreet | 23:50c98b286e41 | 46 | * Process abstraction for starting sensor operation. |
tkstreet | 23:50c98b286e41 | 47 | * |
tkstreet | 23:50c98b286e41 | 48 | * @return Termination status type for debugging purposes. |
tkstreet | 23:50c98b286e41 | 49 | */ |
masahikofukasawa | 10:5c69b067d88a | 50 | virtual AkmSensor::Status startSensor(); |
tkstreet | 23:50c98b286e41 | 51 | |
tkstreet | 23:50c98b286e41 | 52 | /** |
tkstreet | 23:50c98b286e41 | 53 | * Process abstraction for starting sensor operation. |
tkstreet | 23:50c98b286e41 | 54 | * |
tkstreet | 23:50c98b286e41 | 55 | * @param sec Number of seconds of operation. |
tkstreet | 23:50c98b286e41 | 56 | * @return Termination status type for debugging purposes. |
tkstreet | 23:50c98b286e41 | 57 | */ |
masahikofukasawa | 10:5c69b067d88a | 58 | virtual AkmSensor::Status startSensor(const float sec); |
tkstreet | 23:50c98b286e41 | 59 | |
tkstreet | 23:50c98b286e41 | 60 | /** |
tkstreet | 23:50c98b286e41 | 61 | * Process abstraction for stopping sensor operation. |
tkstreet | 23:50c98b286e41 | 62 | * |
tkstreet | 23:50c98b286e41 | 63 | * @return Termination status type for debugging purposes. |
tkstreet | 23:50c98b286e41 | 64 | */ |
masahikofukasawa | 10:5c69b067d88a | 65 | virtual AkmSensor::Status stopSensor(); |
tkstreet | 23:50c98b286e41 | 66 | |
tkstreet | 23:50c98b286e41 | 67 | /** |
tkstreet | 23:50c98b286e41 | 68 | * Process abstraction for reading data from the sensor. |
tkstreet | 23:50c98b286e41 | 69 | * |
tkstreet | 23:50c98b286e41 | 70 | * @param msg Message object that will hold the sensor data. |
tkstreet | 23:50c98b286e41 | 71 | * @return Termination status type for debugging purposes. |
tkstreet | 23:50c98b286e41 | 72 | */ |
masahikofukasawa | 10:5c69b067d88a | 73 | virtual AkmSensor::Status readSensorData(Message* msg); |
tkstreet | 34:1ea3357c8d9a | 74 | |
tkstreet | 23:50c98b286e41 | 75 | /** |
tkstreet | 23:50c98b286e41 | 76 | * Primary process for interfacing a sensor with the AKDP. When implemented |
tkstreet | 23:50c98b286e41 | 77 | * in sensor class, it will transfer commands between the the sensor control |
tkstreet | 23:50c98b286e41 | 78 | * class and AkmSensorManager. |
tkstreet | 23:50c98b286e41 | 79 | * |
tkstreet | 23:50c98b286e41 | 80 | * @param in Command message to be processed by sensor. |
tkstreet | 23:50c98b286e41 | 81 | * @param out Message returned from sensor. |
tkstreet | 23:50c98b286e41 | 82 | * @return Termination status type for debugging purposes. |
tkstreet | 23:50c98b286e41 | 83 | */ |
masahikofukasawa | 10:5c69b067d88a | 84 | virtual AkmSensor::Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 10:5c69b067d88a | 85 | |
tkstreet | 23:50c98b286e41 | 86 | /** |
tkstreet | 34:1ea3357c8d9a | 87 | * Set the event flag. |
tkstreet | 23:50c98b286e41 | 88 | */ |
masahikofukasawa | 29:b488d2c89fba | 89 | virtual void setEvent(); |
tkstreet | 34:1ea3357c8d9a | 90 | |
masahikofukasawa | 10:5c69b067d88a | 91 | private: |
masahikofukasawa | 10:5c69b067d88a | 92 | AK9750* ak9750; |
masahikofukasawa | 10:5c69b067d88a | 93 | |
masahikofukasawa | 10:5c69b067d88a | 94 | // hold settings |
masahikofukasawa | 10:5c69b067d88a | 95 | AK9750::OperationMode mode; |
masahikofukasawa | 10:5c69b067d88a | 96 | AK9750::DigitalFilter filter; |
masahikofukasawa | 10:5c69b067d88a | 97 | }; |
masahikofukasawa | 10:5c69b067d88a | 98 | |
masahikofukasawa | 10:5c69b067d88a | 99 | #endif |