diff options
author | William Chang <william@factual.com> | 2019-11-20 22:17:07 -0800 |
---|---|---|
committer | William Chang <william@factual.com> | 2019-11-20 22:17:07 -0800 |
commit | e7f4d56592b3975c38af329e77b4efd9108495e8 (patch) | |
tree | 0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /quantum/serial_link/protocol/frame_router.c | |
parent | 71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff) | |
parent | 8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'quantum/serial_link/protocol/frame_router.c')
-rw-r--r-- | quantum/serial_link/protocol/frame_router.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/quantum/serial_link/protocol/frame_router.c b/quantum/serial_link/protocol/frame_router.c index 04b8c2e75c..5292673700 100644 --- a/quantum/serial_link/protocol/frame_router.c +++ b/quantum/serial_link/protocol/frame_router.c @@ -28,26 +28,22 @@ SOFTWARE. static bool is_master; -void router_set_master(bool master) { - is_master = master; -} +void router_set_master(bool master) { is_master = master; } -void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size){ +void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size) { if (is_master) { if (link == DOWN_LINK) { - transport_recv_frame(data[size-1], data, size - 1); + transport_recv_frame(data[size - 1], data, size - 1); } - } - else { + } else { if (link == UP_LINK) { - if (data[size-1] & 1) { + if (data[size - 1] & 1) { transport_recv_frame(0, data, size - 1); } - data[size-1] >>= 1; + data[size - 1] >>= 1; validator_send_frame(DOWN_LINK, data, size); - } - else { - data[size-1]++; + } else { + data[size - 1]++; validator_send_frame(UP_LINK, data, size); } } @@ -59,8 +55,7 @@ void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size) { data[size] = 1; validator_send_frame(UP_LINK, data, size + 1); } - } - else { + } else { if (is_master) { data[size] = destination; validator_send_frame(DOWN_LINK, data, size + 1); |