Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _TWIMASTER_H
#define _TWIMASTER_H
#include <inttypes.h>

// Cold start, (re)write configuration.
#define TWI_STATE_INIT_0 0
// Start the read-data loop.
#define TWI_STATE_LOOP_0 5

#define SCL_CLOCK 400000L

// This is for the IMU3200 sensor.
#define SLA 0b1101001
#define TWSR_FILTER (TWSR & 0b11111100)

#define  GYRO_CONFIGURATION_START 0x15
#define  GYRO_DATA_START 0x1B

#define START           0x08
#define REPEATED_START  0x10
#define MT_SLA_ACK      0x18
#define MT_SLA_NACK     0x20
#define MT_DATA_ACK     0x28
#define MR_SLA_ACK      0x40
#define MR_DATA_ACK     0x50
#define MR_DATA_NACK    0x58

/*
 * We take the temperature measurement as well as gyro.
 */

extern volatile uint16_t IMU3200SensorInputs[4];

void twimaster_setNeutral(void);

void twimaster_startCycle(void);

#endif