-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some functions to PCF8523 (Alarm) #291
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few suggestions that could help make this pull request better. Note, though, that this is just my opinion: I am only a contributor here, not a maintainer.
- Name the new methods using camelCase rather than snake_case, as this is the style used in the current code.
- Make sure your code does not introduce new warnings, even when the IDE is configured to show “All” warnings. Specifically, you should have seen a couple of
warning: '<<' in boolean context
that reveal actual coding errors. - Test the code, even if it is straight forward.
- Write a more descriptive commit message.
- When writing the pull request cover letter, remove the default text with the guidelines.
- If the CI reports a failure, check what is wrong and fix it.
src/RTC_PCF8523.cpp
Outdated
/**************************************************************************/ | ||
|
||
bool RTC_PCF8523::is_alarm_fired(void) { | ||
return (read_register(PCF8523_CONTROL_2) && (1 << 3));//Check AF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return (read_register(PCF8523_CONTROL_2) && (1 << 3));//Check AF | |
return (read_register(PCF8523_CONTROL_2) & (1 << 3));//Check AF |
src/RTC_PCF8523.cpp
Outdated
/**************************************************************************/ | ||
|
||
bool RTC_PCF8523::is_any_alarm_setup(void) { | ||
if(read_register(PCF8523_CONTROL_1) && (1<<1)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(read_register(PCF8523_CONTROL_1) && (1<<1)){ | |
if(read_register(PCF8523_CONTROL_1) & (1<<1)){ |
src/RTC_PCF8523.cpp
Outdated
|
||
#ifdef DEBUG_RTCLIB | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",3,buffer[1]); | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",4,buffer[2]); | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",5,buffer[3]); | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",6,buffer[4]); | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",7,buffer[5]); | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",8,buffer[6]); | ||
DEBUG_RTCLIB.printf("I2C_W(0x%02X,0x%02X)\n",9,buffer[7]); | ||
#endif /* DEBUG_RTCLIB */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug statements probably do not belong to this pull request.
src/RTClib.cpp
Outdated
#ifdef DEBUG_RTCLIB | ||
Serial.printf("I2C_W(0x%02X,0x%02X)\n",reg,val); | ||
#endif /* DEBUG_RTCLIB */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifdef DEBUG_RTCLIB | |
Serial.printf("I2C_W(0x%02X,0x%02X)\n",reg,val); | |
#endif /* DEBUG_RTCLIB */ |
src/RTClib.cpp
Outdated
#ifdef DEBUG_RTCLIB | ||
DEBUG_RTCLIB.printf("I2C_R(0x%02X)=0x%02X\n",reg,buffer[0]); | ||
#endif /* DEBUG_RTCLIB */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifdef DEBUG_RTCLIB | |
DEBUG_RTCLIB.printf("I2C_R(0x%02X)=0x%02X\n",reg,buffer[0]); | |
#endif /* DEBUG_RTCLIB */ |
Thank you @edgar-bonet for your time |
Great! LGTM, but note that clang-format is being picky about your formatting, hence the CI failure. You may want to clang-format -i src/* or, alternatively, patch the output of the clang-format test failure to |
Thanks again @edgar-bonet |
Thank you for creating a pull request to contribute to Adafruit's GitHub code!
Before you open the request please review the following guidelines and tips to
help it be more easily integrated:
Describe the scope of your change--i.e. what the change does and what parts
of the code were modified. This will help us understand any risks of integrating
the code.
This PR just add few functions to PCF8523, and add Alarm function
Describe any known limitations with your change. For example if the change
doesn't apply to a supported platform of the library please mention it.
It should work straight everywhere
Please run any tests or examples that can exercise your modified code. We
strive to not break users of the code and running tests/examples helps with this
process.
It is straight forward
Thank you again for contributing! We will try to test and integrate the change
as soon as we can, but be aware we have many GitHub repositories to manage and
can't immediately respond to every request. There is no need to bump or check in
on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated--sometimes the
priorities of Adafruit's GitHub code (education, ease of use) might not match the
priorities of the pull request. Don't fret, the open source community thrives on
forks and GitHub makes it easy to keep your changes in a forked repo.
After reviewing the guidelines above you can delete this text from the pull request.