Orefatoi / Mbed 2 deprecated afero_poc15_171201

Dependencies:   mbed vt100

af_utils/af_mgr.cpp

Committer:
Rhyme
Date:
2017-12-12
Revision:
13:88ee926c56ae
Parent:
3:cac964851bb6

File content as of revision 13:88ee926c56ae:

#include "mbed.h"
#include "string.h"
#include "vt100.h"
#include "edge_time.h"
#include "edge_pin.h"
#include "afLib.h"
#include "pending.h"
#include "msg_types.h"
#include "mbedSPI.h"
#include "af_mgr.h"


afLib           *afero = 0 ;
pending_class   *pending = 0 ;
InterruptIn     *afero_int = 0 ;
mbedSPI         *afero_spi = 0 ;
DigitalOut      *afero_reset ;
bool            gLinkedState = false ;

void afero_isr(void)
{
    afero->mcuISR() ;
}

void init_aflib(void)
{
    afero_reset = new DigitalOut(PIN_ASR_RESET, 1) ; /* create as deasserted */
    afero_spi = new mbedSPI(PIN_MOSI, PIN_MISO, PIN_SCK, PIN_CS) ;

    afero = new afLib(
        PIN_INTR,
        afero_isr,
        attributeChangeRequest,
        attributeUpdatedReport,
        afero_spi ) ;
    wait(0.1) ;
    *afero_reset = 0 ;
    wait(0.5) ; /* required 250ms ~ time for reset */
    *afero_reset = 1 ;        
}