1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2021 UBC Bionics, Ltd.
//
// Licensed under the MIT license
// <LICENSE.md or https://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or
// distributed except according to those terms.
/// Given a `u8`, clears the top bit by applying a
/// mask to it.
pub
/// The Pololu-Protocol requires that the `u16` be
/// formatted in a specific manner before
/// embedding it in the protocol message and
/// sending it over `UART`.
///
/// Given a 16-bit integer, execute the following:
/// 1. take low order bits 0 to 6, pad with a 0 in
/// the 7th position. This is the lower byte. 2.
/// take upper order bits 7 to 13, shift it down 7
/// bits, pad with a 0 in the 7th position. This
/// is the higher byte.
///
/// # Note
/// This leaves the top 2 bits unused. This is as
/// is required by the Pololu-Protocol.
pub