Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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