2 * Copyright Droids Corporation (2007)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: i2c_protocol.c,v 1.1 2009-01-30 20:38:49 zer0 Exp $
27 #include <aversive/error.h>
33 #include "../common/i2c_commands.h"
34 #include "strat_base.h"
36 #include "i2c_protocol.h"
38 //#define DEBUG_FROM_EXT
40 #define I2C_TIMEOUT 100 /* ms */
41 #define I2C_MAX_ERRORS 40
43 /* used for commands */
44 uint8_t command_buf[I2C_SEND_BUFFER_SIZE];
46 void i2c_protocol_init(void)
50 void i2c_poll_slaves(void * dummy)
54 /* called when the xmit is finished */
55 void i2c_sendevent(int8_t size)
61 NOTICE(E_USER_I2C_PROTO, "send error size=%d", size);
66 void i2c_recvevent(uint8_t * buf, int8_t size)
72 for (i = 0; i<size; i++) {
73 printf("%x ", buf[1]);
79 NOTICE(E_USER_I2C_PROTO, "recv error size=%d", size);
82 void i2c_recvbyteevent(uint8_t hwstatus, uint8_t i, uint8_t c)