-
Notifications
You must be signed in to change notification settings - Fork 977
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 watchdog parameter-validation, and fix up misleading comments #1567
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.
Only tiny nits.
@@ -34,6 +35,7 @@ uint32_t watchdog_get_count(void) { | |||
// tag::watchdog_enable[] | |||
// Helper function used by both watchdog_enable and watchdog_reboot | |||
void _watchdog_enable(uint32_t delay_ms, bool pause_on_debug) { | |||
valid_params_if(WATCHDOG, delay_ms <= 8388); // i.e. floor(0xffffff / 2000) |
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.
Magic number, although it is commented. Move to a define? Only a nit though.
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.
Could do, but I'm not sure if it's worth it when it only appears once in a debug-level assert?
@@ -72,7 +77,7 @@ void watchdog_update(void); | |||
* onto the RPI-RP2), then this value will be cleared, and so \ref watchdog_enable_caused_reboot will | |||
* return false. | |||
* | |||
* \param delay_ms Number of milliseconds before watchdog will reboot without watchdog_update being called. Maximum of 0x7fffff, which is approximately 8.3 seconds | |||
* \param delay_ms Number of milliseconds before watchdog will reboot without watchdog_update being called. Maximum of 8388, which is approximately 8.3 seconds |
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.
8.3 IIF the source clock is default?
* | ||
* By default the SDK assumes a 12MHz XOSC and sets the \ref watchdog_start_tick appropriately. | ||
* | ||
* \param pc If Zero, a standard boot will be performed, if non-zero this is the program counter to jump to on reset. | ||
* \param sp If \p pc is non-zero, this will be the stack pointer used. | ||
* \param delay_ms Initial load value. Maximum value 0x7fffff, approximately 8.3s. | ||
* \param delay_ms Initial load value. Maximum value 8388, approximately 8.3s. |
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.
8.3 IIF the source clock is default?
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.
Well, you could argue that the \note If \ref watchdog_start_tick value does not give a 1MHz clock to the watchdog system, then the \p delay_ms parameter will not be in milliseconds. See the datasheet for more details.
already covers that ? 🤷♂️
Fixes #1238 and #1550 (and #1241 #1409 #1505 which are duplicates of #1238)