Orefatoi / Mbed 2 deprecated test_afLib13_uart_180423

Dependencies:   vt100 mbed afLib_1_3

edge_utils/edge_mgr.cpp

Committer:
Rhyme
Date:
2019-01-21
Revision:
1:90652e9012b9
Parent:
0:87662653a3c6

File content as of revision 1:90652e9012b9:

#include "mbed.h"
#include "edge_mgr.h"
#include "edge_reset_mgr.h"
#include "af_attributes.h"

#include "edge_time.h"
#include "edge_pin.h"

bool            verbos = true ;

static int error_tolerance   = 100 ;
static int loop_interval     = 100 ; // 1000 ; 
int        edge_mgr_status   = EDGE_MGR_INIT ;
char       *reset_reason_str = 0 ;

int init_edge_attribute(void)
{
    static int attr_index = 0 ;
    static int error_count = 0 ;
    int return_value = 0 ;
    int result ;
     
   
    if (error_count > error_tolerance) { // too many fails, trying reset
        reboot_edge() ;
    }
 
    return(return_value) ;
}

void edge_loop(uint32_t count_robin)
{       
    if ((count_robin % loop_interval) == 0) {
        loop_interval = 1 ;
    }
}

void   reboot_edge(void) 
{
    software_reset() ;
}