Modified for compatibility with Rev.E. hardware

Fork of AkmSensor by AKM Development Platform

Committer:
masahikofukasawa
Date:
Fri Jul 08 22:26:26 2016 +0000
Revision:
10:5c69b067d88a
Parent:
6:c4401549d68f
Child:
11:cef8dc1cf010
RevD with AK09970 Release to Japan.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
masahikofukasawa 0:7a00359e701e 1 #ifndef AKMSENSORMANAGER_H
masahikofukasawa 0:7a00359e701e 2 #define AKMSENSORMANAGER_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 "Message.h"
coisme 2:11fe67783c4c 8 #include "debug.h"
coisme 2:11fe67783c4c 9
coisme 2:11fe67783c4c 10 #ifdef REV_D
coisme 2:11fe67783c4c 11 #include "mcp342x.h"
coisme 2:11fe67783c4c 12 #endif
masahikofukasawa 0:7a00359e701e 13
masahikofukasawa 0:7a00359e701e 14 #define ANALOG_SENSOR_ID P0_4
masahikofukasawa 0:7a00359e701e 15 #define ANALOG_SENSOR_ID_SUB P0_5
masahikofukasawa 0:7a00359e701e 16
masahikofukasawa 0:7a00359e701e 17 class AkmSensorManager {
masahikofukasawa 0:7a00359e701e 18 public:
masahikofukasawa 0:7a00359e701e 19
masahikofukasawa 0:7a00359e701e 20 typedef enum {
masahikofukasawa 0:7a00359e701e 21 SUCCESS = 0,
masahikofukasawa 0:7a00359e701e 22 ERROR,
masahikofukasawa 0:7a00359e701e 23 } Status;
masahikofukasawa 0:7a00359e701e 24
masahikofukasawa 0:7a00359e701e 25 AkmSensorManager(SerialNano* com, UARTService* service);
masahikofukasawa 10:5c69b067d88a 26 Status init(uint8_t id, uint8_t subid);
masahikofukasawa 0:7a00359e701e 27 void setEventConnected();
masahikofukasawa 0:7a00359e701e 28 void setEventDisconnected();
masahikofukasawa 0:7a00359e701e 29 Status commandReceived(char* buf);
masahikofukasawa 0:7a00359e701e 30 bool isEvent();
masahikofukasawa 0:7a00359e701e 31 Status processEvent();
masahikofukasawa 0:7a00359e701e 32
masahikofukasawa 0:7a00359e701e 33
masahikofukasawa 0:7a00359e701e 34 void processCommand();
masahikofukasawa 0:7a00359e701e 35 Status throwMessage(const Message *msg);
masahikofukasawa 10:5c69b067d88a 36 // void releaseTWI();
masahikofukasawa 10:5c69b067d88a 37 uint8_t getId(PinName pin, uint8_t bits);
masahikofukasawa 0:7a00359e701e 38
masahikofukasawa 0:7a00359e701e 39 private:
masahikofukasawa 0:7a00359e701e 40
masahikofukasawa 0:7a00359e701e 41 AkmSensor* sensor;
masahikofukasawa 0:7a00359e701e 42 SerialNano* serial;
masahikofukasawa 0:7a00359e701e 43 UARTService* uartService;
masahikofukasawa 0:7a00359e701e 44 Message msg;
masahikofukasawa 0:7a00359e701e 45
masahikofukasawa 10:5c69b067d88a 46 uint8_t primaryId;
masahikofukasawa 0:7a00359e701e 47 uint8_t subId;
masahikofukasawa 0:7a00359e701e 48 bool isEnabledBle;
masahikofukasawa 0:7a00359e701e 49 bool isEnabledUsb;
masahikofukasawa 0:7a00359e701e 50
masahikofukasawa 0:7a00359e701e 51 bool eventCommandReceived;
masahikofukasawa 0:7a00359e701e 52 bool eventConnected;
masahikofukasawa 0:7a00359e701e 53 bool eventDisconnected;
masahikofukasawa 0:7a00359e701e 54
masahikofukasawa 0:7a00359e701e 55 char userCommand[20];
masahikofukasawa 0:7a00359e701e 56
masahikofukasawa 0:7a00359e701e 57 AkmSensor* getAkmSensor();
masahikofukasawa 0:7a00359e701e 58 void dataOut(char* str);
coisme 2:11fe67783c4c 59
coisme 2:11fe67783c4c 60 #ifdef REV_D
coisme 2:11fe67783c4c 61 int16_t getAdcData(MCP342X *mcp3428, MCP342X::AdcChannel ch, MCP342X::SampleSetting s);
coisme 2:11fe67783c4c 62 #endif
masahikofukasawa 0:7a00359e701e 63 };
masahikofukasawa 0:7a00359e701e 64
masahikofukasawa 0:7a00359e701e 65 #endif // AKMSENSORMANAGER_H