Modified for compatibility with Rev.E. hardware

Fork of AkmSensor by AKM Development Platform

Committer:
tkstreet
Date:
Thu Apr 13 22:15:54 2017 +0000
Revision:
23:50c98b286e41
Parent:
13:d008249f0359
Child:
34:1ea3357c8d9a
Added documentation for all classes

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 "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
tkstreet 23:50c98b286e41 17 /**
tkstreet 23:50c98b286e41 18 * Device Sub-ID.
tkstreet 23:50c98b286e41 19 */
masahikofukasawa 0:7a00359e701e 20 typedef enum {
tkstreet 23:50c98b286e41 21 SUB_ID_AK7451 = 0x01, /**< AK7451: ID = 01h */
masahikofukasawa 0:7a00359e701e 22 } SubIdAngleSensor;
masahikofukasawa 0:7a00359e701e 23
masahikofukasawa 0:7a00359e701e 24 /**
masahikofukasawa 0:7a00359e701e 25 * Constructor.
masahikofukasawa 0:7a00359e701e 26 *
masahikofukasawa 0:7a00359e701e 27 */
masahikofukasawa 11:cef8dc1cf010 28 Ak7451Ctrl();
masahikofukasawa 0:7a00359e701e 29
masahikofukasawa 0:7a00359e701e 30 /**
masahikofukasawa 0:7a00359e701e 31 * Destructor.
masahikofukasawa 0:7a00359e701e 32 *
masahikofukasawa 0:7a00359e701e 33 */
masahikofukasawa 11:cef8dc1cf010 34 virtual ~Ak7451Ctrl();
tkstreet 23:50c98b286e41 35
tkstreet 23:50c98b286e41 36 /**
tkstreet 23:50c98b286e41 37 * Process for intializing the selected sensor.
tkstreet 23:50c98b286e41 38 *
tkstreet 23:50c98b286e41 39 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 40 */
masahikofukasawa 0:7a00359e701e 41 virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid);
tkstreet 23:50c98b286e41 42
tkstreet 23:50c98b286e41 43 /**
tkstreet 23:50c98b286e41 44 * Simple flag process to determine if an event has occurred.
tkstreet 23:50c98b286e41 45 *
tkstreet 23:50c98b286e41 46 * @return TRUE if event has occurred, FALSE if not.
tkstreet 23:50c98b286e41 47 */
masahikofukasawa 0:7a00359e701e 48 virtual bool isEvent();
tkstreet 23:50c98b286e41 49
tkstreet 23:50c98b286e41 50 /**
tkstreet 23:50c98b286e41 51 * Process abstraction for starting sensor operation.
tkstreet 23:50c98b286e41 52 *
tkstreet 23:50c98b286e41 53 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 54 */
masahikofukasawa 0:7a00359e701e 55 virtual AkmSensor::Status startSensor();
tkstreet 23:50c98b286e41 56
tkstreet 23:50c98b286e41 57 /**
tkstreet 23:50c98b286e41 58 * Process abstraction for starting sensor operation.
tkstreet 23:50c98b286e41 59 *
tkstreet 23:50c98b286e41 60 * @param sec Number of seconds of operation.
tkstreet 23:50c98b286e41 61 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 62 */
masahikofukasawa 0:7a00359e701e 63 virtual AkmSensor::Status startSensor(const float sec);
tkstreet 23:50c98b286e41 64
tkstreet 23:50c98b286e41 65 /**
tkstreet 23:50c98b286e41 66 * Process abstraction for stopping sensor operation.
tkstreet 23:50c98b286e41 67 *
tkstreet 23:50c98b286e41 68 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 69 */
masahikofukasawa 0:7a00359e701e 70 virtual AkmSensor::Status stopSensor();
tkstreet 23:50c98b286e41 71
tkstreet 23:50c98b286e41 72 /**
tkstreet 23:50c98b286e41 73 * Process abstraction for reading data from the sensor.
tkstreet 23:50c98b286e41 74 *
tkstreet 23:50c98b286e41 75 * @param msg Message object that will hold the sensor data.
tkstreet 23:50c98b286e41 76 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 77 */
masahikofukasawa 0:7a00359e701e 78 virtual AkmSensor::Status readSensorData(Message* msg);
tkstreet 23:50c98b286e41 79
tkstreet 23:50c98b286e41 80 /**
tkstreet 23:50c98b286e41 81 * Primary process for interfacing a sensor with the AKDP. When implemented
tkstreet 23:50c98b286e41 82 * in sensor class, it will transfer commands between the the sensor control
tkstreet 23:50c98b286e41 83 * class and AkmSensorManager.
tkstreet 23:50c98b286e41 84 *
tkstreet 23:50c98b286e41 85 * @param in Command message to be processed by sensor.
tkstreet 23:50c98b286e41 86 * @param out Message returned from sensor.
tkstreet 23:50c98b286e41 87 * @return Termination status type for debugging purposes.
tkstreet 23:50c98b286e41 88 */
masahikofukasawa 0:7a00359e701e 89 virtual Status requestCommand(Message* in, Message* out);
tkstreet 23:50c98b286e41 90
tkstreet 23:50c98b286e41 91 /**
tkstreet 23:50c98b286e41 92 * Get the name of the sensor in char format.
tkstreet 23:50c98b286e41 93 *
tkstreet 23:50c98b286e41 94 * @return Sensor name as a char array.
tkstreet 23:50c98b286e41 95 */
masahikofukasawa 13:d008249f0359 96 virtual char* getSensorName();
masahikofukasawa 13:d008249f0359 97
tkstreet 23:50c98b286e41 98 /**
tkstreet 23:50c98b286e41 99 * Callback function for handling sensor events.
tkstreet 23:50c98b286e41 100 */
masahikofukasawa 0:7a00359e701e 101 void eventCallback();
masahikofukasawa 0:7a00359e701e 102
masahikofukasawa 0:7a00359e701e 103 private:
tkstreet 23:50c98b286e41 104 bool event;
masahikofukasawa 0:7a00359e701e 105 uint8_t primaryId;
masahikofukasawa 0:7a00359e701e 106 uint8_t subId;
masahikofukasawa 13:d008249f0359 107 char* sensorName;
masahikofukasawa 0:7a00359e701e 108
masahikofukasawa 0:7a00359e701e 109 Ticker ticker;
masahikofukasawa 0:7a00359e701e 110 AK7451* ak7451;
masahikofukasawa 0:7a00359e701e 111 float interval;
masahikofukasawa 0:7a00359e701e 112 };
masahikofukasawa 0:7a00359e701e 113
masahikofukasawa 0:7a00359e701e 114 #endif