Compare commits
3 Commits
6fc828e864
...
babfb92222
Author | SHA1 | Date | |
---|---|---|---|
babfb92222 | |||
b299f59d9f | |||
93efdd247f |
@ -12,14 +12,15 @@ The main concepts of Physical are:
|
||||
|
||||
* Peripheral: A peripheral is a board that hosts physical I/O and usually does analog to digital conversion or
|
||||
digital to analog conversion. A peripheral cannot function on its own, it must be connected to a node. This is more
|
||||
narrow than the definition of a peripheral in embedded systems generally. Peripheral support is done on the basis
|
||||
of complete boards, not individual components like an ADC. Abstractions for individual components should be made
|
||||
separately, such as in BFPOWER drivers.
|
||||
narrow than the definition of a peripheral in embedded systems generally. Peripheral support is focused on complete
|
||||
boards, not individual components like an ADC. Although common abstractions for components specific to physical
|
||||
can be provided in this repository, general component abstractions / drivers should be made separately, such as in
|
||||
BFPOWER drivers.
|
||||
* Node: A node hosts peripherals. A node can have a commander but does not need one. A node can ignore or even override
|
||||
commands from the commander. In a complex system, nodes are intended to be kept simple, less likely to
|
||||
encounter an error than the commander, and in some cases should check for obvious problems in commands from the
|
||||
commander.
|
||||
* Commander: A commander hosts nodes. It is possible for a device to be both a node and a commander at the same time,
|
||||
although it may not be the best idea to make such a setup. There is no concept of nesting commanders built into
|
||||
Physical. If some kind of abstraction for a computer that commands multiple commanders, which command nodes, is
|
||||
Physical. If some kind of abstraction for a computer that commands multiple commanders, which command nodes, is
|
||||
necessary, it should be made for that specific application.
|
@ -3,20 +3,17 @@
|
||||
#![feature(type_alias_impl_trait, async_fn_in_trait)]
|
||||
|
||||
use core::cell::Cell;
|
||||
use cortex_m::prelude::{
|
||||
_embedded_hal_blocking_delay_DelayMs, _embedded_hal_blocking_delay_DelayUs,
|
||||
};
|
||||
use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
use {embassy_executor as executor, embassy_stm32 as stm32};
|
||||
|
||||
use ads1256::standard::input::SingleEnded;
|
||||
use ads1256::{
|
||||
AdControl, Ads1256, AutoCal, BitOrder, BlockingDelay, Buffer, ClockOut, Config, DState,
|
||||
DataRate, DigitalIo, DigitalIoDirection, DigitalIoState, DioDirection, Gain, Multiplexer,
|
||||
MuxInput, OutputPin, Sdcs, SpiBus, Status, Wait,
|
||||
AdControl, Ads1256, AutoCal, BitOrder, Buffer, ClockOut, Config, DataRate, DigitalIo,
|
||||
DigitalIoDirection, DigitalIoState, Gain, Multiplexer, MuxInput, Sdcs, Status,
|
||||
};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::Delay;
|
||||
use executor::Spawner;
|
||||
use stm32::dma::NoDma;
|
||||
use stm32::exti::ExtiInput;
|
||||
@ -30,7 +27,7 @@ use uom::si::f32;
|
||||
|
||||
use defmt::{debug, error, info, trace, unwrap};
|
||||
use embassy_executor::_export::StaticCell;
|
||||
use embassy_stm32::peripherals::{EXTI6, PF6, PF7, SPI3};
|
||||
use embassy_stm32::peripherals::{PF6, PF7, SPI3};
|
||||
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
||||
use embassy_sync::pubsub::PubSubChannel;
|
||||
use physical_node::transducer::{Publish, StatefulPublisher};
|
||||
|
@ -3,19 +3,16 @@
|
||||
#![feature(type_alias_impl_trait, async_fn_in_trait)]
|
||||
|
||||
use core::cell::Cell;
|
||||
use core::ops::DerefMut;
|
||||
use cortex_m::prelude::{
|
||||
_embedded_hal_blocking_delay_DelayMs, _embedded_hal_blocking_delay_DelayUs,
|
||||
};
|
||||
|
||||
use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
use {embassy_executor as executor, embassy_stm32 as stm32};
|
||||
|
||||
use ads1256::standard::input::SingleEnded;
|
||||
use ads1256::{
|
||||
AdControl, Ads1256, AutoCal, BitOrder, BlockingDelay, Buffer, ClockOut, Config, DState,
|
||||
DataRate, DigitalIo, DigitalIoDirection, DigitalIoState, DioDirection, Gain, Multiplexer,
|
||||
MuxInput, OutputPin, Sdcs, SpiBus, Status, Wait,
|
||||
AdControl, Ads1256, AutoCal, BitOrder, Buffer, ClockOut, Config, DState, DataRate, DigitalIo,
|
||||
DigitalIoDirection, DigitalIoState, Gain, Multiplexer, MuxInput, Sdcs, Status,
|
||||
};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use executor::Spawner;
|
||||
@ -29,7 +26,7 @@ use stm32::{pac, spi};
|
||||
use uom::si::electric_potential::volt;
|
||||
use uom::si::f32;
|
||||
|
||||
use defmt::{debug, error, info, trace, unwrap};
|
||||
use defmt::info;
|
||||
use embassy_executor::_export::StaticCell;
|
||||
use embassy_stm32::peripherals::{EXTI6, PF6, PF7, SPI3};
|
||||
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
||||
|
@ -2,21 +2,18 @@
|
||||
#![no_main]
|
||||
#![feature(type_alias_impl_trait, async_fn_in_trait)]
|
||||
|
||||
use core::cell::Cell;
|
||||
use cortex_m::prelude::{
|
||||
_embedded_hal_blocking_delay_DelayMs, _embedded_hal_blocking_delay_DelayUs,
|
||||
};
|
||||
use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs;
|
||||
// Necessary unused import.
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
use {embassy_executor as executor, embassy_stm32 as stm32};
|
||||
|
||||
use ads1256::standard::input::{Differential, SingleEnded};
|
||||
use ads1256::{
|
||||
AdControl, Ads1256, AutoCal, BitOrder, BlockingDelay, Buffer, ClockOut, Config, DState,
|
||||
DataRate, DigitalIo, DigitalIoDirection, DigitalIoState, DioDirection, Gain, Multiplexer,
|
||||
MuxInput, OutputPin, Sdcs, SpiBus, Status, Wait,
|
||||
AdControl, Ads1256, AutoCal, BitOrder, Buffer, ClockOut, Config, DataRate, DigitalIo,
|
||||
DigitalIoDirection, DigitalIoState, Gain, Multiplexer, MuxInput, Sdcs, Status,
|
||||
};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::Delay;
|
||||
use executor::Spawner;
|
||||
use stm32::dma::NoDma;
|
||||
use stm32::exti::ExtiInput;
|
||||
@ -26,9 +23,8 @@ use stm32::time::Hertz;
|
||||
use stm32::{pac, spi};
|
||||
|
||||
use uom::si::electric_potential::{millivolt, volt};
|
||||
use uom::si::f32;
|
||||
|
||||
use defmt::{debug, error, info, trace, unwrap};
|
||||
use defmt::info;
|
||||
use physical::transducer::{lm35, thermocouple_k};
|
||||
use uom::si::thermodynamic_temperature::degree_celsius;
|
||||
|
||||
@ -88,7 +84,7 @@ async fn main(spawner: Spawner) {
|
||||
ads_1256.self_calibrate(&mut spi).await.unwrap();
|
||||
|
||||
loop {
|
||||
let gain = Gain::X4;
|
||||
let gain = Gain::X2;
|
||||
let reference = ads_1256
|
||||
.autocal_convert(
|
||||
&mut spi,
|
||||
@ -101,9 +97,13 @@ async fn main(spawner: Spawner) {
|
||||
.await
|
||||
.unwrap()
|
||||
.to_voltage(gain);
|
||||
let reference_volts = reference.get::<volt>();
|
||||
let reference = lm35::convert(reference).unwrap();
|
||||
let reference_celsius = reference.get::<degree_celsius>();
|
||||
info!("Reference junction temperature: {}°C", reference_celsius);
|
||||
info!(
|
||||
"Reference junction temperature: {}°C, from voltage reading: {}V",
|
||||
reference_celsius, reference_volts
|
||||
);
|
||||
|
||||
let gain = Gain::X64;
|
||||
let voltage = ads_1256
|
||||
@ -121,6 +121,6 @@ async fn main(spawner: Spawner) {
|
||||
let mv = voltage.get::<millivolt>();
|
||||
let temperature = thermocouple_k::convert_direct(voltage, reference).unwrap();
|
||||
let celsius = temperature.get::<degree_celsius>();
|
||||
info!("Thermocouple temperature: {}°C, millivolts: {}", celsius, mv);
|
||||
info!("Thermocouple temperature: {}°C, from reading: {}mV", celsius, mv);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user