Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
ak7451ctrl.h@34:1ea3357c8d9a, 2017-05-03 (annotated)
- Committer:
- tkstreet
- Date:
- Wed May 03 18:00:45 2017 +0000
- Revision:
- 34:1ea3357c8d9a
- Parent:
- 29:b488d2c89fba
- Parent:
- 23:50c98b286e41
- Child:
- 43:45225713cd58
Release RevD7.015. Merged D7.014 with new documentation and updates to AP1017 driver.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 11:cef8dc1cf010 | 1 | #ifndef AK7451CTRL_H |
masahikofukasawa | 11:cef8dc1cf010 | 2 | #define AK7451CTRL_H |
masahikofukasawa | 0:7a00359e701e | 3 | |
masahikofukasawa | 0:7a00359e701e | 4 | #include "mbed.h" |
masahikofukasawa | 0:7a00359e701e | 5 | #include "SerialNano.h" |
masahikofukasawa | 0:7a00359e701e | 6 | #include "akmsensor.h" |
masahikofukasawa | 0:7a00359e701e | 7 | #include "ak7451.h" |
masahikofukasawa | 0:7a00359e701e | 8 | |
tkstreet | 23:50c98b286e41 | 9 | /** |
tkstreet | 23:50c98b286e41 | 10 | * Class for handling commands issued to the AK7451. |
tkstreet | 23:50c98b286e41 | 11 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 12 | class Ak7451Ctrl : public AkmSensor |
masahikofukasawa | 0:7a00359e701e | 13 | { |
masahikofukasawa | 0:7a00359e701e | 14 | |
masahikofukasawa | 0:7a00359e701e | 15 | public: |
tkstreet | 23:50c98b286e41 | 16 | |
masahikofukasawa | 29:b488d2c89fba | 17 | typedef AkmSensor base; |
masahikofukasawa | 0:7a00359e701e | 18 | |
tkstreet | 23:50c98b286e41 | 19 | /** |
tkstreet | 23:50c98b286e41 | 20 | * Device Sub-ID. |
tkstreet | 23:50c98b286e41 | 21 | */ |
masahikofukasawa | 0:7a00359e701e | 22 | typedef enum { |
tkstreet | 23:50c98b286e41 | 23 | SUB_ID_AK7451 = 0x01, /**< AK7451: ID = 01h */ |
masahikofukasawa | 0:7a00359e701e | 24 | } SubIdAngleSensor; |
masahikofukasawa | 0:7a00359e701e | 25 | |
masahikofukasawa | 0:7a00359e701e | 26 | /** |
masahikofukasawa | 0:7a00359e701e | 27 | * Constructor. |
masahikofukasawa | 0:7a00359e701e | 28 | * |
masahikofukasawa | 0:7a00359e701e | 29 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 30 | Ak7451Ctrl(); |
masahikofukasawa | 0:7a00359e701e | 31 | |
masahikofukasawa | 0:7a00359e701e | 32 | /** |
masahikofukasawa | 0:7a00359e701e | 33 | * Destructor. |
masahikofukasawa | 0:7a00359e701e | 34 | * |
masahikofukasawa | 0:7a00359e701e | 35 | */ |
masahikofukasawa | 11:cef8dc1cf010 | 36 | virtual ~Ak7451Ctrl(); |
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 | 0:7a00359e701e | 43 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
tkstreet | 34:1ea3357c8d9a | 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 | 0:7a00359e701e | 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 | 0:7a00359e701e | 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 | 0:7a00359e701e | 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 | 0:7a00359e701e | 73 | virtual AkmSensor::Status readSensorData(Message* msg); |
tkstreet | 23:50c98b286e41 | 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 | 0:7a00359e701e | 84 | virtual Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 0:7a00359e701e | 85 | |
masahikofukasawa | 0:7a00359e701e | 86 | private: |
masahikofukasawa | 0:7a00359e701e | 87 | Ticker ticker; |
masahikofukasawa | 0:7a00359e701e | 88 | AK7451* ak7451; |
masahikofukasawa | 0:7a00359e701e | 89 | float interval; |
masahikofukasawa | 0:7a00359e701e | 90 | }; |
masahikofukasawa | 0:7a00359e701e | 91 | |
masahikofukasawa | 0:7a00359e701e | 92 | #endif |