afLib 1.3 which is supporting both SPI and UART

Dependencies:   vt100 mbed afLib_1_3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers edge_mgr.cpp Source File

edge_mgr.cpp

00001 #include "mbed.h"
00002 #include "edge_mgr.h"
00003 #include "edge_reset_mgr.h"
00004 #include "af_attributes.h"
00005 
00006 #include "edge_time.h"
00007 #include "edge_pin.h"
00008 
00009 bool            verbos = true ;
00010 
00011 static int error_tolerance   = 100 ;
00012 static int loop_interval     = 100 ; // 1000 ; 
00013 int        edge_mgr_status   = EDGE_MGR_INIT ;
00014 char       *reset_reason_str = 0 ;
00015 
00016 int init_edge_attribute(void)
00017 {
00018     static int attr_index = 0 ;
00019     static int error_count = 0 ;
00020     int return_value = 0 ;
00021     int result ;
00022      
00023    
00024     if (error_count > error_tolerance) { // too many fails, trying reset
00025         reboot_edge() ;
00026     }
00027  
00028     return(return_value) ;
00029 }
00030 
00031 void edge_loop(uint32_t count_robin)
00032 {       
00033     if ((count_robin % loop_interval) == 0) {
00034         loop_interval = 1 ;
00035     }
00036 }
00037 
00038 void   reboot_edge(void) 
00039 {
00040     software_reset() ;
00041 }