-
Notifications
You must be signed in to change notification settings - Fork 170
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 ResetReason and Watchdog driver docs #404
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## ResetReason | ||
|
||
Use the ResetReason interface to access hardware reset reason registers in a portable fashion. | ||
|
||
### ResetReason class reference | ||
|
||
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/v5.8/mbed-os-api-doxy/classmbed_1_1_resetreason.html) | ||
|
||
### ResetReason example | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add the examples from both files to the teams examples. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the teams examples you're referring to? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These: https://os.mbed.com/teams/mbed_example/ We've now given you access (we think), so please create your examples here, and let me know if you still need permissions. |
||
|
||
```c++ | ||
#include "mbed.h" | ||
#include "ResetReason.h" | ||
|
||
#include <string> | ||
|
||
std::string reset_reason_to_string(const reset_reason_t reason) | ||
{ | ||
switch (reason) | ||
{ | ||
case RESET_REASON_POWER_ON: | ||
return "Power On"; | ||
case RESET_REASON_PIN_RESET: | ||
return "Hardware Pin"; | ||
case RESET_REASON_SOFTWARE: | ||
return "Software Reset"; | ||
case RESET_REASON_WATCHDOG: | ||
return "Watchdog"; | ||
default: | ||
return "Other Reason"; | ||
} | ||
} | ||
|
||
int main() { | ||
const reset_reason_t reason = ResetReason::get(); | ||
|
||
printf("Last system reset reason: %s\n", reset_reason_to_string(reason).c_str()); | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
## Watchdog | ||
|
||
[Add description here.] | ||
Use the Watchdog interface to set up a hardware watchdog that resets the system after a set period of time if you do not periodically refresh it before it expires. | ||
|
||
<span class="notes">**Note:** The maximum amount of time that you can set as the Watchdog timeout varies depending on the target hardware. You can check the maximum value by calling `Watchdog::max_timeout()`.</span> | ||
|
||
### Watchdog class reference | ||
|
||
[Add class reference here. Ask your editor for help if you've never done this before.] | ||
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/v5.8/mbed-os-api-doxy/classmbed_1_1_watchdog.html) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This link doesn't work. Please fix it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please help me find the correct link here: https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/annotated.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are not contributing (porting) pages, so they should not go to feature branches. |
||
|
||
### Watchdog example | ||
|
||
[Add example here.] | ||
Create a watchdog timer that expires after 5 seconds and that you refresh by pushing BUTTON1 on the target board. | ||
|
||
```c++ | ||
#include "mbed.h" | ||
|
||
#include "InterruptIn.h" | ||
#include "mbed_sleep.h" | ||
#include "Watchdog.h" | ||
|
||
mbed::InterruptIn button(BUTTON1); | ||
mbed::Watchdog watchdog; | ||
|
||
void trigger() | ||
{ | ||
printf("Refreshing watchdog timer\r\n"); | ||
watchdog.kick(); | ||
} | ||
|
||
int main() | ||
{ | ||
printf("Board started, Watchdog timer initialized to 5 seconds.\r\n"); | ||
watchdog.start(5000); | ||
|
||
button.rise(&trigger); | ||
|
||
sleep(); | ||
} | ||
``` |
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.
This link doesn't work. Please fix it.
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.
The intended pages don't currently exist. Could you generate the docs pages to link to under https://os.mbed.com/docs/v5.7/feature-hal-spec-watchdog-doxy/modules.html
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.
Thanks for letting me know. I'll talk with @iriark01 about having these rendered.
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.
Sorry, have what rendered? Is it just a feature branch to add?
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.
This isn't actually a feature branch. This is a driver page. Can you please help me find the correct link here: https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/annotated.html
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.
That might be exclusions from the mbed-os repo's branch.
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 can't see it in the exclusion, but I'm never quite sure how that works
https://github.com/ARMmbed/mbed-os/blob/feature-watchdog/doxygen_options.json
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.
Ahh thanks, it looks like it might be the lack of DEVICE_RESET_REASON and DEVICE_WATCHDOG in the predefined section.
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.
@scartmell-arm is that something you can fix?
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.
ARMmbed/mbed-os#6332