Project

General

Profile

Statistics
| Revision:

root / branches / encoders / code / lib / include / libdragonfly / i2c.h @ 546

History | View | Annotate | Download (692 Bytes)

1 87 bcoltin
/** @file i2c.h
2
 *  @brief Header file for I2C
3
 *
4
 *  @author CMU Robotics Club, Kevin Woo, Suresh Nidhiry
5
 */
6
7
8
#ifndef _I2C_H_
9
#define _I2C_H_
10
11
#include <stddef.h>
12
13
/** @brief Address of slave receive handler function */
14
typedef void (*fun_srecv_t)(char);
15
16
/** @brief Address of master receive handler function*/
17
typedef int (*fun_mrecv_t)(char);
18
19
/** @brief Address of slave send handler function*/
20
typedef char (*fun_send_t)(void);
21
22
int i2c_init(char addr, fun_mrecv_t master_recv, fun_srecv_t slave_recv, fun_send_t slave_send);
23
int i2c_send(char dest, char* data, size_t bytes);
24
int i2c_request(char dest);
25
26
void i2c_packet_rec (char i2c_byte);
27
void i2c_packet_sniff(char data);
28
#endif