Skip to content

Commit

Permalink
use new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Jul 1, 2024
1 parent 1a67548 commit f05b409
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/can/core/ids.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ enum class SensorOutputBinding {
report = 0x2,
max_threshold_sync = 0x4,
auto_baseline_report = 0x8,
multi_sensor_sync = 0x10,
};

/** How a sensor's threshold should be interpreted. */
Expand Down
7 changes: 5 additions & 2 deletions include/sensors/core/tasks/capacitive_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ class FDC1004 {

void set_bind_sync(bool should_bind) {
bind_sync = should_bind;
hardware.set_sync_required(sensor_id);
hardware.reset_sync(sensor_id);
hardware.set_sync_enabled(sensor_id, should_bind);
}
void set_multi_sensor_sync(bool should_bind) {
hardware.set_sync_required(sensor_id, should_bind);
}

void set_max_bind_sync(bool should_bind) {
Expand Down Expand Up @@ -279,6 +281,7 @@ class FDC1004 {

if (max_capacitance_sync) {
if (capacitance > fdc1004::MAX_CAPACITANCE_READING) {
// Use the set_sync that always sets the sync line here
hardware.set_sync();
} else {
hardware.reset_sync(sensor_id);
Expand Down
5 changes: 4 additions & 1 deletion include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ class MMR920 {

void set_bind_sync(bool should_bind) {
bind_sync = should_bind;
hardware.set_sync_enabled(sensor_id, should_bind);
}

void set_multi_sensor_sync(bool should_bind) {
hardware.set_sync_required(sensor_id, should_bind);
hardware.reset_sync(sensor_id);
}

void set_max_bind_sync(bool should_bind) {
Expand Down
3 changes: 3 additions & 0 deletions include/sensors/core/tasks/pressure_sensor_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ class PressureMessageHandler {
driver.set_echoing(
m.binding &
static_cast<uint8_t>(can::ids::SensorOutputBinding::report));
driver.set_multi_sensor_sync(
m.binding &
static_cast<uint8_t>(can::ids::SensorOutputBinding::multi_sensor_sync));
driver.set_bind_sync(
m.binding &
static_cast<uint8_t>(can::ids::SensorOutputBinding::sync));
Expand Down

0 comments on commit f05b409

Please sign in to comment.