Basic functions is OK. Lack interrupts function.

Dependents:   Mt05_MtSense07

Committer:
bcc6
Date:
Thu Jan 26 03:08:15 2017 +0000
Revision:
0:4f87d5af61b1
Child:
1:4eefcf1d7351
Basic functions is OK. Lack interrupts function.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcc6 0:4f87d5af61b1 1 #ifndef AK9750_H
bcc6 0:4f87d5af61b1 2 #define AK9750_H
bcc6 0:4f87d5af61b1 3
bcc6 0:4f87d5af61b1 4 #include "mbed.h"
bcc6 0:4f87d5af61b1 5
bcc6 0:4f87d5af61b1 6
bcc6 0:4f87d5af61b1 7 #define AK9750_SLAVE_ADDR 0xC8 // 1100_1000b
bcc6 0:4f87d5af61b1 8
bcc6 0:4f87d5af61b1 9
bcc6 0:4f87d5af61b1 10 class AK9750 {
bcc6 0:4f87d5af61b1 11 public:
bcc6 0:4f87d5af61b1 12 struct Data {
bcc6 0:4f87d5af61b1 13 float ir1; // pA
bcc6 0:4f87d5af61b1 14 float ir2;
bcc6 0:4f87d5af61b1 15 float ir3;
bcc6 0:4f87d5af61b1 16 float ir4;
bcc6 0:4f87d5af61b1 17 float tmp; // 'C
bcc6 0:4f87d5af61b1 18 };
bcc6 0:4f87d5af61b1 19
bcc6 0:4f87d5af61b1 20 static const uint8_t DEVICE_ID = 0x13;
bcc6 0:4f87d5af61b1 21
bcc6 0:4f87d5af61b1 22 AK9750(I2C &i2c, PinName int1 = NC);
bcc6 0:4f87d5af61b1 23
bcc6 0:4f87d5af61b1 24 void ConfigDevice();
bcc6 0:4f87d5af61b1 25 void GetDeviceID(uint8_t *id);
bcc6 0:4f87d5af61b1 26 void GetData(Data *data);
bcc6 0:4f87d5af61b1 27 int32_t GetTriggeredAreaNum(Data *data);
bcc6 0:4f87d5af61b1 28
bcc6 0:4f87d5af61b1 29 private:
bcc6 0:4f87d5af61b1 30 I2C &_i2c;
bcc6 0:4f87d5af61b1 31 InterruptIn _int1;
bcc6 0:4f87d5af61b1 32
bcc6 0:4f87d5af61b1 33 float ConvertAdcToIr(int16_t adc);
bcc6 0:4f87d5af61b1 34 float ConvertAdcToTemperature(int16_t adc);
bcc6 0:4f87d5af61b1 35
bcc6 0:4f87d5af61b1 36 void RegWrite(char reg, char val);
bcc6 0:4f87d5af61b1 37 void RegRead (char reg, char *val, int len);
bcc6 0:4f87d5af61b1 38 void RegReadModifyWrite(char reg, char clr_mask, char set_mask);
bcc6 0:4f87d5af61b1 39 };
bcc6 0:4f87d5af61b1 40
bcc6 0:4f87d5af61b1 41 #endif