timer: place global timer as a global variable
This commit is contained in:
parent
5ff0c22758
commit
338bcea5ce
1
Timer/.gitignore
vendored
Normal file
1
Timer/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/Debug/
|
||||
@ -12,6 +12,8 @@
|
||||
#include <atomic>
|
||||
#include <climits>
|
||||
|
||||
static volatile std::atomic_int timer;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
/**
|
||||
@ -69,7 +71,6 @@ public:
|
||||
|
||||
private:
|
||||
volatile std::atomic_int counter;
|
||||
volatile std::atomic_int timer;
|
||||
uint32_t freq;
|
||||
};
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "DigitalIoPin.h"
|
||||
#include "LiquidCrystal.h"
|
||||
#include "StateHandler.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include <cr_section_macros.h>
|
||||
|
||||
@ -65,6 +66,8 @@ main (void)
|
||||
|
||||
int16_t pressure = 1;
|
||||
|
||||
Timer glob_time;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (b_up.read ())
|
||||
@ -101,6 +104,7 @@ main (void)
|
||||
* - Update current pressure to eTick
|
||||
*/
|
||||
ventMachine.HandleState (Event (Event::eTick, pressure));
|
||||
glob_time.tickCounter(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user