Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PrometheOSXbe/PrometheOSXbe/rtcManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#define EXTRACT_DATE_VALUE(value) ((((value & 0xf0) >> 4) * 10) + (value & 0x0f))
#define COMPOSE_DATE_VALUE(value) ((((value - (value % 10)) / 10) << 4) | (value % 10))

// DS3231 Control Register (0x0E) bit settings for square wave
#define SQW_1HZ_MODE 0x10 // Set square wave to 1Hz

uint8_t rtcManager::readByte(uint8_t reg)
{
const int rtcAddess = 0x68;
Expand Down Expand Up @@ -46,6 +49,8 @@ void rtcManager::setDateTime(rtcDateTime dateTime)
writeByte(4, COMPOSE_DATE_VALUE(utcSystemTime.wDay));
writeByte(5, COMPOSE_DATE_VALUE(utcSystemTime.wMonth));
writeByte(6, COMPOSE_DATE_VALUE(utcSystemTime.wYear % 100));

writeByte(0x0E, SQW_1HZ_MODE); // Set square wave output to 1Hz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably read the value from register then mask out frequency bits then logical or SQW_1HZ_MODE

Copy link
Contributor

@EqUiNoX-Labs EqUiNoX-Labs Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After careful consideration, at this moment we have decided not to merge in this feature, we suggest that you maintain a fork of which you can pull in latest changes as and when.

We also suggest in your fork, that Specific functions to BSX should be wrapped around a #ifdef BSX which will help highlight board specific changes.

Copy link
Author

@Bowlsnapper Bowlsnapper Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate your feedback and your consideration. Thank you for the advice. I will take it into account and will try to compile a version for myself with better and more efficient code than the experimental code I am messing with, which is only a few lines. I will edit my additions to be more thorough and to sync in time with the time that is stored and running.

}

rtcDateTime rtcManager::getDateTime()
Expand Down