git.droids-corp.org
/
protos
/
xbee-avr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use callout from aversive
[protos/xbee-avr.git]
/
main.c
diff --git
a/main.c
b/main.c
index
2d280a4
..
3959ee4
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-58,7
+58,7
@@
struct xbeeboard xbeeboard;
volatile uint16_t global_ms;
struct xbeeboard xbeeboard;
volatile uint16_t global_ms;
-struct callout_m
anage
r cm;
+struct callout_m
g
r cm;
#define TIMEOUT_MS 1000
#define TIMEOUT_MS 1000
@@
-266,6
+266,16
@@
int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len)
break;
}
#endif
break;
}
#endif
+ case RC_PROTO_HELLO: {
+ struct rc_proto_hello *rch =
+ (struct rc_proto_hello *) recvframe->data;
+
+ if (xbee_debug)
+ printf_P(PSTR("recv hello len=%d\r\n"),
+ rch->datalen);
+
+ break;
+ }
default:
return -1;
}
default:
return -1;
}
@@
-491,7
+501,7
@@
void xbee_stdin_disable(void)
xbee_cmdline_input_enabled = 0;
}
xbee_cmdline_input_enabled = 0;
}
-static void evt_timeout(struct callout_m
anage
r *cm, struct callout *clt,
+static void evt_timeout(struct callout_m
g
r *cm, struct callout *clt,
void *arg)
{
struct xbee_ctx *ctx = arg;
void *arg)
{
struct xbee_ctx *ctx = arg;
@@
-511,7
+521,8
@@
static void evt_timeout(struct callout_manager *cm, struct callout *clt,
void xbee_load_timeout(struct xbee_ctx *ctx)
{
void xbee_load_timeout(struct xbee_ctx *ctx)
{
- callout_reset(&cm, &ctx->timeout, TIMEOUT_MS, SINGLE, evt_timeout, ctx);
+ callout_init(&ctx->timeout, evt_timeout, ctx, 0);
+ callout_schedule(&cm, &ctx->timeout, TIMEOUT_MS);
}
void xbee_unload_timeout(struct xbee_ctx *ctx)
}
void xbee_unload_timeout(struct xbee_ctx *ctx)
@@
-646,7
+657,7
@@
int main(void)
spi_servo_init();
beep_init();
spi_servo_init();
beep_init();
- callout_m
anage
r_init(&cm, get_time_ms);
+ callout_m
g
r_init(&cm, get_time_ms);
//callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL);
/* initialize libxbee */
//callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL);
/* initialize libxbee */