git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
quadramp_indent
[aversive.git]
/
projects
/
microb2010
/
cobboard
/
i2c_protocol.c
diff --git
a/projects/microb2010/cobboard/i2c_protocol.c
b/projects/microb2010/cobboard/i2c_protocol.c
index
53f2ab7
..
9de2d4c
100644
(file)
--- a/
projects/microb2010/cobboard/i2c_protocol.c
+++ b/
projects/microb2010/cobboard/i2c_protocol.c
@@
-93,11
+93,13
@@
static void i2c_send_status(void)
/* status */
ans.mode = state_get_mode();
/* status */
ans.mode = state_get_mode();
- ans.status = 0x55;
+ ans.status = 0x55;
/* TODO */
ans.left_cobroller_speed = cobboard.left_cobroller_speed;
ans.right_cobroller_speed = cobboard.right_cobroller_speed;
ans.left_cobroller_speed = cobboard.left_cobroller_speed;
ans.right_cobroller_speed = cobboard.right_cobroller_speed;
+ ans.cob_count = state_get_cob_count();
+;
i2c_send(I2C_ADD_MASTER, (uint8_t *) &ans,
sizeof(ans), I2C_CTRL_GENERIC);
}
i2c_send(I2C_ADD_MASTER, (uint8_t *) &ans,
sizeof(ans), I2C_CTRL_GENERIC);
}
@@
-111,21
+113,21
@@
static int8_t i2c_set_mode(struct i2c_cmd_cobboard_set_mode *cmd)
void i2c_recvevent(uint8_t * buf, int8_t size)
{
void *void_cmd = buf;
void i2c_recvevent(uint8_t * buf, int8_t size)
{
void *void_cmd = buf;
-
+
static uint8_t a = 0;
static uint8_t a = 0;
-
+
a++;
if (a & 0x10)
LED2_TOGGLE();
a++;
if (a & 0x10)
LED2_TOGGLE();
-
+
if (size <= 0) {
goto error;
}
if (size <= 0) {
goto error;
}
-
+
switch (buf[0]) {
/* Commands (no answer needed) */
switch (buf[0]) {
/* Commands (no answer needed) */
- case I2C_CMD_GENERIC_LED_CONTROL:
+ case I2C_CMD_GENERIC_LED_CONTROL:
{
struct i2c_cmd_led_control *cmd = void_cmd;
if (size != sizeof (*cmd))
{
struct i2c_cmd_led_control *cmd = void_cmd;
if (size != sizeof (*cmd))
@@
-133,7
+135,7
@@
void i2c_recvevent(uint8_t * buf, int8_t size)
i2c_led_control(cmd->led_num, cmd->state);
break;
}
i2c_led_control(cmd->led_num, cmd->state);
break;
}
-
+
case I2C_CMD_COBBOARD_SET_MODE:
{
struct i2c_cmd_cobboard_set_mode *cmd = void_cmd;
case I2C_CMD_COBBOARD_SET_MODE:
{
struct i2c_cmd_cobboard_set_mode *cmd = void_cmd;