-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathi2c.h
46 lines (34 loc) · 1.33 KB
/
i2c.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef I2C_H
#define I2C_H
#include "FreeRTOS.h"
#define CON_AA 2
#define CON_SI 3
#define CON_STO 4
#define CON_STA 5
#define CON_I2EN 6
#define MMA8452Q 0x38
#define L3GD20 0xD4
#define MMA8452Q_WHO_AM_I 0x0D
#define L3GD20_WHO_AM_I 0x0F
#define L3GD20_STATUS_REG 0x27
#define L3GD20_OUT_TEMP 0x26
#define GYRO_SENSITIVITY_250DPS (0.00875F) //!< Sensitivity at 250 dps
#define GYRO_SENSITIVITY_500DPS (0.0175F) //!< Sensitivity at 500 dps
#define GYRO_SENSITIVITY_2000DPS (0.070F) //!< Sensitivity at 2000 dps
//// not in default db504! this is a piggy backed sensor I soldered to the testpoints:
#define LSM303_ACCEL 0x32 // 0011001x // ELLER 0x30? ??? ??
#define LSM303_MAG 0x3C // 0011110x
#define SHT21 0x80 // or 0x40 ?
#define SHT21_TEMP_NOHOLD 0xF3
#define SHT21_HUMD_NOHOLD 0xF5
////
void I2C1Init();
void I2C1_Start (void);
void I2C1_Stop (void);
void I2C1_Send (const uint8_t data);
void I2C1_Send_Addr (const uint8_t addr, const uint8_t sub, const uint8_t data);
uint8_t I2C1_Recv(bool ack);
//uint8_t I2C1_Recv_Addr (const uint8_t addr, const uint8_t sub, const bool ack);
uint8_t I2C1_Recv_Addr(const uint8_t addr, const uint8_t sub);
void I2C1_Recv_Addr_Buf (const uint8_t addr, const uint8_t sub, const bool ack, const uint8_t len, uint8_t *buf);
#endif // I2C_H