-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTM32F4_RTC_Counter.h
36 lines (34 loc) · 1.03 KB
/
STM32F4_RTC_Counter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
STM32_RTC_Counter.h - Library for accurate timing
Created by Craig Wm. Versek, 2023-04-20
*/
#ifndef _STM32F4_RTC_COUNTER_H_INCLUDED
#define _STM32F4_RTC_COUNTER_H_INCLUDED
#include <Arduino.h>
#include <STM32RTC.h>
/*******************************************************************************
RTC_CounterClass
*******************************************************************************/
class RTC_CounterClass{
public:
//Constructor
RTC_CounterClass(void);
//Configuration methods
void begin();
//Functionality methods
void reset();
void store();
uint64_t get_count_micros();
uint64_t get_offset_epoch_micros();
uint64_t get_stored_epoch_micros();
uint64_t __epochMicros_offset(){return _epochMicros_offset;};
uint64_t __epochMicros_stored(){return _epochMicros_stored;};
private:
uint32_t _convert_subSeconds_to_micros(uint32_t subSeconds);
//Attributes
int8_t _predivA;
int16_t _predivS;
uint64_t _epochMicros_offset;
uint64_t _epochMicros_stored;
};
#endif /* _STM32F4_RTC_COUNTER_H_INCLUDED */