Rev 2108 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2108 | Rev 2133 | ||
---|---|---|---|
1 | #ifndef _TWIMASTER_H |
1 | #ifndef _TWIMASTER_H |
2 | #define _TWIMASTER_H |
2 | #define _TWIMASTER_H |
3 | #include <inttypes.h> |
3 | #include <inttypes.h> |
4 | 4 | ||
5 | // Cold start, (re)write configuration. |
5 | // Cold start, (re)write configuration. |
6 | #define TWI_STATE_INIT_0 0 |
6 | #define TWI_STATE_INIT_0 0 |
7 | // Start the read-data loop. |
7 | // Start the read-data loop. |
8 | #define TWI_STATE_LOOP_0 5 |
8 | #define TWI_STATE_LOOP_0 5 |
9 | 9 | ||
10 | #define SCL_CLOCK 400000L |
10 | #define SCL_CLOCK 400000L |
11 | 11 | ||
12 | // This is for the IMU3200 sensor. |
12 | // This is for the ITG3200 sensor. |
13 | #define SLA 0b1101001 |
13 | #define SLA 0b1101001 |
14 | #define TWSR_FILTER (TWSR & 0b11111100) |
14 | #define TWSR_FILTER (TWSR & 0b11111100) |
15 | 15 | ||
16 | #define GYRO_CONFIGURATION_START 0x15 |
16 | #define GYRO_CONFIGURATION_START 0x15 |
17 | #define GYRO_DATA_START 0x1B |
17 | #define GYRO_DATA_START 0x1B |
18 | 18 | ||
19 | #define START 0x08 |
19 | #define START 0x08 |
20 | #define REPEATED_START 0x10 |
20 | #define REPEATED_START 0x10 |
21 | #define MT_SLA_ACK 0x18 |
21 | #define MT_SLA_ACK 0x18 |
22 | #define MT_SLA_NACK 0x20 |
22 | #define MT_SLA_NACK 0x20 |
23 | #define MT_DATA_ACK 0x28 |
23 | #define MT_DATA_ACK 0x28 |
24 | #define MR_SLA_ACK 0x40 |
24 | #define MR_SLA_ACK 0x40 |
25 | #define MR_DATA_ACK 0x50 |
25 | #define MR_DATA_ACK 0x50 |
26 | #define MR_DATA_NACK 0x58 |
26 | #define MR_DATA_NACK 0x58 |
27 | 27 | ||
28 | /* |
28 | /* |
29 | * We take the temperature measurement as well as gyro. |
29 | * We take the temperature measurement as well as gyro. |
30 | */ |
30 | */ |
31 | extern volatile uint16_t IMU3200SensorInputs[4]; |
31 | extern volatile int16_t ITG3200SensorInputs[4]; |
- | 32 | ||
32 | 33 | void twimaster_init(void); |
|
33 | void twimaster_setNeutral(void); |
- | |
34 | 34 | void twimaster_setNeutral(void); |
|
35 | void twimaster_startCycle(void); |
35 | void twimaster_startCycle(void); |
36 | 36 | ||
37 | #endif |
37 | #endif |
38 | 38 |