Gas Pressure Display Updated Power control for Pressure sensor added

Dependencies:   UniGraphic mbed vt100

Committer:
Rhyme
Date:
Fri Feb 16 08:27:50 2018 +0000
Revision:
0:37c8ecde13c2
control PSE530 power via PTC5 (pse530_en)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:37c8ecde13c2 1 #include "mbed.h"
Rhyme 0:37c8ecde13c2 2 #include "string.h"
Rhyme 0:37c8ecde13c2 3 #include "vt100.h"
Rhyme 0:37c8ecde13c2 4 #include "edge_time.h"
Rhyme 0:37c8ecde13c2 5 #include "edge_pin.h"
Rhyme 0:37c8ecde13c2 6 #include "edge_reset_mgr.h"
Rhyme 0:37c8ecde13c2 7 #include "afLib.h"
Rhyme 0:37c8ecde13c2 8 #include "pending.h"
Rhyme 0:37c8ecde13c2 9 #include "msg_types.h"
Rhyme 0:37c8ecde13c2 10 #include "mbedSPI.h"
Rhyme 0:37c8ecde13c2 11 #include "af_mgr.h"
Rhyme 0:37c8ecde13c2 12
Rhyme 0:37c8ecde13c2 13 afLib *afero = 0 ;
Rhyme 0:37c8ecde13c2 14 pending_class *pending = 0 ;
Rhyme 0:37c8ecde13c2 15 InterruptIn *afero_int = 0 ;
Rhyme 0:37c8ecde13c2 16 mbedSPI *afero_spi = 0 ;
Rhyme 0:37c8ecde13c2 17 DigitalOut *afero_reset ;
Rhyme 0:37c8ecde13c2 18 bool gLinked = false ;
Rhyme 0:37c8ecde13c2 19 bool gConnected = false ;
Rhyme 0:37c8ecde13c2 20
Rhyme 0:37c8ecde13c2 21 void afero_isr(void)
Rhyme 0:37c8ecde13c2 22 {
Rhyme 0:37c8ecde13c2 23 afero->mcuISR() ;
Rhyme 0:37c8ecde13c2 24 }
Rhyme 0:37c8ecde13c2 25
Rhyme 0:37c8ecde13c2 26 void init_aflib(void)
Rhyme 0:37c8ecde13c2 27 {
Rhyme 0:37c8ecde13c2 28 afero_reset = new DigitalOut(PIN_ASR_RESET, 1) ; /* create as deasserted */
Rhyme 0:37c8ecde13c2 29 afero_spi = new mbedSPI(PIN_MOSI, PIN_MISO, PIN_SCK, PIN_CS) ;
Rhyme 0:37c8ecde13c2 30
Rhyme 0:37c8ecde13c2 31 reset_watch_dog() ;
Rhyme 0:37c8ecde13c2 32 afero = new afLib(
Rhyme 0:37c8ecde13c2 33 PIN_INTR,
Rhyme 0:37c8ecde13c2 34 afero_isr,
Rhyme 0:37c8ecde13c2 35 attributeChangeRequest,
Rhyme 0:37c8ecde13c2 36 attributeUpdatedReport,
Rhyme 0:37c8ecde13c2 37 afero_spi ) ;
Rhyme 0:37c8ecde13c2 38 reset_watch_dog() ;
Rhyme 0:37c8ecde13c2 39 wait(0.1) ;
Rhyme 0:37c8ecde13c2 40 *afero_reset = 0 ;
Rhyme 0:37c8ecde13c2 41 wait(0.5) ; /* required 250ms ~ time for reset */
Rhyme 0:37c8ecde13c2 42 *afero_reset = 1 ;
Rhyme 0:37c8ecde13c2 43 reset_watch_dog() ;
Rhyme 0:37c8ecde13c2 44 wait(0.5) ;
Rhyme 0:37c8ecde13c2 45 reset_watch_dog() ;
Rhyme 0:37c8ecde13c2 46 }