Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: vt100 mbed afLib_1_3
edge_utils/edge_mgr.cpp@1:90652e9012b9, 2019-01-21 (annotated)
- Committer:
- Rhyme
- Date:
- Mon Jan 21 05:40:03 2019 +0000
- Revision:
- 1:90652e9012b9
- Parent:
- 0:87662653a3c6
test afLib1.3, test program of afLib 1.3(?) supporting SPI and UART
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:87662653a3c6 | 1 | #include "mbed.h" |
Rhyme | 0:87662653a3c6 | 2 | #include "edge_mgr.h" |
Rhyme | 0:87662653a3c6 | 3 | #include "edge_reset_mgr.h" |
Rhyme | 0:87662653a3c6 | 4 | #include "af_attributes.h" |
Rhyme | 0:87662653a3c6 | 5 | |
Rhyme | 0:87662653a3c6 | 6 | #include "edge_time.h" |
Rhyme | 0:87662653a3c6 | 7 | #include "edge_pin.h" |
Rhyme | 0:87662653a3c6 | 8 | |
Rhyme | 0:87662653a3c6 | 9 | bool verbos = true ; |
Rhyme | 0:87662653a3c6 | 10 | |
Rhyme | 0:87662653a3c6 | 11 | static int error_tolerance = 100 ; |
Rhyme | 0:87662653a3c6 | 12 | static int loop_interval = 100 ; // 1000 ; |
Rhyme | 0:87662653a3c6 | 13 | int edge_mgr_status = EDGE_MGR_INIT ; |
Rhyme | 0:87662653a3c6 | 14 | char *reset_reason_str = 0 ; |
Rhyme | 0:87662653a3c6 | 15 | |
Rhyme | 0:87662653a3c6 | 16 | int init_edge_attribute(void) |
Rhyme | 0:87662653a3c6 | 17 | { |
Rhyme | 0:87662653a3c6 | 18 | static int attr_index = 0 ; |
Rhyme | 0:87662653a3c6 | 19 | static int error_count = 0 ; |
Rhyme | 0:87662653a3c6 | 20 | int return_value = 0 ; |
Rhyme | 0:87662653a3c6 | 21 | int result ; |
Rhyme | 0:87662653a3c6 | 22 | |
Rhyme | 0:87662653a3c6 | 23 | |
Rhyme | 0:87662653a3c6 | 24 | if (error_count > error_tolerance) { // too many fails, trying reset |
Rhyme | 0:87662653a3c6 | 25 | reboot_edge() ; |
Rhyme | 0:87662653a3c6 | 26 | } |
Rhyme | 0:87662653a3c6 | 27 | |
Rhyme | 0:87662653a3c6 | 28 | return(return_value) ; |
Rhyme | 0:87662653a3c6 | 29 | } |
Rhyme | 0:87662653a3c6 | 30 | |
Rhyme | 0:87662653a3c6 | 31 | void edge_loop(uint32_t count_robin) |
Rhyme | 0:87662653a3c6 | 32 | { |
Rhyme | 0:87662653a3c6 | 33 | if ((count_robin % loop_interval) == 0) { |
Rhyme | 0:87662653a3c6 | 34 | loop_interval = 1 ; |
Rhyme | 0:87662653a3c6 | 35 | } |
Rhyme | 0:87662653a3c6 | 36 | } |
Rhyme | 0:87662653a3c6 | 37 | |
Rhyme | 0:87662653a3c6 | 38 | void reboot_edge(void) |
Rhyme | 0:87662653a3c6 | 39 | { |
Rhyme | 0:87662653a3c6 | 40 | software_reset() ; |
Rhyme | 0:87662653a3c6 | 41 | } |