Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -84,15 +84,15 @@ typedef struct { U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation. - U08 fpgaRev; ///< Reg 1. FPGA revision being reported. - U16 fpgaStatus; ///< Reg 2. FPGA status register. - U08 fpgaDiag; ///< Reg 4. FPGA diagnostic (R/W) register. - U08 adc1Control; ///< Reg 5. ADC1 control register. Bit 0=auto read enable. - U08 flowDAQ1Cmd; ///< Reg 6. Command passed to flow DAQ #1. - U08 flowDAQ2Cmd; ///< Reg 7. Command passed to flow DAQ #2. - U08 accelCmd; ///< Reg 8. Command passed to accelerometer. - U08 fpgaRevMajor; ///< Reg 9. FPGA Major revision #. - U08 fpgaRevLab; ///< Reg 10. FPGA Lab revision #. + U08 fpgaRev; ///< Reg 1. FPGA revision (minor) being reported. + U08 fpgaRevMajor; ///< Reg 2. FPGA revision (major) being reported. + U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported. + U16 fpgaStatus; ///< Reg 4. FPGA status register. + U08 fpgaDiag; ///< Reg 6. FPGA diagnostic (R/W) register. + U08 adc1Control; ///< Reg 7. ADC1 control register. Bit 0=auto read enable. + U08 flowDAQ1Cmd; ///< Reg 8. Command passed to flow DAQ #1. + U08 flowDAQ2Cmd; ///< Reg 9. Command passed to flow DAQ #2. + U08 accelCmd; ///< Reg 10. Command passed to accelerometer. U08 fpgaSensorTest; ///< Reg 11. Blood leak and bubble detector sensor test register. U16 fpgaPIDControl; ///< Reg 12. Valve PID enables. } FPGA_HEADER_T; // read only on FPGA @@ -1254,6 +1254,62 @@ { // 14-bits return fpgaSensorReadings.venousPressure & 0x3FFF; +} + +/*********************************************************************//** + * @brief + * The getFPGAAccelAxes function gets the accelerometer axis readings. \n + * Axis readings are in ADC counts. 0.004 g per LSB. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param x : Populate this param with X axis reading + * @param y : Populate this param with Y axis reading + * @param z : Populate this param with Z axis reading + * @return none + *************************************************************************/ +void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ) +{ + *x = (S16)fpgaSensorReadings.accelX; + *y = (S16)fpgaSensorReadings.accelY; + *z = (S16)fpgaSensorReadings.accelZ; +} + +/*********************************************************************//** + * @brief + * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings. \n + * from last FPGA read (every 10ms). \n + * Axis readings are in ADC counts. 0.004 g per LSB. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param x : Populate this param with maximum X axis reading + * @param y : Populate this param with maximum Y axis reading + * @param z : Populate this param with maximum Z axis reading + * @return none + *************************************************************************/ +void getFPGAAccelMaxes( S16 *xmax, S16*ymax, S16*zmax ) +{ + *xmax = (S16)fpgaSensorReadings.accelXMax; + *ymax = (S16)fpgaSensorReadings.accelYMax; + *zmax = (S16)fpgaSensorReadings.accelZMax; +} + +/*********************************************************************//** + * @brief + * The getFPGAAccelStatus function gets the accelerometer reading count \n + * and error register values. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param cnt : Populate this param with latest sample counter value + * @param err : Populate this param with latest error + * @return none + *************************************************************************/ +void getFPGAAccelStatus( U16 *cnt, U16 *err ) +{ + *cnt = fpgaSensorReadings.accelSampleCounter; + *err = fpgaSensorReadings.accelFaultRegister; } /*********************************************************************//**