Git Product home page Git Product logo

ds3231m's People

Contributors

lagg070988 avatar per1234 avatar sv-zanshin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ds3231m's Issues

How to stop an defined alarm

Hi

I got a problem, I can't find how to stop a defined alarm.
i work on a project where i need to set an alarm for a period for example every minutes between 01h00 and 03h00
I set an alarm like this:
DS3231M.setAlarm(everyMinute,DateTime(2023,6,9,01,00,0));

but after i can't stop it it fire every minutes. i tried to stop it with the parameter "alarmState":
DS3231M.setAlarm(everyMinute,DateTime(2023,6,9,01,00,0),false);
but it do nothing the alarm still fire every minutes. I can't find how to clear it (to stop the alarm fire)
the clearAlarm() only clear the fire flag for the next fire.

on the RCTlib from adafruit there is an API wo call disableAlarm() who seem to do the job, but i can't find such api on your library.
i use your library because it seem to be lighter than adafruit one.

regards

Doc example error ?

In the example of adjust function documentation there is the following line

MCP7940.adjust(DateTime(2017,8,5,18,19,20));; // Set the RTC to "2017-08-05 18:19:20"

Is it really MCP7940 variable that should be used?

DS3231 vs DS3231M

Hello, I realize that I have in my possession a DS3231, and it has some features that the DS3231M does not have.
One of them is the ability of the DS3231 to produce a frequency of 1hz, 1khz, 4khz or 8khz. while the DS3231M only produces 1hz.
here is a small explanation, although I am guided by the data sheets.
I am fairly new to github, I "fork" your library and made some add-ons (some lines of code) to support this feature. and it has worked fine on arduino uno, nano and some boards that I assemble as data logger.
since this library appears in arduino ide, I wonder: would it be wise to include these changes and expand the support for DS3231?

no way to tell whether the clock is set.

Is your feature request related to a problem? Please describe.
Unless I missed it (and I apologise if I did), there is no way to tell whether the clock is set.

Refer page15 of datasheet:
OSF: Oscillator stop flag. A logic 1 in this bit indicates that the oscillator either is stopped or was stopped for
some period and could be used to judge the validity of the timekeeping data. This bit is set to logic 1 any time
that the oscillator stops. This bit remains at logic 1 until written to logic 0. The following are examples of
conditions that can cause the OSF bit to be set:

  1. The first time power is applied.
  2. The voltages present on both VCC and VBAT are insufficient to support the oscillator.
  3. The EOSC bit is turned off in battery-backed mode.
  4. External influences on the oscillator (i.e., noise, leakage, etc.).

Describe the solution you'd like
Perhaps add a method to check the OSF flag of the STATUS register.

Suggested code (edit as you see fit).

bool DS3231M_Class::getOSF() 
{
  if(readByte(DS3231M_STATUS) & (1 << 7))  // check bit 7 of STATUS register.
  {
    return true ; 
  } else {
    return false ; 
  }
}

Describe alternatives you've considered

Additional context
Add any other context or screenshots about the feature request here.

logic on pinAlarm and pinSquareWave are inverted

void DS3231M_Class::pinAlarm() { writeByte(DS3231M_CONTROL,readByte(DS3231M_CONTROL)&~0x4); // Set bit 3 to on } // of method pinAlarm()
this logical operator (&~) should be an or |

void DS3231M_Class::pinSquareWave() { writeByte(DS3231M_CONTROL,readByte(DS3231M_CONTROL)|0x4); } // of method pinSquareWave()
this logical operator (|) should be an and &~

STM32 cant upload again

Expected Behavior

Detail what the expected program behavior should be, or what is expected to happen.

Actual Behavior

Detail what actually happens.

Steps to Reproduce the Problem

Explain what needs to be done in order to reproduce the problem.

  1. ST-Link can't detect again after uploading this library

Specifications

  • Library Version: 1.0.11
  • IDE Version: Arduino 2.1.0
  • Platform: STM32F4VE
  • Subsystem:
  • any other details needed to reproduce the problem

dayOfTheWeek() has incorrect range

Expected Behavior

dayOfTheWeek() is not in the range { 1 to 7 } as declared.

Actual Behavior

dayOfTheWeek() is in the range { 0 to 6 }

It will not be a problem if the range is declared as { 0 to 6 } in the Library.

.adjust() not setting the correct time

Hi I'm using code from the example adjusting the time:
Serial.print(F("\nStarting Set program\n"));
Serial.print(F("- Compiled with c++ version "));
Serial.print(F(VERSION));
Serial.print(F("\n- On "));
Serial.print(F(DATE));
Serial.print(F(" at "));
Serial.print(F(TIME));
Serial.print(F("\n"));
DS3231M.adjust();
now = DS3231M.now();
Serial.print(F("Time: "));
Serial.print(now.hour());
Serial.print(F(":"));
Serial.print(now.minute());
Serial.print(F(":"));
Serial.println(now.second());

But it does not seem as if it is working, because I get something like:
08:48:48.584 -> - Compiled with c++ version 7.3.0
08:48:48.584 -> - On Mar 18 2021 at 08:47:52
08:48:48.584 -> Time: 1:16:3

The compiled with time is correct, but the actual time is way off. Almost seem random!?

the bug of HOUR writing&reading

There's some bug when hour count's more than 20.After reading the reference of DS3231M,Knowing that HOUR isn't typical BCD,I suggest do so:
the low-5-bits are just like BCD;
read()&B01000000: 0 is 24h system,1 is12h-sys;
in 24h-sys,B00100000 means 20+,and attention that B00110000 is not allowed;
in 12h-sys,read()&B00100000:0 is AM,1 PM.

for example:
23:B00100011 or B01110001,not B00110011;
13:B00010011 or B01100001;
11:B00010001 or B01010001;
1:B00000001 or B01000001.

The SETDATE typed input fails due to the inputBuffer being shared (on Arduino Uno)

On the slow Arduino Uno, the SETDATE function always fails as you've shared the input buffer with the sprintf displaying the date/time. On fast CPU's this might work, but not on an Uno. Have to remember to set the serial terminal to send newlines otherwise input wrapping occurs.

Adding:
char outputBuffer[SPRINTF_BUFFER_SIZE]; // right below the inputBuffer definition

Changing inputBuffer to outputBuffer:
sprintf(outputBuffer,"%04d-%02d-%02d %02d:%02d:%02d", now.year(), // Use sprintf() to pretty print //
now.month(), now.day(), now.hour(), now.minute(), now.second()); // date/time with leading zeros //
Serial.println(outputBuffer);

Fixes the problem. The latest example on the Arduino library has this error.
Otherwise this is a nice library. I'd send a pull request but the changes are soo minimal.
Thanks, Shannon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.