Skip to content

Commit

Permalink
Implementing wheel speed sensor for Arduino.
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Feb 1, 2024
1 parent 5bccf07 commit 4abb109
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion arduino/leads_vec/WheelSpeedSensor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "WheelSpeedSensor.h"
#include "Algorithms.h"

WheelSpeedSensor::WheelSpeedSensor(int *const pins, void (*onUpdate)(int ws)) : Device<int>(pins), _onUpdate(onUpdate) {
WheelSpeedSensor::WheelSpeedSensor(int *const pins, OnUpdate onUpdate) : Device<int>(pins), _onUpdate(onUpdate) {
}

void WheelSpeedSensor::initialize() {
Expand Down
6 changes: 4 additions & 2 deletions arduino/leads_vec/WheelSpeedSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

#define BOUNCETIME 100

typedef void (*OnUpdate)(int ws);

class WheelSpeedSensor : public Device<int> {
protected:
long _t1, _t2;
void (*_onUpdate)(int ws);
OnUpdate _onUpdate;

public:
WheelSpeedSensor(int *const pins, void (*onUpdate)(int ws));
WheelSpeedSensor(int *const pins, OnUpdate onUpdate);
void initialize();
int read();
String debug();
Expand Down

0 comments on commit 4abb109

Please sign in to comment.