diff --git a/micro-rdk/src/common/sensor.rs b/micro-rdk/src/common/sensor.rs index d5c4bbe88..bbd8caf88 100755 --- a/micro-rdk/src/common/sensor.rs +++ b/micro-rdk/src/common/sensor.rs @@ -110,7 +110,7 @@ pub trait Readings { } } -pub trait Sensor: Readings + Status + DoCommand {} +pub trait Sensor: Readings + Status + DoCommand + Send {} pub type SensorType = Arc>; diff --git a/micro-rdk/src/esp32/coredump.rs b/micro-rdk/src/esp32/coredump.rs index 533cd4dda..3eb493a71 100644 --- a/micro-rdk/src/esp32/coredump.rs +++ b/micro-rdk/src/esp32/coredump.rs @@ -75,6 +75,11 @@ impl Coredump { } } +// *mut esp_idf_svc::sys::esp_flash_t (which is one of the attributes for `esp_partition_t`) does not +// implement Send. We force an implementation of Send here so we can actually wrap in an Arc> +// for now, but we should investigate a better canonical solution +unsafe impl Send for Coredump {} + impl Sensor for Coredump {} impl Readings for Coredump { diff --git a/micro-rdk/src/esp32/hcsr04.rs b/micro-rdk/src/esp32/hcsr04.rs index 8558f4e50..456e60a0f 100644 --- a/micro-rdk/src/esp32/hcsr04.rs +++ b/micro-rdk/src/esp32/hcsr04.rs @@ -120,6 +120,11 @@ pub struct HCSR04Sensor { isr_shared_state: Arc, } +// `Notification` contains an instance of `PhantomData`, but `const* ()` does not +// implement Send. We force an implementation of Send here so we can actually wrap in an Arc> +// for now, but we should investigate a better canonical solution +unsafe impl Send for HCSR04Sensor {} + impl HCSR04Sensor { pub fn from_config(cfg: ConfigType, _deps: Vec) -> Result { let trigger_pin = cfg