hw functions for the SOLID slow control
Dependents: S_SCTRL_e_test SPItest sscm
Diff: S_SCTRL_SM1_hwfunct.cpp
- Revision:
- 1:af78e316f889
- Parent:
- 0:8d755a0f3ab3
- Child:
- 3:39671ee1347d
- Child:
- 4:a83242fe9d37
diff -r 8d755a0f3ab3 -r af78e316f889 S_SCTRL_SM1_hwfunct.cpp --- a/S_SCTRL_SM1_hwfunct.cpp Sun Sep 07 14:39:32 2014 +0000 +++ b/S_SCTRL_SM1_hwfunct.cpp Sun Sep 07 15:18:23 2014 +0000 @@ -1,72 +1,72 @@ /* hardware functions */ #include "mbed.h" #include "S_SCTRL_SM1_PinDef.h" -#include "S_CTRL_SM1_hwfunct.h" +#include "S_SCTRL_SM1_hwfunct.h" + -HWlines hwlines; -void assignports( ){ +void assignports(HWlines *hwlines ){ /// devices // SPI BI pins -hwlines.msio[0] = new DigitalInOut(ADC_STIO); -hwlines.sclk[0] = new DigitalOut(SCLK); -hwlines.direction[0] = new DigitalOut(DIRECTION); -hwlines.stio_mo[0] = new DigitalOut(STIO_MO); -hwlines.csb1_1[0] = new DigitalOut(ADC1_CSN); -hwlines.csb2_1[0] = new DigitalOut(ADC2_CSN); +hwlines->msio[0] = new DigitalInOut(ADC_STIO); +hwlines->sclk[0] = new DigitalOut(SCLK); +hwlines->direction[0] = new DigitalOut(DIRECTION); +hwlines->stio_mo[0] = new DigitalOut(STIO_MO); +hwlines->csb1_1[0] = new DigitalOut(ADC1_CSN); +hwlines->csb2_1[0] = new DigitalOut(ADC2_CSN); // SPI pins -hwlines.mosi[0] = new DigitalOut(MOSI); -hwlines.miso[0] = new DigitalIn(MISO); +hwlines->mosi[0] = new DigitalOut(MOSI); +hwlines->miso[0] = new DigitalIn(MISO); -hwlines.t_cs[0] = new DigitalOut(TEMP_CSN); -hwlines.tc_cs1[0] = new DigitalOut(TEMP_CABLE_CSN1); -hwlines.tc_cs2[0] = new DigitalOut(TEMP_CABLE_CSN2); -hwlines.dac_cs[0] = new DigitalOut(DAC_DCEN); -hwlines.dac_rst[0] = new DigitalOut(DAC_RSTN); +hwlines->t_cs[0] = new DigitalOut(TEMP_CSN); +hwlines->tc_cs1[0] = new DigitalOut(TEMP_CABLE_CSN1); +hwlines->tc_cs2[0] = new DigitalOut(TEMP_CABLE_CSN2); +hwlines->dac_cs[0] = new DigitalOut(DAC_DCEN); +hwlines->dac_rst[0] = new DigitalOut(DAC_RSTN); // devices // SPI BI pins -hwlines.msio[1] = new DigitalInOut(ADC_2_STIO); -hwlines.sclk[1] = new DigitalOut(SCLK2); -hwlines.direction[1] = new DigitalOut(DIRECTION2); -hwlines.stio_mo[1] = new DigitalOut(STIO2_MO); -hwlines.csb1_1[1] = new DigitalOut(ADC1_2_CSN); -hwlines.csb2_1[1] = new DigitalOut(ADC2_2_CSN); +hwlines->msio[1] = new DigitalInOut(ADC_2_STIO); +hwlines->sclk[1] = new DigitalOut(SCLK_2); +hwlines->direction[1] = new DigitalOut(DIRECTION2); +hwlines->stio_mo[1] = new DigitalOut(STIO2_MO); +hwlines->csb1_1[1] = new DigitalOut(ADC1_2_CSN); +hwlines->csb2_1[1] = new DigitalOut(ADC2_2_CSN); // SPI pins -hwlines.mosi[1] = new DigitalOut(MOSI_2); -hwlines.miso[1] = new DigitalIn(MISO_2); +hwlines->mosi[1] = new DigitalOut(MOSI_2); +hwlines->miso[1] = new DigitalIn(MISO_2); -hwlines.t_cs[1] = new DigitalOut(TEMP_2_CSN); -hwlines.tc_cs1[1] = new DigitalOut(TEMP_2_CABLE_CSN1); -hwlines.tc_cs2[1] = new DigitalOut(TEMP_2_CABLE_CSN2); -hwlines.dac_cs[1] = new DigitalOut(DAC_2_DCEN); -hwlines.dac_rst[1] = new DigitalOut(DAC_2_RSTN); +hwlines->t_cs[1] = new DigitalOut(TEMP_2_CSN); +hwlines->tc_cs1[1] = new DigitalOut(TEMP_2_CABLE_CSN1); +hwlines->tc_cs2[1] = new DigitalOut(TEMP_2_CABLE_CSN2); +hwlines->dac_cs[1] = new DigitalOut(DAC_2_DCEN); +hwlines->dac_rst[1] = new DigitalOut(DAC_2_RSTN); //cal -hwlines.cal13[0] = new DigitalOut(CAL_TRIG_1AND3); -hwlines.cal24[0] = new DigitalOut(CAL_TRIG_2AND4); -hwlines.calint[0] = new DigitalOut(SEL_CAL_INT); -hwlines.cal13[1] = new DigitalOut(CAL_TRIG_1AND3); -hwlines.cal24[1] = new DigitalOut(CAL_TRIG_2AND4); -hwlines.calint[1] = new DigitalOut(SEL_CAL_INT_2); +hwlines->cal13[0] = new DigitalOut(CAL_TRIG_1AND3); +hwlines->cal24[0] = new DigitalOut(CAL_TRIG_2AND4); +hwlines->calint[0] = new DigitalOut(SEL_CAL_INT); +hwlines->cal13[1] = new DigitalOut(CAL_TRIG_1AND3); +hwlines->cal24[1] = new DigitalOut(CAL_TRIG_2AND4); +hwlines->calint[1] = new DigitalOut(SEL_2_CAL_INT); -hwlines.calext = new DigitalOut(SEL_CAL_EXT); -hwlines.calgenext = new DigitalOut(GEN_EXT_CAL); +hwlines->calext = new DigitalOut(SEL_CAL_EXT); +hwlines->calgenext = new DigitalOut(GEN_EXT_CAL); -hwlines.ledred = new DigitalOut(LEDRED); -hwlines.ledgreen = new DigitalOut(LEDGREEN); +hwlines->ledred = new DigitalOut(LEDRED); +hwlines->ledgreen = new DigitalOut(LEDGREEN); -hwlines.ain1 = new AnalogIn(ADC1); -hwlines.ain2 = new AnalogIn(ADC2); +hwlines->ain[0] = new AnalogIn(ADC1); +hwlines->ain[1] = new AnalogIn(ADC2); } @@ -74,7 +74,7 @@ // select intern or extern cal 0 = intern, 1 is extern -void setcalsource( int extcal, HWlines hwl) { +void setcalsource( int external, HWlines hwl) { *(hwl.calext)=0; *(hwl.calint[0])=0; *(hwl.calint[0])=0; //disable all if ( external==1 ) {*(hwl.calext)=1; } else {*(hwl.calint[0])=1; *(hwl.calint[0])=1; } @@ -87,8 +87,8 @@ for ( int i=0;i<2;i++){ hwl.msio[i]->input(); *(hwl.direction[i])=LDIR_IN; - *(hwl.stio_mo[i])=RDIR_IN + *(hwl.stio_mo[i])=RDIR_IN; } - setcalsource(0,hwlines); //intern + setcalsource(0,hwl); //intern }