Shivam Garg
/
EVAL-ADBMS2950_copy
branch to test I2C
Diff: program/src/print_result.cpp
- Revision:
- 9:0a4828d32e76
- Parent:
- 6:5d29fdcbae72
--- a/program/src/print_result.cpp Wed Sep 23 14:58:29 2020 +0000 +++ b/program/src/print_result.cpp Mon May 24 02:38:00 2021 +0000 @@ -750,8 +750,8 @@ pc.printf("Start ADI2 Conversion(Continuous): 6 |Set Reset GPO Pins: 31 \n"); pc.printf("Start ADI1 Redundant Conversion(Single Shot): 7 |GPIO SPI Write to Slave: 32 \n"); pc.printf("Start ADI1 Redundant Conversion(Continuous): 8 |GPIO SPI Read from Slave: 33 \n"); - pc.printf("Read CR, VBAT & IVBAT Registers(Single Shot): 9 |GPIO I2C Write to Slave: 34 \n"); - pc.printf("Read CR, VBAT & IVBAT Registers(Continuous): 10 |GPIO I2C Read from Slave: 35 \n"); + pc.printf("Read CR, VBAT & IVBAT Registers(Single Shot): 9 |GPIO I2C Write/Read to Slave: 34 \n"); + pc.printf("Read CR, VBAT & IVBAT Registers(Continuous): 10 | \n"); pc.printf("Read Overcurrent ADC Register(Single Shot): 11 | \n"); pc.printf("Read Overcurrent ADC Register(Continuous): 12 | \n"); pc.printf("Read Average CR, VBAT & IVBAT Registers(Single Shot): 13 | \n"); @@ -1500,8 +1500,8 @@ printf("Start ADI2 Conversion(Continuous): 6 |Set Reset GPO Pins: 31 \n"); printf("Start ADI1 Redundant Conversion(Single Shot): 7 |GPIO SPI Write to Slave: 32 \n"); printf("Start ADI1 Redundant Conversion(Continuous): 8 |GPIO SPI Read from Slave: 33 \n"); - printf("Read CR, VBAT & IVBAT Registers(Single Shot): 9 |GPIO I2C Write to Slave: 34 \n"); - printf("Read CR, VBAT & IVBAT Registers(Continuous): 10 |GPIO I2C Read from Slave: 35 \n"); + printf("Read CR, VBAT & IVBAT Registers(Single Shot): 9 |GPIO I2C Write/Read to Slave: 34 \n"); + printf("Read CR, VBAT & IVBAT Registers(Continuous): 10 | \n"); printf("Read Overcurrent ADC Register(Single Shot): 11 | \n"); printf("Read Overcurrent ADC Register(Continuous): 12 | \n"); printf("Read Average CR, VBAT & IVBAT Registers(Single Shot): 13 | \n"); @@ -1589,6 +1589,26 @@ /** ******************************************************************************* +* Function: print Data +* @brief Print Data. +* +* @details This function prints a Data of type int. +* +* @return None +* +******************************************************************************* +*/ +void printData(uint8_t data) +{ +#ifdef MBED + pc.printf("Read Data:%d\n", data); +#else /* IAR */ + printf("Read Data:%d\n", data); +#endif /* MBED */ +} + +/** +******************************************************************************* * Function: readUserInupt * @brief Read command input & print into console. * @@ -1611,6 +1631,26 @@ /** ******************************************************************************* +* Function: readUserData +* @brief Read data byte & print into console. +* +* @return None +* +******************************************************************************* +*/ +void readUserData(uint8_t *data) +{ +#ifdef MBED + pc.scanf("%d", data); + pc.printf("Entered data:%d\n", *data); +#else /* IAR */ + scanf("%d", data); + printf("Entered data:%d\n", *data); +#endif /* MBED */ +} + +/** +******************************************************************************* * Function: getVoltage * @brief Get Voltage with multiplication factor. *