mirror of
https://github.com/hubaldv/bioz-firmware-rs.git
synced 2025-12-06 05:01:18 +00:00
Included LED RPC.
This commit is contained in:
@@ -17,7 +17,7 @@ use postcard_rpc::{
|
||||
},
|
||||
};
|
||||
|
||||
use bioz_icd_rs::{PingEndpoint, GetUniqueIdEndpoint, ENDPOINT_LIST, TOPICS_IN_LIST, TOPICS_OUT_LIST};
|
||||
use bioz_icd_rs::{PingEndpoint, GetUniqueIdEndpoint, SetGreenLedEndpoint, ENDPOINT_LIST, TOPICS_IN_LIST, TOPICS_OUT_LIST};
|
||||
|
||||
pub struct Context {
|
||||
pub unique_id: [u8; 12],
|
||||
@@ -48,6 +48,7 @@ define_dispatch! {
|
||||
| ---------- | ---- | ------- |
|
||||
| PingEndpoint | blocking | ping_handler |
|
||||
| GetUniqueIdEndpoint | blocking | get_unique_id_handler |
|
||||
| SetGreenLedEndpoint | async | set_green_led_handler |
|
||||
};
|
||||
topics_in: {
|
||||
list: TOPICS_IN_LIST;
|
||||
@@ -124,4 +125,15 @@ fn ping_handler(_context: &mut Context, _header: VarHeader, rqst: u32) -> u32 {
|
||||
fn get_unique_id_handler(context: &mut Context, _header: VarHeader, _rqst: ()) -> [u8; 12] {
|
||||
info!("get_unique_id");
|
||||
context.unique_id
|
||||
}
|
||||
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::signal::Signal;
|
||||
|
||||
pub static LED_FREQUENCY_SIGNAL: Signal<CriticalSectionRawMutex, f32> = Signal::new();
|
||||
|
||||
async fn set_green_led_handler(_context: &mut Context, _header: VarHeader, rqst: f32) {
|
||||
info!("Set green led frequency to {:?} Hz", rqst);
|
||||
|
||||
LED_FREQUENCY_SIGNAL.signal(rqst);
|
||||
}
|
||||
Reference in New Issue
Block a user