summaryrefslogtreecommitdiff
path: root/serial_link/protocol
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-02-20 14:52:17 +0200
committerFred Sundvik <fsundvik@gmail.com>2016-02-20 14:52:17 +0200
commit82b5037b9db628c3f34d8fb38848753ff3e41e2f (patch)
treea30ebc072be36b6cc40fb6cabae28602fcb2eb1e /serial_link/protocol
parentcee5406ed76f16670a54720b8d3c6d8f8c193c49 (diff)
Add master send to specific destinations
Diffstat (limited to 'serial_link/protocol')
-rw-r--r--serial_link/protocol/frame_router.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/serial_link/protocol/frame_router.c b/serial_link/protocol/frame_router.c
index 0675cea284..861c0d7d29 100644
--- a/serial_link/protocol/frame_router.c
+++ b/serial_link/protocol/frame_router.c
@@ -32,10 +32,14 @@ void router_set_master(bool master) {
}
void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size){
- transport_recv_frame(0, data, size);
+ if (data[size-1] & 1) {
+ transport_recv_frame(0, data, size - 1);
+ }
+ data[size-1] >>= 1;
validator_send_frame(DOWN_LINK, data, size);
}
void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size) {
- validator_send_frame(DOWN_LINK, data, size);
+ data[size] = destination;
+ validator_send_frame(DOWN_LINK, data, size + 1);
}