-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate logging functions, removed fellowAddLog() variants Move rtc implementation to core project
- Loading branch information
Showing
52 changed files
with
6,160 additions
and
6,120 deletions.
There are no files selected for viewing
971 changes: 485 additions & 486 deletions
971
fellow/SRC/WinFellow/C/RtcOkiMsm6242rs.cpp → ...SRC/WinFellow.Core/IO/RtcOkiMsm6242rs.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
176 changes: 90 additions & 86 deletions
176
...w/SRC/WinFellow/INCLUDE/RtcOkiMsm6242rs.h → ...w/SRC/WinFellow.Core/IO/RtcOkiMsm6242rs.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,90 @@ | ||
#pragma once | ||
|
||
#include "DEFS.H" | ||
|
||
class RtcOkiMsm6242rs; | ||
typedef uint16_t (RtcOkiMsm6242rs::*RtcOkiMsm6242rsRegisterGetter)(); | ||
typedef void (RtcOkiMsm6242rs::*RtcOkiMsm6242rsRegisterSetter)(uint16_t data); | ||
|
||
class RtcOkiMsm6242rs | ||
{ | ||
private: | ||
RtcOkiMsm6242rsRegisterGetter _registerGetters[16]; | ||
RtcOkiMsm6242rsRegisterSetter _registerSetters[16]; | ||
time_t _rtcLastActualTime; // Timestamp for when _rtcTime was set. Used to calculate time passed since then. | ||
time_t _rtcTime; // The RTC value as set by programs. | ||
int _rtcWeekdayModifier; // The weekday difference set by a program. | ||
|
||
uint16_t _irqFlag; | ||
uint16_t _holdFlag; | ||
uint16_t _thirtySecAdjFlag; | ||
uint16_t _busyFlag; | ||
uint16_t _maskFlag; | ||
uint16_t _itrptStdFlag; | ||
uint16_t _t0Flag; | ||
uint16_t _t1Flag; | ||
uint16_t _restFlag; | ||
uint16_t _stopFlag; | ||
uint16_t _twentyFourTwelveFlag; | ||
uint16_t _testFlag; | ||
|
||
struct tm* GetCurrentOrHeldTime(); | ||
void SetCurrentTime(struct tm *datetime); | ||
|
||
int GetRegisterNumberFromAddress(uint32_t address); | ||
|
||
uint16_t GetFirstDigit(int value); | ||
void SetFirstDigit(struct tm& datetime, int& value, uint16_t data); | ||
void ReplaceFirstDigit(int& value, int new_digit); | ||
|
||
uint16_t GetSecondDigit(int value); | ||
void SetSecondDigit(struct tm& datetime, int& value, uint16_t data); | ||
void ReplaceSecondDigit(int& value, int new_digit); | ||
void ReplaceSecondDigitAllowBCDOverflow(int& value, int new_digit); | ||
|
||
uint16_t GetSecondRegister(); | ||
void SetSecondRegister(uint16_t data); | ||
uint16_t GetTenSecondRegister(); | ||
void SetTenSecondRegister(uint16_t data); | ||
uint16_t GetMinuteRegister(); | ||
void SetMinuteRegister(uint16_t data); | ||
uint16_t GetTenMinuteRegister(); | ||
void SetTenMinuteRegister(uint16_t data); | ||
uint16_t GetHourRegister(); | ||
void SetHourRegister(uint16_t data); | ||
uint16_t GetTenHourRegister(); | ||
void SetTenHourRegister(uint16_t data); | ||
uint16_t GetDayRegister(); | ||
void SetDayRegister(uint16_t data); | ||
uint16_t GetTenDayRegister(); | ||
void SetTenDayRegister(uint16_t data); | ||
uint16_t GetMonthRegister(); | ||
void SetMonthRegister(uint16_t data); | ||
uint16_t GetTenMonthRegister(); | ||
void SetTenMonthRegister(uint16_t data); | ||
uint16_t GetYearRegister(); | ||
void SetYearRegister(uint16_t data); | ||
uint16_t GetTenYearRegister(); | ||
void SetTenYearRegister(uint16_t data); | ||
uint16_t GetWeekRegister(); | ||
void SetWeekRegister(uint16_t data); | ||
uint16_t GetControlRegisterD(); | ||
void SetControlRegisterD(uint16_t data); | ||
uint16_t GetControlRegisterE(); | ||
void SetControlRegisterE(uint16_t data); | ||
uint16_t GetControlRegisterF(); | ||
void SetControlRegisterF(uint16_t data); | ||
|
||
void InitializeRegisterGetters(); | ||
void InitializeRegisterSetters(); | ||
|
||
public: | ||
uint16_t read(uint32_t address); | ||
void write(uint16_t data, uint32_t address); | ||
void logRtcTime(char *msg); | ||
RtcOkiMsm6242rs(); | ||
}; | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <ctime> | ||
#include "Service/ILog.h" | ||
|
||
class RtcOkiMsm6242rs; | ||
typedef uint16_t (RtcOkiMsm6242rs::*RtcOkiMsm6242rsRegisterGetter)(); | ||
typedef void (RtcOkiMsm6242rs::*RtcOkiMsm6242rsRegisterSetter)(uint16_t data); | ||
|
||
class RtcOkiMsm6242rs | ||
{ | ||
private: | ||
Service::ILog* _log; | ||
|
||
RtcOkiMsm6242rsRegisterGetter _registerGetters[16]; | ||
RtcOkiMsm6242rsRegisterSetter _registerSetters[16]; | ||
time_t _rtcLastActualTime; // Timestamp for when _rtcTime was set. Used to calculate time passed since then. | ||
time_t _rtcTime; // The RTC value as set by programs. | ||
int _rtcWeekdayModifier; // The weekday difference set by a program. | ||
|
||
uint16_t _irqFlag; | ||
uint16_t _holdFlag; | ||
uint16_t _thirtySecAdjFlag; | ||
uint16_t _busyFlag; | ||
uint16_t _maskFlag; | ||
uint16_t _itrptStdFlag; | ||
uint16_t _t0Flag; | ||
uint16_t _t1Flag; | ||
uint16_t _restFlag; | ||
uint16_t _stopFlag; | ||
uint16_t _twentyFourTwelveFlag; | ||
uint16_t _testFlag; | ||
|
||
struct tm* GetCurrentOrHeldTime(); | ||
void SetCurrentTime(struct tm *datetime); | ||
|
||
int GetRegisterNumberFromAddress(uint32_t address); | ||
|
||
uint16_t GetFirstDigit(int value); | ||
void SetFirstDigit(struct tm& datetime, int& value, uint16_t data); | ||
void ReplaceFirstDigit(int& value, int new_digit); | ||
|
||
uint16_t GetSecondDigit(int value); | ||
void SetSecondDigit(struct tm& datetime, int& value, uint16_t data); | ||
void ReplaceSecondDigit(int& value, int new_digit); | ||
void ReplaceSecondDigitAllowBCDOverflow(int& value, int new_digit); | ||
|
||
uint16_t GetSecondRegister(); | ||
void SetSecondRegister(uint16_t data); | ||
uint16_t GetTenSecondRegister(); | ||
void SetTenSecondRegister(uint16_t data); | ||
uint16_t GetMinuteRegister(); | ||
void SetMinuteRegister(uint16_t data); | ||
uint16_t GetTenMinuteRegister(); | ||
void SetTenMinuteRegister(uint16_t data); | ||
uint16_t GetHourRegister(); | ||
void SetHourRegister(uint16_t data); | ||
uint16_t GetTenHourRegister(); | ||
void SetTenHourRegister(uint16_t data); | ||
uint16_t GetDayRegister(); | ||
void SetDayRegister(uint16_t data); | ||
uint16_t GetTenDayRegister(); | ||
void SetTenDayRegister(uint16_t data); | ||
uint16_t GetMonthRegister(); | ||
void SetMonthRegister(uint16_t data); | ||
uint16_t GetTenMonthRegister(); | ||
void SetTenMonthRegister(uint16_t data); | ||
uint16_t GetYearRegister(); | ||
void SetYearRegister(uint16_t data); | ||
uint16_t GetTenYearRegister(); | ||
void SetTenYearRegister(uint16_t data); | ||
uint16_t GetWeekRegister(); | ||
void SetWeekRegister(uint16_t data); | ||
uint16_t GetControlRegisterD(); | ||
void SetControlRegisterD(uint16_t data); | ||
uint16_t GetControlRegisterE(); | ||
void SetControlRegisterE(uint16_t data); | ||
uint16_t GetControlRegisterF(); | ||
void SetControlRegisterF(uint16_t data); | ||
|
||
void InitializeRegisterGetters(); | ||
void InitializeRegisterSetters(); | ||
|
||
public: | ||
uint16_t read(uint32_t address); | ||
void write(uint16_t data, uint32_t address); | ||
void logRtcTime(char *msg); | ||
RtcOkiMsm6242rs(Service::ILog* log); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,9 @@ namespace mock::Core::Service | |
{ | ||
// Stub | ||
} | ||
|
||
void LogMock::AddTimelessLog(const char*, ...) | ||
{ | ||
// Stub | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.