-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bumping to embedded-hal-1.0 #60
Comments
A PR exists to do this: #55 It's been sitting un-merged for quite some time, however. |
the PR is mine and the repo is here incase you want an alternative for the meantime with a |
in my understanding you don't need probably there should be a |
Then I'm probably using it wrong (freeRTOS)... use embedded_hal_bus::i2c; // initialize i2c1
let scl = gpiob.pb6;
let sda = gpiob.pb7;
let i2c1 = dp.I2C1.i2c(
(scl, sda),
i2cMode::Standard {
frequency: 100.kHz(),
},
&clocks,
);
let i2c_ref_cell = RefCell::new(i2c1);
Task::new()
.name("IR SENSOR TASK")
.stack_size(1024)
.priority(TaskPriority(3))
.start(move || {
let addr = SlaveAddr::default();
let mut ir_sensor =
Mlx9061x::new_mlx90614(i2c::RefCellDevice::new(&i2c_ref_cell), addr, 5).unwrap();
let mut raw_channel1;
let mut raw_channel2;
let mut ambient_temperature;
loop {
raw_channel1 = ir_sensor.raw_ir_channel1();
raw_channel2 = ir_sensor.raw_ir_channel2();
ambient_temperature = ir_sensor.ambient_temperature();
CurrentTask::delay(Duration::ms(100));
}
})
.unwrap();
Task::new()
.name("IR TEMPERATURE TASK")
.stack_size(1024)
.priority(TaskPriority(3))
.start(move || {
let mut raw = TemperatureRawValue::Err(Ads122Error::Timeout);
let mut temperature = TemperatureValue::Err(Ads122Error::Timeout);
let i2c_addr = 0x40;
let sensor_type = ADS122SensorType::PT1000;
let mut temperature_sensor =
TemperatureSensor::new(i2c_addr, i2c::RefCellDevice::new(&i2c_ref_cell));
let mut temperature_sensor_state = temperature_sensor.init(sensor_type).is_ok();
loop {
// do stuff
}
})
.unwrap();
this gives me this error:
|
i don't see you using |
@rursprung I'm creating a RefCellDevice in the constructor calls for the Devices: use embedded_hal_bus::i2c;
i2c::RefCellDevice::new(&i2c_ref_cell) Thanks, I'll look into the matrix room. |
Are there plans to bump this to embedded-hal-1.0?
I have not found an easy way to share an I2C and SPI bus between different tasks in embedded-hal-1.0 but it was super easy with shared-bus and embedded-hal-0.2 (I used freeRTOS).
Would be happy to help out!
The text was updated successfully, but these errors were encountered: