Initial rough-in of motor controller

This commit is contained in:
2024-08-17 15:10:06 -04:00
parent 3633f636c6
commit 3185746213
11 changed files with 653 additions and 62 deletions

View File

@ -3,15 +3,10 @@
// Example for reference; not ready to use at all.
use esp32_nimble::{enums::*, uuid128, BLEAdvertisementData, BLEDevice, NimbleProperties};
use esp_idf_hal::delay::FreeRtos;
use esp_idf_sys as _;
fn main() {
esp_idf_sys::link_patches();
// Bind the log crate to the ESP Logging facilities
esp_idf_svc::log::EspLogger::initialize_default();
use esp_idf_svc::timer::EspTaskTimerService;
use core::time::Duration;
fn run_ble_server() {
// Take ownership of device
let ble_device = BLEDevice::take();
@ -74,9 +69,12 @@ fn main() {
// Init a value to pass to characteristic
let mut val = 0;
let timer_service = EspTaskTimerService::new()?;
let mut async_timer = timer_service.timer_async()?;
loop {
FreeRtos::delay_ms(1000);
async_timer.after(Duration::from_secs(1)).await?;
my_service_characteristic.lock().set_value(&[val]).notify();
val = val.wrapping_add(1);
}