POC1.5 prototype 2 x color sensor 2 x LM75B 3 x AnalogIn 1 x accel

Dependencies:   mbed vt100

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers af_mgr.cpp Source File

af_mgr.cpp

00001 #include "mbed.h"
00002 #include "string.h"
00003 #include "vt100.h"
00004 #include "edge_time.h"
00005 #include "edge_pin.h"
00006 #include "afLib.h"
00007 #include "pending.h"
00008 #include "msg_types.h"
00009 #include "mbedSPI.h"
00010 #include "af_mgr.h"
00011 
00012 
00013 afLib           *afero = 0 ;
00014 pending_class   *pending = 0 ;
00015 InterruptIn     *afero_int = 0 ;
00016 mbedSPI         *afero_spi = 0 ;
00017 DigitalOut      *afero_reset ;
00018 bool            gLinkedState = false ;
00019 
00020 void afero_isr(void)
00021 {
00022     afero->mcuISR() ;
00023 }
00024 
00025 void init_aflib(void)
00026 {
00027     afero_reset = new DigitalOut(PIN_ASR_RESET, 1) ; /* create as deasserted */
00028     afero_spi = new mbedSPI(PIN_MOSI, PIN_MISO, PIN_SCK, PIN_CS) ;
00029 
00030     afero = new afLib(
00031         PIN_INTR,
00032         afero_isr,
00033         attributeChangeRequest,
00034         attributeUpdatedReport,
00035         afero_spi ) ;
00036     wait(0.1) ;
00037     *afero_reset = 0 ;
00038     wait(0.5) ; /* required 250ms ~ time for reset */
00039     *afero_reset = 1 ;        
00040 }