/*
  Michael Simmons
  Master Project: gRAPI: an indoor four-wheeled robot API for a gumstix connex
  
  Last Modified: 17 Feb 2009
  
  Header file for the I2CDefs
*/

#ifndef I2CDEF_H
#define I2CDEF_H

#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <linux/i2c.h>
#include <iostream>

using namespace std;

const uint8_t I2c_packet_len = 32;

struct I2c_packet_header_t
{
  uint16_t i2c_addr;
  unsigned short flags;
  short len; // number of bytes in packet
  char *packet;
}; // I2c_packet_header_t

struct I2c_pwm_packet_t
{
  uint8_t pwm_no; // 0=1a, 1=1b, 2=1c, 3=3a, 4=3b, 5=3c
  uint8_t pulseDelay;
  uint16_t pulse_value;  // given in usec
}; // I2c_pwm_packet_t

struct I2c_ioctl_packet_t
{
  struct I2c_packet_header_t *addr;
  int packet_count;
}; // I2c_ioctl_packet_t

#endif

