Modified for compatibility with Rev.E. hardware

Fork of AkmSensor by AKM Development Platform

Committer:
tkstreet
Date:
Tue May 01 21:31:15 2018 +0000
Revision:
49:c8f8946129b6
Parent:
43:45225713cd58
Modified for Rev.E. compatibility.

Who changed what in which revision?

UserRevisionLine numberNew 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 "akmsensor.h"
masahikofukasawa 0:7a00359e701e 6 #include "ak7451.h"
masahikofukasawa 0:7a00359e701e 7
tkstreet 23:50c98b286e41 8 /**
tkstreet 23:50c98b286e41 9 * Class for handling commands issued to the AK7451.
tkstreet 23:50c98b286e41 10 */
masahikofukasawa 11:cef8dc1cf010 11 class Ak7451Ctrl : public AkmSensor
masahikofukasawa 0:7a00359e701e 12 {
masahikofukasawa 0:7a00359e701e 13
masahikofukasawa 0:7a00359e701e 14 public:
tkstreet 23:50c98b286e41 15
masahikofukasawa 29:b488d2c89fba 16 typedef AkmSensor base;
masahikofukasawa 0:7a00359e701e 17
tkstreet 23:50c98b286e41 18 /**
tkstreet 23:50c98b286e41 19 * Device Sub-ID.
tkstreet 23:50c98b286e41 20 */
masahikofukasawa 0:7a00359e701e 21 typedef enum {
tkstreet 23:50c98b286e41 22 SUB_ID_AK7451 = 0x01, /**< AK7451: ID = 01h */
masahikofukasawa 0:7a00359e701e 23 } SubIdAngleSensor;
masahikofukasawa 0:7a00359e701e 24
masahikofukasawa 0:7a00359e701e 25 /**
masahikofukasawa 0:7a00359e701e 26 * Constructor.
masahikofukasawa 0:7a00359e701e 27 *
masahikofukasawa 0:7a00359e701e 28 */
masahikofukasawa 11:cef8dc1cf010 29 Ak7451Ctrl();
masahikofukasawa 0:7a00359e701e 30
masahikofukasawa 0:7a00359e701e 31 /**
masahikofukasawa 0:7a00359e701e 32 * Destructor.
masahikofukasawa 0:7a00359e701e 33 *
masahikofukasawa 0:7a00359e701e 34 */
masahikofukasawa 11:cef8dc1cf010 35 virtual ~Ak7451Ctrl();
tkstreet 23:50c98b286e41 36
tkstreet 23:50c98b286e41 37 /**
tkstreet 23:50c98b286e41 38 * Process for intializing the selected sensor.
tkstreet 23:50c98b286e41 39 *
tkstreet 23:50c98b286e41 40 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 41 */
masahikofukasawa 0:7a00359e701e 42 virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid);
tkstreet 34:1ea3357c8d9a 43
tkstreet 23:50c98b286e41 44 /**
tkstreet 23:50c98b286e41 45 * Process abstraction for starting sensor operation.
tkstreet 23:50c98b286e41 46 *
tkstreet 23:50c98b286e41 47 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 48 */
masahikofukasawa 0:7a00359e701e 49 virtual AkmSensor::Status startSensor();
tkstreet 23:50c98b286e41 50
tkstreet 23:50c98b286e41 51 /**
tkstreet 23:50c98b286e41 52 * Process abstraction for starting sensor operation.
tkstreet 23:50c98b286e41 53 *
tkstreet 23:50c98b286e41 54 * @param sec Number of seconds of operation.
tkstreet 23:50c98b286e41 55 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 56 */
masahikofukasawa 0:7a00359e701e 57 virtual AkmSensor::Status startSensor(const float sec);
tkstreet 23:50c98b286e41 58
tkstreet 23:50c98b286e41 59 /**
tkstreet 23:50c98b286e41 60 * Process abstraction for stopping sensor operation.
tkstreet 23:50c98b286e41 61 *
tkstreet 23:50c98b286e41 62 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 63 */
masahikofukasawa 0:7a00359e701e 64 virtual AkmSensor::Status stopSensor();
tkstreet 23:50c98b286e41 65
tkstreet 23:50c98b286e41 66 /**
tkstreet 23:50c98b286e41 67 * Process abstraction for reading data from the sensor.
tkstreet 23:50c98b286e41 68 *
tkstreet 23:50c98b286e41 69 * @param msg Message object that will hold the sensor data.
tkstreet 23:50c98b286e41 70 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 71 */
masahikofukasawa 0:7a00359e701e 72 virtual AkmSensor::Status readSensorData(Message* msg);
tkstreet 23:50c98b286e41 73
tkstreet 23:50c98b286e41 74 /**
tkstreet 23:50c98b286e41 75 * Primary process for interfacing a sensor with the AKDP. When implemented
tkstreet 23:50c98b286e41 76 * in sensor class, it will transfer commands between the the sensor control
tkstreet 23:50c98b286e41 77 * class and AkmSensorManager.
tkstreet 23:50c98b286e41 78 *
tkstreet 23:50c98b286e41 79 * @param in Command message to be processed by sensor.
tkstreet 23:50c98b286e41 80 * @param out Message returned from sensor.
tkstreet 23:50c98b286e41 81 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 82 */
masahikofukasawa 0:7a00359e701e 83 virtual Status requestCommand(Message* in, Message* out);
masahikofukasawa 0:7a00359e701e 84
masahikofukasawa 0:7a00359e701e 85 private:
masahikofukasawa 0:7a00359e701e 86 Ticker ticker;
masahikofukasawa 0:7a00359e701e 87 AK7451* ak7451;
masahikofukasawa 0:7a00359e701e 88 float interval;
masahikofukasawa 0:7a00359e701e 89 };
masahikofukasawa 0:7a00359e701e 90
masahikofukasawa 0:7a00359e701e 91 #endif