update (experimenting)
This commit is contained in:
parent
430b180898
commit
ce6adfac0f
BIN
.assets/ferris.webp
Normal file
BIN
.assets/ferris.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
874
Cargo.lock
generated
874
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
64
Cargo.toml
64
Cargo.toml
@ -1,17 +1,73 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"tflite_demo"
|
||||
members = ["tflite_demo"]
|
||||
|
||||
[workspace.features]
|
||||
default = ["ble-l2cap", "ble-gatt-server", "ble-gatt-client", "ble-sec"]
|
||||
|
||||
ble-l2cap = ["nrf-softdevice/ble-l2cap"]
|
||||
ble-gatt-server = ["nrf-softdevice/ble-gatt-server"]
|
||||
ble-gatt-client = ["nrf-softdevice/ble-gatt-client"]
|
||||
ble-sec = ["nrf-softdevice/ble-sec"]
|
||||
|
||||
nrf52840 = [
|
||||
"embassy-nrf/nrf52840",
|
||||
"nrf-softdevice/nrf52840",
|
||||
"nrf-softdevice/s140",
|
||||
"dep:nrf-softdevice-s140",
|
||||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
cortex-m = { version = "0.7.7", features = ["critical-section-single-core", "inline-asm"] }
|
||||
cortex-m = { version = "0.7.7", features = [
|
||||
"critical-section-single-core",
|
||||
"inline-asm",
|
||||
] }
|
||||
cortex-m-rt = "0.7.2"
|
||||
nrf52840-hal = "0.16.0"
|
||||
usb-device = "0.2.7"
|
||||
usbd-serial = "0.1.0"
|
||||
microflow = { path = "../microflow-rs" }
|
||||
# microflow = "0.1.3"
|
||||
nalgebra = { version = "0.33.2", default-features = false, features = ["macros"] }
|
||||
nalgebra = { version = "0.33.2", default-features = false, features = [
|
||||
"macros",
|
||||
] }
|
||||
libm = "0.2"
|
||||
panic-halt = "1.0.0"
|
||||
panic-probe = { version = "0.3.1", features = ["print-defmt"] }
|
||||
heapless = "0.8.0"
|
||||
lsm6ds3tr = { path = "../lsm6ds3tr-rs" }
|
||||
embassy-sync = { version = "0.5.0" }
|
||||
embassy-executor = { version = "0.5.0", features = [
|
||||
"arch-cortex-m",
|
||||
"executor-thread",
|
||||
"executor-interrupt",
|
||||
"defmt",
|
||||
"integrated-timers",
|
||||
] }
|
||||
embassy-time = { version = "0.3.0", features = [
|
||||
"defmt",
|
||||
"defmt-timestamp-uptime",
|
||||
] }
|
||||
embassy-nrf = { version = "0.1.0", features = [
|
||||
"defmt",
|
||||
"nrf52840",
|
||||
"time-driver-rtc1",
|
||||
"gpiote",
|
||||
"time",
|
||||
] }
|
||||
defmt = "0.3.0"
|
||||
defmt-rtt = "0.4.0"
|
||||
embedded-storage = "0.3.0"
|
||||
embedded-hal = "1.0.0"
|
||||
embedded-alloc = "0.6.0"
|
||||
nrf-softdevice = { version = "0.1.0", features = [
|
||||
"defmt",
|
||||
"ble-peripheral",
|
||||
"ble-central",
|
||||
"critical-section-impl",
|
||||
"nrf52840",
|
||||
"s140",
|
||||
] }
|
||||
nrf-softdevice-s140 = { version = "0.1.1" }
|
||||
fixed = "1.24.0"
|
||||
atomic-pool = "1.0.1"
|
||||
static_cell = "2.0.0"
|
||||
|
22
README.md
22
README.md
@ -1 +1,23 @@
|
||||
# xiao_pet_tracker_rust
|
||||
|
||||
<img src="./.assets/ferris.webp" style="max-width: 300px;" />
|
||||
|
||||
Blazingly fast and efficient pet tracking!
|
||||
|
||||
## Supported Microcontrollers
|
||||
|
||||
- Seeed XIAO BLE
|
||||
|
||||
## Mac Tooling
|
||||
|
||||
List connected devices:
|
||||
|
||||
```bash
|
||||
ioreg -p IOUSB
|
||||
```
|
||||
|
||||
Screen the controller:
|
||||
|
||||
```bash
|
||||
screen /dev/tty./dev/tty.usbmodempet11
|
||||
```
|
||||
|
BIN
tflite_demo/.DS_Store
vendored
Normal file
BIN
tflite_demo/.DS_Store
vendored
Normal file
Binary file not shown.
@ -15,3 +15,16 @@ microflow.workspace = true
|
||||
libm.workspace = true
|
||||
nalgebra.workspace = true
|
||||
heapless.workspace = true
|
||||
lsm6ds3tr.workspace = true
|
||||
defmt.workspace = true
|
||||
defmt-rtt.workspace = true
|
||||
embedded-alloc.workspace = true
|
||||
nrf-softdevice.workspace = true
|
||||
nrf-softdevice-s140.workspace = true
|
||||
embassy-nrf.workspace = true
|
||||
embassy-time.workspace = true
|
||||
embassy-executor.workspace = true
|
||||
embassy-sync.workspace = true
|
||||
fixed.workspace = true
|
||||
atomic-pool.workspace = true
|
||||
static_cell.workspace = true
|
||||
|
219
tflite_demo/features/speech.rs
Normal file
219
tflite_demo/features/speech.rs
Normal file
@ -0,0 +1,219 @@
|
||||
use nalgebra::matrix;
|
||||
|
||||
use microflow::buffer::Buffer2D;
|
||||
|
||||
pub const YES: Buffer2D<i8, 1, 1960> = matrix![
|
||||
116, 98, 118, 95, 106, 85, 101, 81, 67, -18, -33, -12, -26, -128, 9, 34, 56, 45, 9, -12, 5, 30,
|
||||
23, 28, 0, -18, 0, -128, -60, -50, -50, -37, -60, -60, -50, -26, -33, -50, -33, -50, 83, 61,
|
||||
81, 55, 76, 61, 73, 64, 38, -8, -37, -20, -18, -20, 48, 29, 52, 41, 55, 18, 25, 37, 44, 37, 8,
|
||||
15, -6, -60, -128, -50, -37, -37, -18, -37, -26, -29, -37, -60, -50, -60, 95, 59, 52, -4, 54,
|
||||
-18, 68, 43, 31, -18, -26, -33, -37, -29, 33, 7, -3, 8, 26, 24, 36, 6, 36, 23, 14, 8, -29, -37,
|
||||
-37, -37, -50, -50, -26, -8, -26, -37, -18, -37, -60, -77, 50, 48, 83, 44, 56, -128, -33, -60,
|
||||
1, -26, -60, -43, -14, -23, -18, -43, -26, -33, 13, -77, -43, -77, -33, -37, 16, -12, -37, -50,
|
||||
-50, -77, -20, -43, -60, -128, -60, -77, -37, -77, -60, -128, 37, -10, 65, -7, 28, -128, 10,
|
||||
-77, -37, -128, -77, -128, -77, -43, -128, -128, -77, -128, -128, -128, -128, -128, -14, -128,
|
||||
-43, -50, -37, -77, -128, -128, -77, -43, -29, -43, -20, -60, -37, -43, -50, -128, -77, -128,
|
||||
-18, -128, -60, -128, -128, -128, -77, -128, -77, -128, -128, -128, -60, -37, -20, -128, -60,
|
||||
-128, -128, -128, -60, -128, -77, -60, -128, -50, -60, -128, -77, -128, -50, -60, -37, -60,
|
||||
-50, -77, -77, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -37, -128,
|
||||
-128, -128, -128, -128, -77, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-77, -60, -128, -128, -50, -128, -50, -128, -50, -128, -77, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -77, -128, -77, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -77, -128, -77, -128, -77,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -77, -128, -128, -128, -128,
|
||||
-77, -50, -128, -128, -77, -77, -128, -128, -128, -50, -128, 85, 43, 65, 53, 69, 60, 45, 3, 46,
|
||||
-12, 9, -23, 32, -1, -128, -128, -128, -128, -1, 37, 38, 33, 43, 36, 58, 70, 68, 39, 6, 10, 32,
|
||||
6, 8, -23, -77, -128, -29, -128, -77, -128, 101, 87, 102, 91, 110, 88, 101, 83, 110, 95, 111,
|
||||
83, 81, 84, 106, 90, 93, 82, 98, 91, 108, 95, 118, 97, 118, 97, 116, 96, 113, 90, 110, 96, 107,
|
||||
85, 94, 66, 69, 36, 29, 0, 100, 60, 105, 68, 92, 93, 113, 92, 107, 85, 107, 83, 104, 91, 105,
|
||||
85, 112, 88, 101, 80, 101, 79, 96, 80, 98, 80, 105, 83, 98, 81, 103, 71, 100, 79, 83, 78, 91,
|
||||
47, 50, 13, 108, 81, 93, 78, 98, 76, 105, 76, 98, 40, 77, 72, 81, 62, 93, 77, 96, 80, 98, 61,
|
||||
97, 69, 88, 61, 71, 56, 98, 68, 97, 72, 89, 51, 81, 61, 88, 75, 86, 56, 48, 13, 71, 22, 84, 66,
|
||||
76, -7, 48, 61, 77, 62, 91, 65, 95, 74, 88, 59, 75, 58, 83, 55, 87, 55, 76, 43, 76, -3, 56, 60,
|
||||
79, 57, 71, 54, 82, 33, 74, 71, 91, 45, 18, -7, 61, 56, 77, 41, 73, 42, 82, 49, 59, 63, 82, 65,
|
||||
66, 38, 83, 34, 48, -8, 46, 20, 54, 33, 54, 6, 48, 16, 60, 37, 58, 22, 58, 14, 65, 53, 75, -4,
|
||||
42, 16, 16, -50, 22, -128, 80, 54, 43, -50, 42, -128, -10, -77, 28, -29, 68, 43, 73, 2, 25,
|
||||
-60, 47, 14, 45, 7, 66, 4, 62, 37, 71, 7, 46, -10, 44, 22, 55, 53, 57, -29, 26, -10, -3, -128,
|
||||
38, -128, 46, -10, 16, -128, -10, -26, 60, -7, 65, 38, 70, -60, 35, -8, 42, -29, 6, -128, 34,
|
||||
-128, 36, -60, 44, -12, -2, -128, -7, -60, -60, -128, -23, -128, 31, -33, 22, -77, -37, -43,
|
||||
-128, -128, 3, -128, -23, -128, 17, -77, 43, -77, -7, -128, -20, -128, 17, -43, 32, -128, -43,
|
||||
-128, -128, -77, 21, -128, -50, -128, -128, -128, -128, -128, -128, -128, -37, -128, -16, -128,
|
||||
-50, -26, -6, -128, -128, -128, -128, -128, -23, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -16, -128, 36, -7, 16, -128, -128, -128, -128, -128, -77, -128, -37, -128, -50,
|
||||
-128, -128, -128, -128, -128, -18, -128, 11, -128, -16, -77, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -26, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -20, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -50, -128, -77, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -77, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -1, -18, 5, -128, 40, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
4, -128, 63, 66, 75, -128, 70, 60, 34, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
87, 86, 95, 76, 91, 62, 72, -6, -50, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, 64, 83, 104, 70, 98, 90, 111, 89, 109, 80, 71, -128, -128, -128, -128, -128, -20,
|
||||
-6, 27, 33, 86, 88, 108, 75, 108, 76, 98, 64, 75, 61, 71, 66, 85, -1, -77, -128, 46, 61, 92,
|
||||
69, 100, 93, 113, 80, 108, 93, 113, 91, 110, 80, 85, 15, -33, -128, 12, -50, 34, 50, 70, 55,
|
||||
84, 72, 108, 81, 111, 88, 100, 80, 84, 73, 97, 86, 99, 65, 85, 43, 96, 78, 107, 94, 118, 98,
|
||||
115, 92, 118, 94, 111, 93, 111, 86, 99, 52, 32, -16, 48, 31, 81, 74, 85, 64, 78, 64, 98, 70,
|
||||
110, 92, 96, 73, 100, 72, 94, 73, 98, 76, 85, 67, 101, 83, 101, 83, 112, 89, 98, 85, 105, 78,
|
||||
98, 72, 102, 80, 95, 23, 19, -8, 52, 57, 103, 91, 95, 65, 74, 8, 77, 49, 96, 76, 100, 87, 105,
|
||||
81, 94, 62, 94, 78, 81, 72, 99, 82, 101, 78, 108, 65, 82, 70, 100, 63, 79, 58, 80, 59, 87, 48,
|
||||
50, 57, 93, 67, 86, 80, 103, 56, 77, 31, 81, 57, 62, 41, 96, 85, 91, 71, 101, 76, 89, 78, 95,
|
||||
76, 96, 79, 103, 81, 103, 48, 70, 57, 88, 66, 84, 11, 85, 67, 104, 37, 38, 67, 90, 54, 81, 62,
|
||||
90, 52, 78, -60, 54, -8, 68, 40, 55, 8, 77, 52, 66, 31, 55, 13, 60, 26, 69, 42, 63, -29, 57,
|
||||
-128, -3, -128, 3, -128, -29, -60, 52, -43, 63, 56, 86, 75, 95, 75, 85, 63, 82, 10, 50, -128,
|
||||
31, -77, 0, -77, -23, -128, 12, -77, 51, -3, 58, -14, 44, 0, 48, 4, 53, 47, 28, -128, -128,
|
||||
-128, -37, -128, -3, -128, 49, 61, 100, 90, 117, 88, 107, 94, 112, 64, 96, 83, -128, -128, 7,
|
||||
-128, -77, -128, -23, -128, -23, -128, 16, -37, 65, -8, 48, 20, 14, -77, 57, -18, -43, -128,
|
||||
-128, -128, -128, -128, -128, -128, 24, 12, 74, 76, 105, 76, 99, 80, 108, 79, 103, 85, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, 42, -128, -8, -128, -50,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -60, -128, -128, 5, 73, 53, 93, 70, 101,
|
||||
73, 94, 57, 86, 66, -18, -128, -128, -128, -128, -128, -128, -128, -128, -128, -50, -128, 36,
|
||||
-128, -128, -128, -128, -128, -20, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, 23, 37, 75, 54, 97, 70, 83, 52, 85, 65, 7, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -43, -128, 23, -128, -43, -128, -33, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -26, -37, 65, 33, 76, 37, 73, 50, 77, 47, -12, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -7, -14, -4, -128, -14, -128, 18, -60, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -26, -60, 71, 42, 68, 53, 81, 49,
|
||||
73, 36, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -18, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
15, -26, 44, -18, 59, 39, 57, 20, 62, 26, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, 49, -128, 30, 8, 69, 27, 62, 38, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -43, -128, 28, -37, 48, -10,
|
||||
48, 11, 74, 37, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -77, -128, 11, -128, -7, -60, -77, -4, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -8, -128, -50, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128
|
||||
];
|
||||
|
||||
pub const NO: Buffer2D<i8, 1, 1960> = matrix![
|
||||
103, 78, 64, 76, 75, 54, 53, 67, 77, 60, 56, 70, 76, 71, 68, 58, 74, 32, 23, -2, -18, 11, 13,
|
||||
15, 9, 20, 5, -7, -18, -2, -10, -18, -10, -12, 9, 7, -33, -12, -4, -18, 57, 17, 55, 62, 70, 45,
|
||||
61, 37, 67, 52, 48, 47, 55, 46, 57, 47, 73, 17, 27, 20, 19, 8, 15, -6, -1, 10, -12, -29, -6,
|
||||
-23, -18, -3, -1, 5, 3, -4, -12, -8, -1, -14, 65, 48, 58, 43, 48, 19, 39, 39, 57, 57, 58, 55,
|
||||
67, 58, 49, 50, 70, 27, 9, 16, 37, 4, 25, 4, 11, 9, 7, -33, -7, -12, 3, -6, -29, -7, -7, -18,
|
||||
-12, -18, -2, -1, 0, 31, 60, -8, 51, 59, 70, 40, 71, 57, 52, 38, 66, 48, 17, 6, 59, 8, 15, 7,
|
||||
18, 4, 18, -23, -8, -4, -3, -12, -3, -26, 1, 10, 2, -29, -29, -37, -7, -4, 6, -33, 67, 44, 59,
|
||||
-4, 64, 51, 68, 55, 74, 9, 40, 15, 57, 33, 60, 18, 40, 25, 27, -20, 25, -16, 6, 17, -10, -12,
|
||||
-23, -43, -23, -23, -29, -37, -4, -16, -16, -60, -20, -23, -10, -29, -12, 15, 12, -37, 27, 15,
|
||||
61, 44, 50, 8, 48, 22, 49, -18, 46, 33, 42, 34, 46, -8, 4, -18, -43, -43, -10, 1, -10, -16,
|
||||
-10, -77, -16, -33, 11, -26, -23, -37, 0, -8, -16, -29, 42, 40, 68, 24, 47, 46, 53, -128, 30,
|
||||
2, 42, 21, 21, -4, 43, 2, 43, 5, 32, -26, 7, -37, -43, -23, -2, -8, 2, -37, -50, -60, -1, -7,
|
||||
-33, -77, -6, -18, -16, -50, -12, -33, 53, 8, 52, 18, 51, 35, 69, 26, 44, 8, 27, -128, 21, -33,
|
||||
17, -14, 38, -128, -14, -18, 17, -20, -14, -37, 8, -60, -33, -33, -33, -43, -12, -29, -12,
|
||||
-128, -33, -60, -26, -77, -26, -50, 57, 29, 11, 30, 53, -10, 45, 15, 18, -10, 42, 2, 31, -29,
|
||||
10, -4, 42, -37, -50, -128, -4, -43, -20, -77, -14, -26, -33, -128, -12, -43, -8, -33, -33,
|
||||
-60, -43, -77, -12, -60, -26, -50, 40, -23, 36, 35, 50, -2, 37, 27, 26, -77, 49, -7, 28, -43,
|
||||
6, 11, 41, -37, 33, -26, -14, -12, -6, -33, -16, -26, -20, -77, -14, -43, -8, -50, -14, -37,
|
||||
-26, -77, -26, -77, -14, -29, 50, -60, 25, -26, 57, 38, 51, 1, 50, 1, 53, -18, 30, -23, 11,
|
||||
-128, 18, -43, 20, -26, -10, -26, -12, -128, -50, -60, -37, -77, -20, -43, -50, -128, -77,
|
||||
-128, -77, -128, -33, -77, -20, -60, 53, -10, -37, -128, 10, -128, 60, 18, -8, 13, 37, -37, 8,
|
||||
-128, 3, -77, 32, -29, 14, 10, -12, -77, -37, -77, -37, -60, -23, -128, -43, -50, -16, -77, -6,
|
||||
-33, 0, -60, -43, -128, -16, -60, 20, -2, 51, 19, 43, 2, 63, 20, 60, -4, 42, -50, 4, -128, 2,
|
||||
-3, 32, -33, -26, -128, -18, -128, -33, -43, -7, -60, -50, -77, -29, -77, -23, -128, -16, -26,
|
||||
-23, -60, -37, -77, -37, -128, -1, -33, 39, 48, 60, 5, 8, -128, 44, 11, 4, 0, 13, -77, -2, -20,
|
||||
33, -128, -33, -77, -8, -128, -14, -128, -33, -18, -12, -77, -16, -128, -37, -128, -12, -77,
|
||||
-60, -128, -23, -60, -23, -128, 36, -50, 46, -128, 66, 39, 18, -14, -12, -77, -20, -6, 24,
|
||||
-128, 28, -26, 21, -77, -6, -33, 1, -128, -43, -128, -1, -50, -37, -128, -50, -128, -33, -128,
|
||||
-18, -128, -60, -8, -7, -60, -60, -128, -6, -29, 20, -1, 73, 40, -43, -14, 33, -43, 33, -3, 15,
|
||||
-29, 29, -43, 20, -60, -29, -128, -20, -26, 4, -77, -16, -60, -33, -50, -29, -128, -60, -128,
|
||||
-77, -128, -37, -50, 0, -77, -33, -128, 39, 8, 47, 10, 62, 16, 2, 1, 10, 7, 4, -7, 6, -128,
|
||||
-77, -50, 19, -77, -77, -128, -77, -128, -50, -128, -60, -60, -33, -50, -37, -128, -128, -128,
|
||||
-60, -128, -37, -60, -18, -128, -33, -77, 37, 23, 29, -128, -128, -128, -16, -128, -16, -33,
|
||||
21, -20, -8, -60, -2, -60, 11, -128, -50, -128, -50, -128, -29, -77, -16, -128, -26, -128, -50,
|
||||
-77, -43, -128, -128, -128, -50, -128, -33, -128, -33, -50, -23, -128, 24, -128, -128, -77, 4,
|
||||
-23, 32, -128, 1, -26, -14, -128, 10, -77, -4, -128, 1, -50, -8, -77, -77, -77, -23, -128, -50,
|
||||
-43, -33, -128, -43, -128, -128, -128, -43, -128, -50, -128, -128, -128, 44, 15, 14, -128, 9,
|
||||
-128, 21, 0, 29, -7, 18, -7, -7, -128, -33, -50, 14, -60, -60, -128, -60, -128, -37, -128, -43,
|
||||
-128, -20, -128, -50, -128, -43, -77, -26, -128, -60, -50, -60, -128, -77, -128, -3, -128, 14,
|
||||
-77, -26, 11, 47, -77, -7, -77, 45, -43, -12, 14, 37, -60, 22, -4, 5, -77, -14, -128, -10, -60,
|
||||
22, -77, -12, -60, -50, -128, -60, -128, -60, -128, -43, -128, -50, -128, -77, -50, 27, -37,
|
||||
33, -128, 4, -29, -4, -50, -20, -128, 6, -37, -33, -128, -50, -128, 34, 15, -43, -128, -20,
|
||||
-50, -3, -37, -37, -77, -77, -128, -43, -128, -128, -128, 4, -26, -26, 27, 0, -128, -29, -60,
|
||||
35, -26, 23, -128, -29, -77, 19, 14, 28, -128, -16, -7, 31, -1, 17, 11, 60, 44, 8, 11, 18,
|
||||
-128, -33, -60, -1, -128, -43, -128, -23, -128, -128, -128, 59, 43, 35, 61, 37, -77, -77, -50,
|
||||
116, 88, 98, 69, 78, 53, 78, 40, 48, 7, 29, -18, -2, -14, 5, 12, 65, 35, 31, -12, 33, -2, -6,
|
||||
-1, 44, -29, -14, -60, -4, -43, -37, -128, 29, 18, 38, 51, 8, -128, -12, -37, 115, 91, 113, 77,
|
||||
89, 36, 60, 44, 49, 36, 27, 31, 63, 30, 62, 14, 55, 49, 42, 0, 45, 17, -23, 1, 30, -37, -50,
|
||||
-77, -8, -60, 9, -60, -12, -50, 13, 4, 23, -6, 28, 13, 107, 78, 101, 73, 89, 46, 63, 17, 34,
|
||||
-43, -6, 30, 67, 40, 77, 21, 53, 39, 38, 12, -6, 5, 28, -2, 18, -43, 0, -128, -29, -77, 18,
|
||||
-128, -2, -77, 39, 35, 38, 35, 50, 29, 100, 70, 94, 69, 86, 50, 45, 38, 45, 12, 58, 64, 74, 36,
|
||||
77, 45, 78, 62, 8, -60, 38, 6, 21, 7, 8, -37, -1, -20, 48, -37, 8, -10, 8, 13, 45, 39, 38, 22,
|
||||
49, 25, 94, 63, 87, 66, 84, -128, 29, 20, 55, 51, 80, 36, 62, 30, 81, 72, 68, 37, 51, 27, 54,
|
||||
22, 16, -29, 4, 9, 57, 15, 35, -43, -77, -20, 4, 6, 37, -1, 40, 31, 47, 14, 89, 68, 96, 83,
|
||||
111, 96, 115, 87, 99, 76, 105, 84, 105, 86, 113, 91, 108, 87, 110, 78, 80, 46, 22, 74, 88, 72,
|
||||
103, 86, 80, 68, 48, 24, 68, 48, 55, 36, 108, 90, 90, 63, 83, 63, 87, 64, 90, 92, 113, 88, 102,
|
||||
79, 109, 83, 100, 89, 109, 60, 56, 21, 75, 62, 81, 45, 63, 73, 93, 65, 94, 80, 89, 81, 73, 3,
|
||||
43, 60, 102, 70, 84, 67, 99, 74, 78, 57, 79, 50, 93, 82, 98, 56, 77, 70, 91, 71, 85, 82, 86,
|
||||
13, 45, -18, 48, 40, 53, 28, 85, 60, 65, 52, 86, 78, 76, 46, 73, 19, 35, 54, 75, 40, 71, 60,
|
||||
82, 37, 69, 42, 62, 40, 96, 70, 85, 77, 70, 68, 103, 84, 94, 69, 81, -128, -128, -128, -43,
|
||||
-37, 40, 2, 48, 45, 76, 37, 65, 16, 43, 18, 58, 20, 27, 12, 71, 31, 53, 44, 88, 47, 50, 33, 39,
|
||||
8, 89, 57, 88, 69, 72, 63, 100, 68, 81, -77, -10, -128, -128, -128, -128, -128, 13, -77, 8, 27,
|
||||
60, 28, 41, -128, -37, -128, 28, -43, -18, -128, 47, -37, 45, 27, 51, -29, 15, 39, 52, 30, 49,
|
||||
-33, 65, 15, 76, 71, 90, 19, 46, -128, -16, -128, -128, -128, -128, -128, -128, -128, -18,
|
||||
-128, -20, -128, 32, -128, 21, -33, 45, -128, -128, -128, -12, -128, -6, -14, 43, -128, -128,
|
||||
-128, -128, -128, 52, -18, 69, -43, 78, 55, 42, -128, -29, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, 14, -128, -16, -128, -128, -128, 7, -128, -128, -128, -128, -128,
|
||||
-128, -128, 12, -128, -128, -128, -128, -16, 59, -50, 35, -128, 42, 0, 47, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -33, -128, -23, -128, -128, -128,
|
||||
-23, -128, -128, -128, -128, -128, -128, -128, -33, -128, -128, -128, -128, -128, -128, -128,
|
||||
-8, -128, 36, -50, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -37, -128, -128, -60, -10, -128, -128, -128, -128, -128, -128, -128,
|
||||
21, -128, -128, -128, -128, -128, -128, -128, -128, -128, -12, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -77, -128, -128, -128, -29, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -29, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-50, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
|
||||
-128, -128
|
||||
];
|
BIN
tflite_demo/models/.DS_Store
vendored
Normal file
BIN
tflite_demo/models/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
tflite_demo/models/speech.tflite
Normal file
BIN
tflite_demo/models/speech.tflite
Normal file
Binary file not shown.
4
tflite_demo/src/common.rs
Normal file
4
tflite_demo/src/common.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#![macro_use]
|
||||
|
||||
use defmt_rtt as _; // global logger
|
||||
use embassy_nrf as _; // time driver
|
16
tflite_demo/src/i2c.rs
Normal file
16
tflite_demo/src/i2c.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Hypothetical I2C implementation (replace with your actual hardware I2C)
|
||||
// struct MyI2c;
|
||||
|
||||
// impl I2c for MyI2c {
|
||||
// // type Error = I2cError;
|
||||
|
||||
// fn read(&mut self, _address: u8, _buffer: &mut [u8]) -> Result<(), Self::Error> {
|
||||
// // Simulate reading data
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
// fn write(&mut self, _address: u8, _bytes: &[u8]) -> Result<(), Self::Error> {
|
||||
// // Simulate writing data
|
||||
// Ok(())
|
||||
// }
|
||||
// }
|
@ -1,17 +1,59 @@
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use hal::prelude::*;
|
||||
use nrf52840_hal as hal;
|
||||
use usb_device::class_prelude::UsbBusAllocator;
|
||||
mod common;
|
||||
|
||||
mod i2c;
|
||||
|
||||
use core::fmt::Write;
|
||||
use hal::Rtc;
|
||||
use embedded_alloc::LlffHeap;
|
||||
use libm::sinf;
|
||||
use lsm6ds3tr::{
|
||||
interface::{I2cInterface, SpiInterface},
|
||||
LsmSettings, LSM6DS3TR,
|
||||
};
|
||||
// use lsm6ds3tr::{interface::SpiInterface, AccelScale, LsmSettings, LSM6DS3TR};
|
||||
use microflow::model;
|
||||
use nalgebra::matrix;
|
||||
use nrf52840_hal::{self as hal, twim, Spim, Twim};
|
||||
// use nrf_softdevice::{
|
||||
// ble::{EncryptionInfo, IdentityKey, MasterId, Uuid},
|
||||
// Softdevice,
|
||||
// };
|
||||
use usb_device::class_prelude::UsbBusAllocator;
|
||||
|
||||
use nrf52840_hal::{
|
||||
gpio::Level,
|
||||
prelude::{OutputPin, PinState, _embedded_hal_timer_CountDown},
|
||||
uarte::{Baudrate, Parity, Pins, Uarte},
|
||||
Rtc,
|
||||
};
|
||||
|
||||
use heapless::String;
|
||||
|
||||
// const BATTERY_SERVICE: Uuid = Uuid::new_16(0x180f);
|
||||
// const BATTERY_LEVEL: Uuid = Uuid::new_16(0x2a19);
|
||||
|
||||
// const LED_SERVICE_UUID: Uuid = Uuid::new_16(0x112f);
|
||||
// const LED_CONTROL_CHAR_UUID: Uuid = Uuid::new_16(0x321f);
|
||||
|
||||
const RTC_FREQ_MHZ: f32 = 0.032_768;
|
||||
|
||||
#[global_allocator]
|
||||
static HEAP: LlffHeap = LlffHeap::empty();
|
||||
|
||||
// #[embassy_executor::task]
|
||||
// async fn softdevice_task(sd: &'static Softdevice) {
|
||||
// sd.run().await;
|
||||
// }
|
||||
|
||||
// #[derive(Debug, Clone, Copy)]
|
||||
// struct Peer {
|
||||
// master_id: MasterId,
|
||||
// key: EncryptionInfo,
|
||||
// peer_id: IdentityKey,
|
||||
// }
|
||||
|
||||
#[panic_handler] // panicking behavior
|
||||
fn panic(_: &core::panic::PanicInfo) -> ! {
|
||||
reset_into_dfu();
|
||||
@ -20,11 +62,17 @@ fn panic(_: &core::panic::PanicInfo) -> ! {
|
||||
#[model("tflite_demo/models/sine.tflite")]
|
||||
struct Sine;
|
||||
|
||||
#[model("tflite_demo/models/speech.tflite")]
|
||||
struct Speech;
|
||||
|
||||
/// Resets the device into Device Firmware Update mode (DFU).
|
||||
fn reset_into_dfu() -> ! {
|
||||
// Via https://devzone.nordicsemi.com/f/nordic-q-a/50839/start-dfu-mode-or-open_bootloader-from-application-by-function-call
|
||||
unsafe { (*hal::pac::POWER::PTR).gpregret.write(|w| w.bits(0xB1)) };
|
||||
hal::pac::SCB::sys_reset();
|
||||
unsafe {
|
||||
(*hal::pac::POWER::PTR).gpregret.write(|w| w.bits(0xB1));
|
||||
};
|
||||
|
||||
hal::pac::SCB::sys_reset()
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@ -36,28 +84,70 @@ enum LightState {
|
||||
|
||||
#[cortex_m_rt::entry]
|
||||
fn main() -> ! {
|
||||
let peripherals = hal::pac::Peripherals::take().unwrap();
|
||||
let port0 = hal::gpio::p0::Parts::new(peripherals.P0);
|
||||
let mut led_red = port0.p0_26.into_push_pull_output(hal::gpio::Level::Low);
|
||||
let mut led_green = port0.p0_30.into_push_pull_output(hal::gpio::Level::Low);
|
||||
let mut led_blue = port0.p0_06.into_push_pull_output(hal::gpio::Level::Low);
|
||||
{
|
||||
use core::mem::MaybeUninit;
|
||||
const HEAP_SIZE: usize = 1024;
|
||||
static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
|
||||
unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) }
|
||||
}
|
||||
|
||||
let clocks = hal::clocks::Clocks::new(peripherals.CLOCK);
|
||||
let p = hal::pac::Peripherals::take().unwrap();
|
||||
let port0 = hal::gpio::p0::Parts::new(p.P0);
|
||||
let mut led_red = port0.p0_26.into_push_pull_output(Level::Low);
|
||||
let mut led_green = port0.p0_30.into_push_pull_output(Level::Low);
|
||||
let mut led_blue = port0.p0_06.into_push_pull_output(Level::Low);
|
||||
|
||||
let clocks = hal::clocks::Clocks::new(p.CLOCK);
|
||||
let clocks = clocks.enable_ext_hfosc();
|
||||
let usb_peripheral = hal::usbd::UsbPeripheral::new(peripherals.USBD, &clocks);
|
||||
let usb_peripheral = hal::usbd::UsbPeripheral::new(p.USBD, &clocks);
|
||||
let usb_bus = UsbBusAllocator::new(hal::usbd::Usbd::new(usb_peripheral));
|
||||
let mut serial_port = usbd_serial::SerialPort::new(&usb_bus);
|
||||
|
||||
let rtc = Rtc::new(peripherals.RTC0, 0).unwrap();
|
||||
// let spiclk = port0.p0_24.into_push_pull_output(Level::Low).degrade();
|
||||
// let spimosi = port0.p0_23.into_push_pull_output(Level::Low).degrade();
|
||||
// let spimiso = port0.p0_22.into_floating_input().degrade();
|
||||
|
||||
// let pins = nrf52840_hal::spim::Pins {
|
||||
// sck: Some(spiclk),
|
||||
// miso: Some(spimiso),
|
||||
// mosi: Some(spimosi),
|
||||
// };
|
||||
|
||||
// let spim = Spim::new(
|
||||
// p.SPIM2,
|
||||
// pins,
|
||||
// nrf52840_hal::spim::Frequency::K125,
|
||||
// nrf52840_hal::spim::MODE_0,
|
||||
// 0,
|
||||
// );
|
||||
|
||||
// let spi_interface = SpiInterface::new(spim);
|
||||
|
||||
// let settings = LsmSettings::basic();
|
||||
// let mut imu = LSM6DS3TR::new(spi_interface);
|
||||
// imu.init().expect("Couldn't initialize the LSM6 sensor!");
|
||||
|
||||
let scl = port0.p0_27.into_floating_input().degrade();
|
||||
let sda = port0.p0_07.into_floating_input().degrade();
|
||||
|
||||
let pins = twim::Pins { scl: scl, sda: sda };
|
||||
|
||||
let i2c = Twim::new(p.TWIM0, pins, twim::Frequency::K100);
|
||||
|
||||
let i2c_interface = I2cInterface::new(i2c);
|
||||
|
||||
// let mut imu = LSM6DS3TR::new(I2cInterface::new(""));
|
||||
|
||||
let rtc = Rtc::new(p.RTC0, 0).unwrap();
|
||||
rtc.enable_counter();
|
||||
|
||||
let mut usb_device = usb_device::device::UsbDeviceBuilder::new(
|
||||
&usb_bus,
|
||||
usb_device::device::UsbVidPid(0x16c0, 0x27dd),
|
||||
)
|
||||
.manufacturer("Wumpftech")
|
||||
.product("Wumpftech nRF52840")
|
||||
.serial_number("wumpf1")
|
||||
.manufacturer("HSRW")
|
||||
.product("HSRW Pet Tracker nRF52840")
|
||||
.serial_number("pet1")
|
||||
.device_class(usbd_serial::USB_CLASS_CDC)
|
||||
.max_packet_size_0(64) // makes control transfers 8x faster says https://github.com/nrf-rs/nrf-hal/blob/master/examples/usb/src/bin/serial.rs
|
||||
.build();
|
||||
@ -70,7 +160,7 @@ fn main() -> ! {
|
||||
|
||||
// TIMER0 is reserved by Softdevice
|
||||
// https://devzone.nordicsemi.com/f/nordic-q-a/1160/soft-device-and-timers---how-do-they-work-together
|
||||
let mut timer = hal::Timer::new(peripherals.TIMER1).into_periodic();
|
||||
let mut timer = hal::Timer::new(p.TIMER1).into_periodic();
|
||||
timer.start(hal::Timer::<hal::pac::TIMER0>::TICKS_PER_SECOND);
|
||||
|
||||
let mut light = LightState::Red;
|
||||
@ -93,13 +183,57 @@ fn main() -> ! {
|
||||
led_blue.set_state(PinState::High).unwrap();
|
||||
}
|
||||
LightState::Blue => {
|
||||
// led_red.set_state(PinState::High).unwrap();
|
||||
// led_green.set_state(PinState::High).unwrap();
|
||||
// led_blue.set_state(PinState::Low).unwrap();
|
||||
led_red.set_state(PinState::High).unwrap();
|
||||
led_green.set_state(PinState::High).unwrap();
|
||||
led_blue.set_state(PinState::Low).unwrap();
|
||||
//reset_into_dfu();
|
||||
}
|
||||
}
|
||||
|
||||
// if !usb_dev.poll(&mut [&mut serial]) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
let mut buf = [0u8; 64];
|
||||
|
||||
match serial_port.read(&mut buf) {
|
||||
Ok(count) if count > 0 => {
|
||||
// Check if received data equals to 'reset'
|
||||
for i in 0..count - 4 {
|
||||
if buf[i] == b'r'
|
||||
&& buf[i + 1] == b'e'
|
||||
&& buf[i + 2] == b's'
|
||||
&& buf[i + 3] == b'e'
|
||||
&& buf[i + 4] == b't'
|
||||
{
|
||||
reset_into_dfu();
|
||||
}
|
||||
}
|
||||
|
||||
if buf[..12].iter().all(|&x| x == 0) {
|
||||
reset_into_dfu();
|
||||
}
|
||||
|
||||
// Echo back in upper case
|
||||
for c in buf[0..count].iter_mut() {
|
||||
if 0x61 <= *c && *c <= 0x7a {
|
||||
*c &= !0x20;
|
||||
}
|
||||
}
|
||||
|
||||
let mut write_offset = 0;
|
||||
while write_offset < count {
|
||||
match serial_port.write(&buf[write_offset..count]) {
|
||||
Ok(len) if len > 0 => {
|
||||
write_offset += len;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let text = y_predicted.to_bits();
|
||||
let mut data = String::<32>::new();
|
||||
|
||||
@ -113,13 +247,11 @@ fn main() -> ! {
|
||||
let _ = serial_port.write(data.as_bytes());
|
||||
let _ = serial_port.write("\n".as_bytes());
|
||||
|
||||
|
||||
let _ = serial_port.write("Exact Y: ".as_bytes());
|
||||
let _ = write!(data2, "data:{text2}");
|
||||
let _ = serial_port.write(data2.as_bytes());
|
||||
let _ = serial_port.write("\n".as_bytes());
|
||||
|
||||
|
||||
while timer.wait().is_err() {
|
||||
// TODO: sleep.
|
||||
// Spec says poll needs to be called at least every 10ms.
|
||||
|
Loading…
x
Reference in New Issue
Block a user