Subversion Repositories FlightCtrl

Rev

Rev 2108 | Details | Compare with Previous | 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
 
2133 - 12
// This is for the ITG3200 sensor.
2108 - 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
 */
2133 - 31
extern volatile int16_t ITG3200SensorInputs[4];
2108 - 32
 
2133 - 33
void twimaster_init(void);
2108 - 34
void twimaster_setNeutral(void);
35
void twimaster_startCycle(void);
36
 
37
#endif