global: remove timers

This commit is contained in:
Vasily Davydov
2022-10-24 15:24:34 +03:00
parent 84e50cdec7
commit 9608200f91
11 changed files with 149 additions and 185 deletions

View File

@@ -15,7 +15,7 @@ struct I2C_config {
unsigned int speed;
unsigned int clock_divider;
unsigned int i2c_mode;
I2C_config(): device_number(0), speed(100000), clock_divider(40), i2c_mode(IOCON_SFI2C_EN) {};
I2C_config(unsigned int dn, unsigned int sp, unsigned int cd): device_number(dn), speed(sp), clock_divider(cd), i2c_mode(IOCON_SFI2C_EN) {};
};
class I2C {

View File

@@ -122,7 +122,7 @@ private:
* weigh of fan, so voltage within range of 0-89 is not
* sufficient to start motor.
* TODO: Value 89 should be scaled to 0 at some point */
Counter fan_speed = { 20, 1000 };
Counter fan_speed = { 80, 1000 };
/*integral controller for PID. should be global, since it
* accumulates error signals encountered since startup*/
int integral = 0;

View File

@@ -15,7 +15,7 @@
class SwitchController
{
public:
SwitchController (DigitalIoPin *button, Timer *timer, StateHandler *handler,
SwitchController (DigitalIoPin *button, StateHandler *handler,
int button_mode);
virtual ~SwitchController ();
/** Listen to switch button
@@ -24,7 +24,6 @@ public:
private:
DigitalIoPin *b;
Timer *t;
StateHandler *h;
bool b_pressed;
int b_mode;

View File

@@ -13,7 +13,7 @@
#include <climits>
static volatile std::atomic_int timer;
static volatile std::atomic_int systicks;
static volatile std::atomic<uint32_t> systicks;
extern "C"
{
@@ -34,6 +34,8 @@ public:
*
*/
Timer (uint32_t freq = 1000);
Timer (bool mode);
virtual ~Timer ();
/**
@@ -75,6 +77,7 @@ public:
private:
volatile std::atomic_int counter;
uint32_t freq;
bool mode;
};
#endif /* TIMER_H_ */