Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of AkmSensor by
akmsensor.h
- Committer:
- masahikofukasawa
- Date:
- 2016-05-26
- Revision:
- 7:e269411568c9
- Parent:
- 4:af13b985c689
- Child:
- 11:cef8dc1cf010
File content as of revision 7:e269411568c9:
#ifndef AKMSENSOR_H #define AKMSENSOR_H #include "mbed.h" #include "Message.h" // SPI #define SPI_SCK P0_8 //SPI, SCK #define SPI_MISO P0_9 //SPI, MISO #define SPI_MOSI P0_10 //SPI, MOSI #define SPI_CS P0_11 //SPI, CS #define SPI_DRDY P0_7 //SPI, DRDY // I2C #define I2C_SCL P0_8 //I2C, SCL #define I2C_SDA P0_10 //I2C, SDA // Digital Port #define DIGITAL_D0 P0_11 #define DIGITAL_D1 P0_9 // DRDY Port #define I2C_DRDY P0_11 // Analog In #define ANALOG_IN_PIN P0_5 //P05 #define I2C_SPEED_100KHZ 100000 #define I2C_SPEED_400KHZ 400000 class AkmSensor { public: typedef enum { SUCCESS = 0, ERROR_DOESNT_SUPPORT, ERROR, } Status; typedef enum { AKM_PRIMARY_ID_AKD_SPI = 0x0, AKM_PRIMARY_ID_UNIPOLAR = 0x1, AKM_PRIMARY_ID_OMNIPOLAR = 0x2, AKM_PRIMARY_ID_LATCH = 0x3, AKM_PRIMARY_ID_DUAL_OUTPUT = 0x4, AKM_PRIMARY_ID_ONECHIP_ENCODER = 0x5, AKM_PRIMARY_ID_TBD1 = 0x6, AKM_PRIMARY_ID_TBD2 = 0x7, AKM_PRIMARY_ID_LINEAR_SENSOR_LEGACY = 0x8, AKM_PRIMARY_ID_CURRENT_SENSOR = 0x9, AKM_PRIMARY_ID_MISC_ANALOG = 0xA, AKM_PRIMARY_ID_LINEAR_SENSOR = 0xB, AKM_PRIMARY_ID_TBD3 = 0xC, AKM_PRIMARY_ID_IR_SENSOR = 0xD, AKM_PRIMARY_ID_ANGLE_SENSOR = 0xE, AKM_PRIMARY_ID_AKD_I2C = 0xF, } SensorPrimaryId; AkmSensor(){} virtual ~AkmSensor(){} virtual Status init(const uint8_t id, const uint8_t subid) = 0; virtual bool isEvent() = 0; virtual Status startSensor() = 0; virtual Status startSensor(const float sec) = 0; virtual Status stopSensor() = 0; virtual Status readSensorData(Message* msg) = 0; virtual Status requestCommand(Message* in, Message* out) = 0; private: }; #endif