Initial rough-in of motor controller
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user