timer: place global timer as a global variable

This commit is contained in:
Vasily Davydov 2022-10-16 13:55:00 +03:00
parent 5ff0c22758
commit 338bcea5ce
3 changed files with 7 additions and 1 deletions

1
Timer/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/Debug/

View File

@ -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;
};

View File

@ -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;