Shivam Garg
/
EVAL-ADBMS2950_copy
branch to test I2C
program/src/print_result.cpp@3:3f1a94897050, 2020-07-24 (annotated)
- Committer:
- dpandit1988
- Date:
- Fri Jul 24 03:02:02 2020 +0000
- Revision:
- 3:3f1a94897050
- Parent:
- 2:4a10c825f860
- Child:
- 4:0e99350684aa
Print result name change VREF2 to VREF1P25
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dpandit1988 | 1:94a3e8fe5e25 | 1 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 2 | ******************************************************************************** |
dpandit1988 | 1:94a3e8fe5e25 | 3 | * |
dpandit1988 | 1:94a3e8fe5e25 | 4 | * @file: print_result.c |
dpandit1988 | 1:94a3e8fe5e25 | 5 | * |
dpandit1988 | 1:94a3e8fe5e25 | 6 | * @brief: This file contains the print result function implementation. |
dpandit1988 | 1:94a3e8fe5e25 | 7 | * |
dpandit1988 | 1:94a3e8fe5e25 | 8 | * @details: |
dpandit1988 | 1:94a3e8fe5e25 | 9 | * |
dpandit1988 | 1:94a3e8fe5e25 | 10 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 11 | Copyright(c) 2020 Analog Devices, Inc. All Rights Reserved. This software is |
dpandit1988 | 1:94a3e8fe5e25 | 12 | proprietary & confidential to Analog Devices, Inc. and its licensors. By using |
dpandit1988 | 1:94a3e8fe5e25 | 13 | this software you agree to the terms of the associated Analog Devices License |
dpandit1988 | 1:94a3e8fe5e25 | 14 | Agreement. |
dpandit1988 | 1:94a3e8fe5e25 | 15 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 16 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 17 | /*! \addtogroup Main |
dpandit1988 | 1:94a3e8fe5e25 | 18 | * @{ |
dpandit1988 | 1:94a3e8fe5e25 | 19 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 20 | |
dpandit1988 | 1:94a3e8fe5e25 | 21 | /*! \addtogroup Print_Result |
dpandit1988 | 1:94a3e8fe5e25 | 22 | * @{ |
dpandit1988 | 1:94a3e8fe5e25 | 23 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 24 | |
dpandit1988 | 1:94a3e8fe5e25 | 25 | #include "application.h" |
dpandit1988 | 1:94a3e8fe5e25 | 26 | #ifdef MBED |
dpandit1988 | 1:94a3e8fe5e25 | 27 | extern Serial pc; |
dpandit1988 | 1:94a3e8fe5e25 | 28 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 29 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 30 | * Function: printWriteConfig |
dpandit1988 | 1:94a3e8fe5e25 | 31 | * @brief Print write config A/B result. |
dpandit1988 | 1:94a3e8fe5e25 | 32 | * |
dpandit1988 | 1:94a3e8fe5e25 | 33 | * @details This function Print write config result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 34 | * |
dpandit1988 | 1:94a3e8fe5e25 | 35 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 36 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 37 | * |
dpandit1988 | 1:94a3e8fe5e25 | 38 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 39 | * |
dpandit1988 | 1:94a3e8fe5e25 | 40 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 41 | * |
dpandit1988 | 1:94a3e8fe5e25 | 42 | * @param [in] grp Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 43 | * |
dpandit1988 | 1:94a3e8fe5e25 | 44 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 45 | * |
dpandit1988 | 1:94a3e8fe5e25 | 46 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 47 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 48 | void printWriteConfig(uint8_t tIC, cell_asic *IC, TYPE type, GRP grp) |
dpandit1988 | 1:94a3e8fe5e25 | 49 | { |
dpandit1988 | 1:94a3e8fe5e25 | 50 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 51 | { |
dpandit1988 | 1:94a3e8fe5e25 | 52 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 53 | if(type == Config) |
dpandit1988 | 1:94a3e8fe5e25 | 54 | { |
dpandit1988 | 1:94a3e8fe5e25 | 55 | if(grp == A) |
dpandit1988 | 1:94a3e8fe5e25 | 56 | { |
dpandit1988 | 1:94a3e8fe5e25 | 57 | pc.printf("Write Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 58 | pc.printf("0x%X, ", IC[ic].configa.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 59 | pc.printf("0x%X, ", IC[ic].configa.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 60 | pc.printf("0x%X, ", IC[ic].configa.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 61 | pc.printf("0x%X, ", IC[ic].configa.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 62 | pc.printf("0x%X, ", IC[ic].configa.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 63 | pc.printf("0x%X\n\n", IC[ic].configa.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 64 | } |
dpandit1988 | 1:94a3e8fe5e25 | 65 | else if(grp == B) |
dpandit1988 | 1:94a3e8fe5e25 | 66 | { |
dpandit1988 | 1:94a3e8fe5e25 | 67 | pc.printf("Write Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 68 | pc.printf("0x%X, ", IC[ic].configb.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 69 | pc.printf("0x%X, ", IC[ic].configb.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 70 | pc.printf("0x%X, ", IC[ic].configb.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 71 | pc.printf("0x%X, ", IC[ic].configb.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 72 | pc.printf("0x%X, ", IC[ic].configb.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 73 | pc.printf("0x%X\n\n", IC[ic].configb.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 74 | } |
dpandit1988 | 1:94a3e8fe5e25 | 75 | else if(grp == ALL_GRP) |
dpandit1988 | 1:94a3e8fe5e25 | 76 | { |
dpandit1988 | 1:94a3e8fe5e25 | 77 | pc.printf("Write Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 78 | pc.printf("0x%X, ", IC[ic].configa.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 79 | pc.printf("0x%X, ", IC[ic].configa.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 80 | pc.printf("0x%X, ", IC[ic].configa.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 81 | pc.printf("0x%X, ", IC[ic].configa.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 82 | pc.printf("0x%X, ", IC[ic].configa.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 83 | pc.printf("0x%X\n\n", IC[ic].configa.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 84 | |
dpandit1988 | 1:94a3e8fe5e25 | 85 | pc.printf("Write Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 86 | pc.printf("0x%X, ", IC[ic].configb.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 87 | pc.printf("0x%X, ", IC[ic].configb.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 88 | pc.printf("0x%X, ", IC[ic].configb.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 89 | pc.printf("0x%X, ", IC[ic].configb.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 90 | pc.printf("0x%X, ", IC[ic].configb.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 91 | pc.printf("0x%X\n\n", IC[ic].configb.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 92 | } |
dpandit1988 | 1:94a3e8fe5e25 | 93 | else{ pc.printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 94 | } |
dpandit1988 | 1:94a3e8fe5e25 | 95 | } |
dpandit1988 | 1:94a3e8fe5e25 | 96 | } |
dpandit1988 | 1:94a3e8fe5e25 | 97 | |
dpandit1988 | 1:94a3e8fe5e25 | 98 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 99 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 100 | * Function: printReadConfig |
dpandit1988 | 1:94a3e8fe5e25 | 101 | * @brief Print Read config A/B result. |
dpandit1988 | 1:94a3e8fe5e25 | 102 | * |
dpandit1988 | 1:94a3e8fe5e25 | 103 | * @details This function Print read config result into IAR I/O terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 104 | * |
dpandit1988 | 1:94a3e8fe5e25 | 105 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 106 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 107 | * |
dpandit1988 | 1:94a3e8fe5e25 | 108 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 109 | * |
dpandit1988 | 1:94a3e8fe5e25 | 110 | * @param [in] TYPE Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 111 | * |
dpandit1988 | 1:94a3e8fe5e25 | 112 | * @param [in] GRP Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 113 | * |
dpandit1988 | 1:94a3e8fe5e25 | 114 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 115 | * |
dpandit1988 | 1:94a3e8fe5e25 | 116 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 117 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 118 | void printReadConfig(uint8_t tIC, cell_asic *IC, TYPE type, GRP grp) |
dpandit1988 | 1:94a3e8fe5e25 | 119 | { |
dpandit1988 | 1:94a3e8fe5e25 | 120 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 121 | { |
dpandit1988 | 1:94a3e8fe5e25 | 122 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 123 | if(type == Config) |
dpandit1988 | 1:94a3e8fe5e25 | 124 | { |
dpandit1988 | 1:94a3e8fe5e25 | 125 | if(grp == A) |
dpandit1988 | 1:94a3e8fe5e25 | 126 | { |
dpandit1988 | 1:94a3e8fe5e25 | 127 | pc.printf("Read Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 128 | pc.printf("0x%X, ", IC[ic].configa.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 129 | pc.printf("0x%X, ", IC[ic].configa.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 130 | pc.printf("0x%X, ", IC[ic].configa.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 131 | pc.printf("0x%X, ", IC[ic].configa.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 132 | pc.printf("0x%X, ", IC[ic].configa.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 133 | pc.printf("0x%X, ", IC[ic].configa.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 134 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 135 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 136 | } |
dpandit1988 | 1:94a3e8fe5e25 | 137 | else if(grp == B) |
dpandit1988 | 1:94a3e8fe5e25 | 138 | { |
dpandit1988 | 1:94a3e8fe5e25 | 139 | pc.printf("Read Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 140 | pc.printf("0x%X, ", IC[ic].configb.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 141 | pc.printf("0x%X, ", IC[ic].configb.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 142 | pc.printf("0x%X, ", IC[ic].configb.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 143 | pc.printf("0x%X, ", IC[ic].configb.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 144 | pc.printf("0x%X, ", IC[ic].configb.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 145 | pc.printf("0x%X, ", IC[ic].configb.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 146 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 147 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 148 | } |
dpandit1988 | 1:94a3e8fe5e25 | 149 | else if(grp == ALL_GRP) |
dpandit1988 | 1:94a3e8fe5e25 | 150 | { |
dpandit1988 | 1:94a3e8fe5e25 | 151 | pc.printf("Read Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 152 | pc.printf("0x%X, ", IC[ic].configa.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 153 | pc.printf("0x%X, ", IC[ic].configa.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 154 | pc.printf("0x%X, ", IC[ic].configa.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 155 | pc.printf("0x%X, ", IC[ic].configa.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 156 | pc.printf("0x%X, ", IC[ic].configa.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 157 | pc.printf("0x%X, ", IC[ic].configa.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 158 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 159 | pc.printf("PECError:%d\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 160 | |
dpandit1988 | 1:94a3e8fe5e25 | 161 | pc.printf("Read Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 162 | pc.printf("0x%X, ", IC[ic].configb.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 163 | pc.printf("0x%X, ", IC[ic].configb.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 164 | pc.printf("0x%X, ", IC[ic].configb.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 165 | pc.printf("0x%X, ", IC[ic].configb.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 166 | pc.printf("0x%X, ", IC[ic].configb.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 167 | pc.printf("0x%X, ", IC[ic].configb.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 168 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 169 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 170 | } |
dpandit1988 | 1:94a3e8fe5e25 | 171 | else{ pc.printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 172 | } |
dpandit1988 | 1:94a3e8fe5e25 | 173 | } |
dpandit1988 | 1:94a3e8fe5e25 | 174 | } |
dpandit1988 | 1:94a3e8fe5e25 | 175 | |
dpandit1988 | 1:94a3e8fe5e25 | 176 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 177 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 178 | * Function: PrintDeviceSID |
dpandit1988 | 1:94a3e8fe5e25 | 179 | * @brief Print Device SID. |
dpandit1988 | 1:94a3e8fe5e25 | 180 | * |
dpandit1988 | 1:94a3e8fe5e25 | 181 | * @details This function Print Device SID into IAR I/O terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 182 | * |
dpandit1988 | 1:94a3e8fe5e25 | 183 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 184 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 185 | * |
dpandit1988 | 1:94a3e8fe5e25 | 186 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 187 | * |
dpandit1988 | 1:94a3e8fe5e25 | 188 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 189 | * |
dpandit1988 | 1:94a3e8fe5e25 | 190 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 191 | * |
dpandit1988 | 1:94a3e8fe5e25 | 192 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 193 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 194 | void printDeviceSID(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 195 | { |
dpandit1988 | 1:94a3e8fe5e25 | 196 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 197 | { |
dpandit1988 | 1:94a3e8fe5e25 | 198 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 199 | if(type == SID) |
dpandit1988 | 1:94a3e8fe5e25 | 200 | { |
dpandit1988 | 1:94a3e8fe5e25 | 201 | pc.printf("Read Device SID:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 202 | pc.printf("0x%X, ", IC[ic].sid.sid[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 203 | pc.printf("0x%X, ", IC[ic].sid.sid[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 204 | pc.printf("0x%X, ", IC[ic].sid.sid[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 205 | pc.printf("0x%X, ", IC[ic].sid.sid[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 206 | pc.printf("0x%X, ", IC[ic].sid.sid[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 207 | pc.printf("0x%X, ", IC[ic].sid.sid[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 208 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 209 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.sid_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 210 | } |
dpandit1988 | 1:94a3e8fe5e25 | 211 | else{ pc.printf("Wrong Register Type Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 212 | } |
dpandit1988 | 1:94a3e8fe5e25 | 213 | } |
dpandit1988 | 1:94a3e8fe5e25 | 214 | |
dpandit1988 | 1:94a3e8fe5e25 | 215 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 216 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 217 | * Function: printWriteCommData |
dpandit1988 | 1:94a3e8fe5e25 | 218 | * @brief Print Write Comm data. |
dpandit1988 | 1:94a3e8fe5e25 | 219 | * |
dpandit1988 | 1:94a3e8fe5e25 | 220 | * @details This function Print write comm data. |
dpandit1988 | 1:94a3e8fe5e25 | 221 | * |
dpandit1988 | 1:94a3e8fe5e25 | 222 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 223 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 224 | * |
dpandit1988 | 1:94a3e8fe5e25 | 225 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 226 | * |
dpandit1988 | 1:94a3e8fe5e25 | 227 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 228 | * |
dpandit1988 | 1:94a3e8fe5e25 | 229 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 230 | * |
dpandit1988 | 1:94a3e8fe5e25 | 231 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 232 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 233 | void printWriteCommData(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 234 | { |
dpandit1988 | 1:94a3e8fe5e25 | 235 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 236 | { |
dpandit1988 | 1:94a3e8fe5e25 | 237 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 238 | if(type == Comm) |
dpandit1988 | 1:94a3e8fe5e25 | 239 | { |
dpandit1988 | 1:94a3e8fe5e25 | 240 | pc.printf("Write Comm Data:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 241 | pc.printf("0x%X, ", IC[ic].com.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 242 | pc.printf("0x%X, ", IC[ic].com.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 243 | pc.printf("0x%X, ", IC[ic].com.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 244 | pc.printf("0x%X, ", IC[ic].com.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 245 | pc.printf("0x%X, ", IC[ic].com.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 246 | pc.printf("0x%X\n\n", IC[ic].com.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 247 | } |
dpandit1988 | 1:94a3e8fe5e25 | 248 | else{ pc.printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 249 | } |
dpandit1988 | 1:94a3e8fe5e25 | 250 | } |
dpandit1988 | 1:94a3e8fe5e25 | 251 | |
dpandit1988 | 1:94a3e8fe5e25 | 252 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 253 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 254 | * Function: printReadCommData |
dpandit1988 | 1:94a3e8fe5e25 | 255 | * @brief Print Read Comm Data. |
dpandit1988 | 1:94a3e8fe5e25 | 256 | * |
dpandit1988 | 1:94a3e8fe5e25 | 257 | * @details This function print read comm data. |
dpandit1988 | 1:94a3e8fe5e25 | 258 | * |
dpandit1988 | 1:94a3e8fe5e25 | 259 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 260 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 261 | * |
dpandit1988 | 1:94a3e8fe5e25 | 262 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 263 | * |
dpandit1988 | 1:94a3e8fe5e25 | 264 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 265 | * |
dpandit1988 | 1:94a3e8fe5e25 | 266 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 267 | * |
dpandit1988 | 1:94a3e8fe5e25 | 268 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 269 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 270 | void printReadCommData(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 271 | { |
dpandit1988 | 1:94a3e8fe5e25 | 272 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 273 | { |
dpandit1988 | 1:94a3e8fe5e25 | 274 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 275 | if(type == Comm) |
dpandit1988 | 1:94a3e8fe5e25 | 276 | { |
dpandit1988 | 1:94a3e8fe5e25 | 277 | pc.printf("Read Comm Data:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 278 | pc.printf("ICOM0:0x%X, ", IC[ic].rx_comm.icomm[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 279 | pc.printf("ICOM1:0x%X, ", IC[ic].rx_comm.icomm[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 280 | pc.printf("ICOM2:0x%X\n", IC[ic].rx_comm.icomm[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 281 | pc.printf("FCOM0:0x%X, ", IC[ic].rx_comm.fcomm[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 282 | pc.printf("FCOM1:0x%X, ", IC[ic].rx_comm.fcomm[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 283 | pc.printf("FCOM2:0x%X\n", IC[ic].rx_comm.fcomm[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 284 | pc.printf("DATA0:0x%X, ", IC[ic].rx_comm.data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 285 | pc.printf("DATA1:0x%X, ", IC[ic].rx_comm.data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 286 | pc.printf("DATA2:0x%X\n", IC[ic].rx_comm.data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 287 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 288 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.comm_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 289 | } |
dpandit1988 | 1:94a3e8fe5e25 | 290 | else{ pc.printf("Wrong Register Type Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 291 | } |
dpandit1988 | 1:94a3e8fe5e25 | 292 | } |
dpandit1988 | 1:94a3e8fe5e25 | 293 | |
dpandit1988 | 1:94a3e8fe5e25 | 294 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 295 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 296 | * Function: printCr |
dpandit1988 | 1:94a3e8fe5e25 | 297 | * @brief Print Current Result. |
dpandit1988 | 1:94a3e8fe5e25 | 298 | * |
dpandit1988 | 1:94a3e8fe5e25 | 299 | * @details This function Print current result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 300 | * |
dpandit1988 | 1:94a3e8fe5e25 | 301 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 302 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 303 | * |
dpandit1988 | 1:94a3e8fe5e25 | 304 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 305 | * |
dpandit1988 | 1:94a3e8fe5e25 | 306 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 307 | * |
dpandit1988 | 1:94a3e8fe5e25 | 308 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 309 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 310 | void printCr(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 311 | { |
dpandit1988 | 1:94a3e8fe5e25 | 312 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 313 | { |
dpandit1988 | 1:94a3e8fe5e25 | 314 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 315 | pc.printf("Read Current:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 316 | pc.printf("I1:%f, ", getCurrent(IC[ic].i.i1)); |
dpandit1988 | 1:94a3e8fe5e25 | 317 | pc.printf("I2:%f\n", getCurrent(IC[ic].i.i2)); |
dpandit1988 | 1:94a3e8fe5e25 | 318 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 319 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.cr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 320 | } |
dpandit1988 | 1:94a3e8fe5e25 | 321 | } |
dpandit1988 | 1:94a3e8fe5e25 | 322 | |
dpandit1988 | 1:94a3e8fe5e25 | 323 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 324 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 325 | * Function: printVoltages |
dpandit1988 | 1:94a3e8fe5e25 | 326 | * @brief Print Voltages. |
dpandit1988 | 1:94a3e8fe5e25 | 327 | * |
dpandit1988 | 1:94a3e8fe5e25 | 328 | * @details This function Print Voltages into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 329 | * |
dpandit1988 | 1:94a3e8fe5e25 | 330 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 331 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 332 | * |
dpandit1988 | 1:94a3e8fe5e25 | 333 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 334 | * |
dpandit1988 | 1:94a3e8fe5e25 | 335 | * @param [in] type Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 336 | * |
dpandit1988 | 1:94a3e8fe5e25 | 337 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 338 | * |
dpandit1988 | 1:94a3e8fe5e25 | 339 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 340 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 341 | void printVoltage(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 342 | { |
dpandit1988 | 1:94a3e8fe5e25 | 343 | float voltage; |
dpandit1988 | 1:94a3e8fe5e25 | 344 | uint16_t temp; |
dpandit1988 | 1:94a3e8fe5e25 | 345 | uint8_t channel; |
dpandit1988 | 1:94a3e8fe5e25 | 346 | uint8_t flag = 0; |
dpandit1988 | 1:94a3e8fe5e25 | 347 | if((type == Vr)){channel = VR_SIZE;} |
dpandit1988 | 1:94a3e8fe5e25 | 348 | else if((type == Vrx)){channel = VRX_SIZE;} |
dpandit1988 | 1:94a3e8fe5e25 | 349 | else if (type == Rvr){ channel = RVR_SIZE;} |
dpandit1988 | 1:94a3e8fe5e25 | 350 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 351 | { |
dpandit1988 | 1:94a3e8fe5e25 | 352 | pc.printf("IC%d: \n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 353 | for(uint8_t index = 0; index < channel; index++) |
dpandit1988 | 1:94a3e8fe5e25 | 354 | { |
dpandit1988 | 1:94a3e8fe5e25 | 355 | if(type == Vr){ temp = IC[ic].vr.v_codes[index];} |
dpandit1988 | 1:94a3e8fe5e25 | 356 | else if(type == Vrx){ temp = IC[ic].vrx.vx_codes[index]; } |
dpandit1988 | 1:94a3e8fe5e25 | 357 | else if(type == Rvr){ temp = IC[ic].rvr.redv_codes[index]; } |
dpandit1988 | 1:94a3e8fe5e25 | 358 | voltage = getVoltage(temp); |
dpandit1988 | 1:94a3e8fe5e25 | 359 | if(type == Vr) |
dpandit1988 | 1:94a3e8fe5e25 | 360 | { |
dpandit1988 | 1:94a3e8fe5e25 | 361 | if(index == 8) |
dpandit1988 | 1:94a3e8fe5e25 | 362 | { |
dpandit1988 | 1:94a3e8fe5e25 | 363 | pc.printf("VREF2A = %7.4fV \n", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 364 | flag = 1; |
dpandit1988 | 1:94a3e8fe5e25 | 365 | } |
dpandit1988 | 1:94a3e8fe5e25 | 366 | else if(index == (channel-1)) |
dpandit1988 | 1:94a3e8fe5e25 | 367 | { |
dpandit1988 | 1:94a3e8fe5e25 | 368 | pc.printf("VREF2B = %7.4fV \n", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 369 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 370 | pc.printf("PECError:%d",IC[ic].cccrc.vr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 371 | } |
dpandit1988 | 1:94a3e8fe5e25 | 372 | else |
dpandit1988 | 1:94a3e8fe5e25 | 373 | { |
dpandit1988 | 1:94a3e8fe5e25 | 374 | if(flag == 1) |
dpandit1988 | 1:94a3e8fe5e25 | 375 | { |
dpandit1988 | 1:94a3e8fe5e25 | 376 | pc.printf("V%2d = %7.4fV \n", index, voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 377 | } |
dpandit1988 | 1:94a3e8fe5e25 | 378 | else{pc.printf("V%2d = %7.4fV \n",(index+1), voltage);} |
dpandit1988 | 1:94a3e8fe5e25 | 379 | } |
dpandit1988 | 1:94a3e8fe5e25 | 380 | } |
dpandit1988 | 1:94a3e8fe5e25 | 381 | else if(type == Vrx) |
dpandit1988 | 1:94a3e8fe5e25 | 382 | { |
dpandit1988 | 1:94a3e8fe5e25 | 383 | if(index == 4){pc.printf("VREF2A = %7.4fV \n", voltage);} |
dpandit1988 | 1:94a3e8fe5e25 | 384 | else if(index == (channel-1)) |
dpandit1988 | 1:94a3e8fe5e25 | 385 | { |
dpandit1988 | 1:94a3e8fe5e25 | 386 | pc.printf("VREF2B = %7.4fV \n", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 387 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 388 | pc.printf("PECError:%d",IC[ic].cccrc.vrx_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 389 | } |
dpandit1988 | 1:94a3e8fe5e25 | 390 | else{pc.printf("V%2d = %7.4fV \n",(index+7), voltage);} |
dpandit1988 | 1:94a3e8fe5e25 | 391 | } |
dpandit1988 | 1:94a3e8fe5e25 | 392 | else if(type == Rvr) |
dpandit1988 | 1:94a3e8fe5e25 | 393 | { |
dpandit1988 | 1:94a3e8fe5e25 | 394 | pc.printf("V%dR=%fV \n",(index+1), voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 395 | if(index == (channel-1)) |
dpandit1988 | 1:94a3e8fe5e25 | 396 | { |
dpandit1988 | 1:94a3e8fe5e25 | 397 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 398 | pc.printf("PECError:%d",IC[ic].cccrc.rvr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 399 | } |
dpandit1988 | 1:94a3e8fe5e25 | 400 | } |
dpandit1988 | 1:94a3e8fe5e25 | 401 | else{pc.printf("Wrong Register Group Select\n");} |
dpandit1988 | 1:94a3e8fe5e25 | 402 | } |
dpandit1988 | 1:94a3e8fe5e25 | 403 | pc.printf("\n\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 404 | } |
dpandit1988 | 1:94a3e8fe5e25 | 405 | } |
dpandit1988 | 1:94a3e8fe5e25 | 406 | |
dpandit1988 | 1:94a3e8fe5e25 | 407 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 408 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 409 | * Function: printVbat |
dpandit1988 | 1:94a3e8fe5e25 | 410 | * @brief Print VBAT Result. |
dpandit1988 | 1:94a3e8fe5e25 | 411 | * |
dpandit1988 | 1:94a3e8fe5e25 | 412 | * @details This function Print the VBAT result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 413 | * |
dpandit1988 | 1:94a3e8fe5e25 | 414 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 415 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 416 | * |
dpandit1988 | 1:94a3e8fe5e25 | 417 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 418 | * |
dpandit1988 | 1:94a3e8fe5e25 | 419 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 420 | * |
dpandit1988 | 1:94a3e8fe5e25 | 421 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 422 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 423 | void printVbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 424 | { |
dpandit1988 | 1:94a3e8fe5e25 | 425 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 426 | { |
dpandit1988 | 1:94a3e8fe5e25 | 427 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 428 | pc.printf("Read VBAT:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 429 | pc.printf("VBAT1: %f, ", getVoltage(IC[ic].vbat.vbat1)); |
dpandit1988 | 1:94a3e8fe5e25 | 430 | pc.printf("VBAT2: %f, ", getVoltage(IC[ic].vbat.vbat2)); |
dpandit1988 | 1:94a3e8fe5e25 | 431 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 432 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.vbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 433 | } |
dpandit1988 | 1:94a3e8fe5e25 | 434 | } |
dpandit1988 | 1:94a3e8fe5e25 | 435 | |
dpandit1988 | 1:94a3e8fe5e25 | 436 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 437 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 438 | * Function: printIvbat |
dpandit1988 | 1:94a3e8fe5e25 | 439 | * @brief Print IVBAT result. |
dpandit1988 | 1:94a3e8fe5e25 | 440 | * |
dpandit1988 | 1:94a3e8fe5e25 | 441 | * @details This function Print the IVBAT result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 442 | * |
dpandit1988 | 1:94a3e8fe5e25 | 443 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 444 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 445 | * |
dpandit1988 | 1:94a3e8fe5e25 | 446 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 447 | * |
dpandit1988 | 1:94a3e8fe5e25 | 448 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 449 | * |
dpandit1988 | 1:94a3e8fe5e25 | 450 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 451 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 452 | void printIvbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 453 | { |
dpandit1988 | 1:94a3e8fe5e25 | 454 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 455 | { |
dpandit1988 | 1:94a3e8fe5e25 | 456 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 457 | pc.printf("Read IVBAT:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 458 | pc.printf("I1:%f, ", getCurrent(IC[ic].ivbat.i1)); |
dpandit1988 | 1:94a3e8fe5e25 | 459 | pc.printf("VBAT1%f, ", getVoltage(IC[ic].ivbat.vbat1)); |
dpandit1988 | 1:94a3e8fe5e25 | 460 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 461 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.ivbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 462 | } |
dpandit1988 | 1:94a3e8fe5e25 | 463 | } |
dpandit1988 | 1:94a3e8fe5e25 | 464 | |
dpandit1988 | 1:94a3e8fe5e25 | 465 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 466 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 467 | * Function: printAvgVbat |
dpandit1988 | 1:94a3e8fe5e25 | 468 | * @brief Print AVGVBAT result. |
dpandit1988 | 1:94a3e8fe5e25 | 469 | * |
dpandit1988 | 1:94a3e8fe5e25 | 470 | * @details This function Print the avgvbat result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 471 | * |
dpandit1988 | 1:94a3e8fe5e25 | 472 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 473 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 474 | * |
dpandit1988 | 1:94a3e8fe5e25 | 475 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 476 | * |
dpandit1988 | 1:94a3e8fe5e25 | 477 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 478 | * |
dpandit1988 | 1:94a3e8fe5e25 | 479 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 480 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 481 | void printAvgVbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 482 | { |
dpandit1988 | 1:94a3e8fe5e25 | 483 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 484 | { |
dpandit1988 | 1:94a3e8fe5e25 | 485 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 486 | pc.printf("Read AvgVbat:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 487 | pc.printf("VB1AVG:%f, ", getVoltage(IC[ic].vbavg.vb1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 488 | pc.printf("VB2AVG:%f, ", getVoltage(IC[ic].vbavg.vb2avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 489 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 490 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.avgvbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 491 | } |
dpandit1988 | 1:94a3e8fe5e25 | 492 | } |
dpandit1988 | 1:94a3e8fe5e25 | 493 | |
dpandit1988 | 1:94a3e8fe5e25 | 494 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 495 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 496 | * Function: printAvgIVbat |
dpandit1988 | 1:94a3e8fe5e25 | 497 | * @brief Print AVGIVBAT result. |
dpandit1988 | 1:94a3e8fe5e25 | 498 | * |
dpandit1988 | 1:94a3e8fe5e25 | 499 | * @details This function Print the avgivbat result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 500 | * |
dpandit1988 | 1:94a3e8fe5e25 | 501 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 502 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 503 | * |
dpandit1988 | 1:94a3e8fe5e25 | 504 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 505 | * |
dpandit1988 | 1:94a3e8fe5e25 | 506 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 507 | * |
dpandit1988 | 1:94a3e8fe5e25 | 508 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 509 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 510 | void printAvgIVbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 511 | { |
dpandit1988 | 1:94a3e8fe5e25 | 512 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 513 | { |
dpandit1988 | 1:94a3e8fe5e25 | 514 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 515 | pc.printf("Read AvgIVbat:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 516 | pc.printf("I1AVG:%f, ", getCurrent(IC[ic].i_vbavg.i1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 517 | pc.printf("VB1AVG%f, ", getVoltage(IC[ic].i_vbavg.vb1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 518 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 519 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.avgivbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 520 | } |
dpandit1988 | 1:94a3e8fe5e25 | 521 | } |
dpandit1988 | 1:94a3e8fe5e25 | 522 | |
dpandit1988 | 1:94a3e8fe5e25 | 523 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 524 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 525 | * Function: printAvgCr |
dpandit1988 | 1:94a3e8fe5e25 | 526 | * @brief Print IAVG result. |
dpandit1988 | 1:94a3e8fe5e25 | 527 | * |
dpandit1988 | 1:94a3e8fe5e25 | 528 | * @details This function Print the iavg result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 529 | * |
dpandit1988 | 1:94a3e8fe5e25 | 530 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 531 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 532 | * |
dpandit1988 | 1:94a3e8fe5e25 | 533 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 534 | * |
dpandit1988 | 1:94a3e8fe5e25 | 535 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 536 | * |
dpandit1988 | 1:94a3e8fe5e25 | 537 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 538 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 539 | void printAvgCr(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 540 | { |
dpandit1988 | 1:94a3e8fe5e25 | 541 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 542 | { |
dpandit1988 | 1:94a3e8fe5e25 | 543 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 544 | pc.printf("Read AvgCr:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 545 | pc.printf("I1AVG:%f, ", getCurrent(IC[ic].iavg.i1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 546 | pc.printf("I2AVG:%f, ", getCurrent(IC[ic].iavg.i2avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 547 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 548 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.avgcr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 549 | } |
dpandit1988 | 1:94a3e8fe5e25 | 550 | } |
dpandit1988 | 1:94a3e8fe5e25 | 551 | |
dpandit1988 | 1:94a3e8fe5e25 | 552 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 553 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 554 | * Function: printOc |
dpandit1988 | 1:94a3e8fe5e25 | 555 | * @brief Print OC result. |
dpandit1988 | 1:94a3e8fe5e25 | 556 | * |
dpandit1988 | 1:94a3e8fe5e25 | 557 | * @details This function Print the oc result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 558 | * |
dpandit1988 | 1:94a3e8fe5e25 | 559 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 560 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 561 | * |
dpandit1988 | 1:94a3e8fe5e25 | 562 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 563 | * |
dpandit1988 | 1:94a3e8fe5e25 | 564 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 565 | * |
dpandit1988 | 1:94a3e8fe5e25 | 566 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 567 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 568 | void printOc(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 569 | { |
dpandit1988 | 1:94a3e8fe5e25 | 570 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 571 | { |
dpandit1988 | 1:94a3e8fe5e25 | 572 | pc.printf("Read OC:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 573 | pc.printf("OC1R: %f, ", getOverCurrent(IC[ic].oc.oc1r)); |
dpandit1988 | 1:94a3e8fe5e25 | 574 | pc.printf("OC2R: %f, ", getOverCurrent(IC[ic].oc.oc2r)); |
dpandit1988 | 1:94a3e8fe5e25 | 575 | pc.printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 576 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.oc_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 577 | } |
dpandit1988 | 1:94a3e8fe5e25 | 578 | } |
dpandit1988 | 1:94a3e8fe5e25 | 579 | |
dpandit1988 | 1:94a3e8fe5e25 | 580 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 581 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 582 | * Function: PrintStatus |
dpandit1988 | 1:94a3e8fe5e25 | 583 | * @brief Print status reg. result. |
dpandit1988 | 1:94a3e8fe5e25 | 584 | * |
dpandit1988 | 1:94a3e8fe5e25 | 585 | * @details This function Print status result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 586 | * |
dpandit1988 | 1:94a3e8fe5e25 | 587 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 588 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 589 | * |
dpandit1988 | 1:94a3e8fe5e25 | 590 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 591 | * |
dpandit1988 | 1:94a3e8fe5e25 | 592 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 593 | * |
dpandit1988 | 1:94a3e8fe5e25 | 594 | * @param [in] grp Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 595 | * |
dpandit1988 | 1:94a3e8fe5e25 | 596 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 597 | * |
dpandit1988 | 1:94a3e8fe5e25 | 598 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 599 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 600 | |
dpandit1988 | 1:94a3e8fe5e25 | 601 | void printStatus(uint8_t tIC, cell_asic *IC, TYPE type, GRP grp) |
dpandit1988 | 1:94a3e8fe5e25 | 602 | { |
dpandit1988 | 1:94a3e8fe5e25 | 603 | float voltage; |
dpandit1988 | 1:94a3e8fe5e25 | 604 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 605 | { |
dpandit1988 | 1:94a3e8fe5e25 | 606 | pc.printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 607 | if(type == Status) |
dpandit1988 | 1:94a3e8fe5e25 | 608 | { |
dpandit1988 | 1:94a3e8fe5e25 | 609 | if(grp == A) |
dpandit1988 | 1:94a3e8fe5e25 | 610 | { |
dpandit1988 | 1:94a3e8fe5e25 | 611 | pc.printf("Status A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 612 | voltage = getVoltage(IC[ic].stata.vref1p25); |
dpandit1988 | 3:3f1a94897050 | 613 | pc.printf("VREF1P25:%fV, ", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 614 | pc.printf("ITMP:%f°C, ", (((IC[ic].stata.itmp * 150e-6 )+ 1.5)/0.0075)-273); |
dpandit1988 | 1:94a3e8fe5e25 | 615 | voltage = getVoltage(IC[ic].stata.vreg2); |
dpandit1988 | 1:94a3e8fe5e25 | 616 | pc.printf("VREG2:%fV\n", (voltage + 1.5)); |
dpandit1988 | 1:94a3e8fe5e25 | 617 | pc.printf("CCount:%d, ",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 618 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 619 | } |
dpandit1988 | 1:94a3e8fe5e25 | 620 | else if(grp == B) |
dpandit1988 | 1:94a3e8fe5e25 | 621 | { |
dpandit1988 | 1:94a3e8fe5e25 | 622 | pc.printf("Status B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 623 | pc.printf("OC1MIN:0x%X, ", IC[ic].statb.oc1min); |
dpandit1988 | 1:94a3e8fe5e25 | 624 | pc.printf("OC1MAX:0x%X, ", IC[ic].statb.oc1max); |
dpandit1988 | 1:94a3e8fe5e25 | 625 | pc.printf("OC2MIN:0x%X, ", IC[ic].statb.oc2min); |
dpandit1988 | 1:94a3e8fe5e25 | 626 | pc.printf("OC2MAX:0x%X\n", IC[ic].statb.oc2max); |
dpandit1988 | 1:94a3e8fe5e25 | 627 | pc.printf("CCount:%d, ",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 628 | pc.printf("PECError:%d\n\n",IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 629 | } |
dpandit1988 | 1:94a3e8fe5e25 | 630 | else if(grp == C) |
dpandit1988 | 1:94a3e8fe5e25 | 631 | { |
dpandit1988 | 1:94a3e8fe5e25 | 632 | pc.printf("Status C:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 633 | pc.printf("OC1A:0x%X, ", IC[ic].statc.oc1a); |
dpandit1988 | 1:94a3e8fe5e25 | 634 | pc.printf("~OC1A:0x%X, ", IC[ic].statc.oc1a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 635 | pc.printf("OC2A:0x%X, ", IC[ic].statc.oc2a); |
dpandit1988 | 1:94a3e8fe5e25 | 636 | pc.printf("~OC2A:0x%X, ", IC[ic].statc.oc2a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 637 | pc.printf("CT:0x%X, ", IC[ic].statc.ct); |
dpandit1988 | 1:94a3e8fe5e25 | 638 | pc.printf("CTS:0x%X\n", IC[ic].statc.cts); |
dpandit1988 | 1:94a3e8fe5e25 | 639 | |
dpandit1988 | 1:94a3e8fe5e25 | 640 | pc.printf("VA_OV:0x%X, ", IC[ic].statc.va_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 641 | pc.printf("VA_UV:0x%X ", IC[ic].statc.va_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 642 | pc.printf("VD_OV:0x%X, ", IC[ic].statc.vd_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 643 | pc.printf("VD_UV:0x%X, ", IC[ic].statc.vd_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 644 | pc.printf("OTP1_ED:0x%X, ", IC[ic].statc.otp1_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 645 | pc.printf("OTP1_MED:0x%X, ", IC[ic].statc.otp1_med); |
dpandit1988 | 1:94a3e8fe5e25 | 646 | pc.printf("OTP2_ED:0x%X, ", IC[ic].statc.otp2_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 647 | pc.printf("OTP2_MED:0x%X\n", IC[ic].statc.otp2_med); |
dpandit1988 | 1:94a3e8fe5e25 | 648 | |
dpandit1988 | 1:94a3e8fe5e25 | 649 | pc.printf("VDE:0x%X, ", IC[ic].statc.vde); |
dpandit1988 | 1:94a3e8fe5e25 | 650 | pc.printf("VDE1:0x%X, ", IC[ic].statc.vdel); |
dpandit1988 | 1:94a3e8fe5e25 | 651 | pc.printf("INSYNC:0x%X, ", IC[ic].statc.insync); |
dpandit1988 | 1:94a3e8fe5e25 | 652 | pc.printf("SPIFLT:0x%X, ", IC[ic].statc.spiflt); |
dpandit1988 | 1:94a3e8fe5e25 | 653 | pc.printf("SLEEP:0x%X, ", IC[ic].statc.sleep); |
dpandit1988 | 1:94a3e8fe5e25 | 654 | pc.printf("THSD:0x%X, ", IC[ic].statc.thsd); |
dpandit1988 | 1:94a3e8fe5e25 | 655 | pc.printf("TMODCHK:0x%X, ", IC[ic].statc.tmodchk); |
dpandit1988 | 1:94a3e8fe5e25 | 656 | pc.printf("OSCCHK:0x%X\n", IC[ic].statc.oscchk); |
dpandit1988 | 1:94a3e8fe5e25 | 657 | |
dpandit1988 | 1:94a3e8fe5e25 | 658 | pc.printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 659 | pc.printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 660 | } |
dpandit1988 | 1:94a3e8fe5e25 | 661 | else if(grp == D) |
dpandit1988 | 1:94a3e8fe5e25 | 662 | { |
dpandit1988 | 1:94a3e8fe5e25 | 663 | pc.printf("Status D:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 664 | pc.printf("OC_CNTR:0x%X, ", IC[ic].statd.oc_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 665 | pc.printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 666 | pc.printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 667 | } |
dpandit1988 | 1:94a3e8fe5e25 | 668 | else if(grp == E) |
dpandit1988 | 1:94a3e8fe5e25 | 669 | { |
dpandit1988 | 1:94a3e8fe5e25 | 670 | pc.printf("Status E:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 671 | pc.printf("GPIO:0x%X, ", IC[ic].state.gpio); |
dpandit1988 | 1:94a3e8fe5e25 | 672 | pc.printf("GPO:0x%X, ", IC[ic].state.gpo); |
dpandit1988 | 1:94a3e8fe5e25 | 673 | pc.printf("REV_ID:0x%X\n", IC[ic].state.rev); |
dpandit1988 | 1:94a3e8fe5e25 | 674 | pc.printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 675 | pc.printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 676 | } |
dpandit1988 | 1:94a3e8fe5e25 | 677 | else if(grp == ALL_GRP) |
dpandit1988 | 1:94a3e8fe5e25 | 678 | { |
dpandit1988 | 1:94a3e8fe5e25 | 679 | pc.printf("Status A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 680 | voltage = getVoltage(IC[ic].stata.vref1p25); |
dpandit1988 | 3:3f1a94897050 | 681 | pc.printf("VREF1P25:%fV, ", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 682 | pc.printf("ITMP:%f°C, ", (((IC[ic].stata.itmp * 150e-6 )+ 1.5)/0.0075)-273); |
dpandit1988 | 1:94a3e8fe5e25 | 683 | voltage = getVoltage(IC[ic].stata.vreg2); |
dpandit1988 | 1:94a3e8fe5e25 | 684 | pc.printf("VREG2:%fV\n", (voltage + 1.5)); |
dpandit1988 | 1:94a3e8fe5e25 | 685 | |
dpandit1988 | 1:94a3e8fe5e25 | 686 | pc.printf("Status B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 687 | pc.printf("OC1MIN:0x%X, ", IC[ic].statb.oc1min); |
dpandit1988 | 1:94a3e8fe5e25 | 688 | pc.printf("OC1MAX:0x%X, ", IC[ic].statb.oc1max); |
dpandit1988 | 1:94a3e8fe5e25 | 689 | pc.printf("OC2MIN:0x%X, ", IC[ic].statb.oc2min); |
dpandit1988 | 1:94a3e8fe5e25 | 690 | pc.printf("OC2MAX:0x%X\n", IC[ic].statb.oc2max); |
dpandit1988 | 1:94a3e8fe5e25 | 691 | |
dpandit1988 | 1:94a3e8fe5e25 | 692 | pc.printf("Status C:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 693 | pc.printf("OC1A:0x%X, ", IC[ic].statc.oc1a); |
dpandit1988 | 1:94a3e8fe5e25 | 694 | pc.printf("~OC1A:0x%X, ", IC[ic].statc.oc1a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 695 | pc.printf("OC2A:0x%X, ", IC[ic].statc.oc2a); |
dpandit1988 | 1:94a3e8fe5e25 | 696 | pc.printf("~OC2A:0x%X, ", IC[ic].statc.oc2a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 697 | pc.printf("CT:0x%X, ", IC[ic].statc.ct); |
dpandit1988 | 1:94a3e8fe5e25 | 698 | pc.printf("CTS:0x%X\n", IC[ic].statc.cts); |
dpandit1988 | 1:94a3e8fe5e25 | 699 | pc.printf("VA_OV:0x%X, ", IC[ic].statc.va_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 700 | pc.printf("VA_UV:0x%X ", IC[ic].statc.va_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 701 | pc.printf("VD_OV:0x%X, ", IC[ic].statc.vd_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 702 | pc.printf("VD_UV:0x%X, ", IC[ic].statc.vd_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 703 | pc.printf("OTP1_ED:0x%X, ", IC[ic].statc.otp1_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 704 | pc.printf("OTP1_MED:0x%X, ", IC[ic].statc.otp1_med); |
dpandit1988 | 1:94a3e8fe5e25 | 705 | pc.printf("OTP2_ED:0x%X, ", IC[ic].statc.otp2_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 706 | pc.printf("OTP2_MED:0x%X\n", IC[ic].statc.otp2_med); |
dpandit1988 | 1:94a3e8fe5e25 | 707 | pc.printf("VDE:0x%X, ", IC[ic].statc.vde); |
dpandit1988 | 1:94a3e8fe5e25 | 708 | pc.printf("VDE1:0x%X, ", IC[ic].statc.vdel); |
dpandit1988 | 1:94a3e8fe5e25 | 709 | pc.printf("INSYNC:0x%X, ", IC[ic].statc.insync); |
dpandit1988 | 1:94a3e8fe5e25 | 710 | pc.printf("SPIFLT:0x%X, ", IC[ic].statc.spiflt); |
dpandit1988 | 1:94a3e8fe5e25 | 711 | pc.printf("SLEEP:0x%X, ", IC[ic].statc.sleep); |
dpandit1988 | 1:94a3e8fe5e25 | 712 | pc.printf("THSD:0x%X, ", IC[ic].statc.thsd); |
dpandit1988 | 1:94a3e8fe5e25 | 713 | pc.printf("TMODCHK:0x%X, ", IC[ic].statc.tmodchk); |
dpandit1988 | 1:94a3e8fe5e25 | 714 | pc.printf("OSCCHK:0x%X\n", IC[ic].statc.oscchk); |
dpandit1988 | 1:94a3e8fe5e25 | 715 | |
dpandit1988 | 1:94a3e8fe5e25 | 716 | pc.printf("Status D:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 717 | pc.printf("OC_CNTR:0x%X\n", IC[ic].statd.oc_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 718 | |
dpandit1988 | 1:94a3e8fe5e25 | 719 | pc.printf("Status E:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 720 | pc.printf("GPIO:0x%X, ", IC[ic].state.gpio); |
dpandit1988 | 1:94a3e8fe5e25 | 721 | pc.printf("GPO:0x%X, ", IC[ic].state.gpo); |
dpandit1988 | 1:94a3e8fe5e25 | 722 | pc.printf("REV_ID:0x%X\n", IC[ic].state.rev); |
dpandit1988 | 1:94a3e8fe5e25 | 723 | pc.printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 724 | pc.printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 725 | } |
dpandit1988 | 1:94a3e8fe5e25 | 726 | else{ pc.printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 727 | } |
dpandit1988 | 1:94a3e8fe5e25 | 728 | } |
dpandit1988 | 1:94a3e8fe5e25 | 729 | } |
dpandit1988 | 1:94a3e8fe5e25 | 730 | |
dpandit1988 | 1:94a3e8fe5e25 | 731 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 732 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 733 | * Function: printMenu |
dpandit1988 | 1:94a3e8fe5e25 | 734 | * @brief Print Command Menu. |
dpandit1988 | 1:94a3e8fe5e25 | 735 | * |
dpandit1988 | 1:94a3e8fe5e25 | 736 | * @details This function print all command menu. |
dpandit1988 | 1:94a3e8fe5e25 | 737 | * |
dpandit1988 | 1:94a3e8fe5e25 | 738 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 739 | * |
dpandit1988 | 1:94a3e8fe5e25 | 740 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 741 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 742 | void printMenu() |
dpandit1988 | 1:94a3e8fe5e25 | 743 | { |
dpandit1988 | 1:94a3e8fe5e25 | 744 | pc.printf("List of ADBMS2950 Command:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 745 | pc.printf("Write and Read Configuration: 1 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 746 | pc.printf("Read Configuration: 2 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 747 | pc.printf("Start Adi1 Conversion: 3 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 748 | pc.printf("Start Adi2 Conversion: 4 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 749 | pc.printf("Read Current Registers: 5 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 750 | pc.printf("Read Battery Voltage Register: 6 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 751 | pc.printf("Read Current and Battery Voltage Register: 7 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 752 | pc.printf("Read Overcurrent ADC Register: 8 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 753 | pc.printf("Read Average Current Register: 9 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 754 | pc.printf("Read Average Batter Voltage Register: 10 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 755 | pc.printf("Read Average Battery Current and Voltage Register: 11 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 756 | pc.printf("Start Adv Conversion: 12 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 757 | pc.printf("Read Voltage Registers: 13 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 758 | pc.printf("Read Voltage X Registers: 14 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 759 | pc.printf("Read Redundant Voltage Registers: 15 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 760 | pc.printf("Start Adaux Conversion: 16 \n"); |
dpandit1988 | 2:4a10c825f860 | 761 | pc.printf("Read Adaux Measurement: 17 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 762 | pc.printf("Read All Status Registers: 18 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 763 | pc.printf("Read Device SID: 19 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 764 | pc.printf("Soft Reset: 20 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 765 | pc.printf("Reset cmd counter: 21 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 766 | pc.printf("Snapshot: 22 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 767 | pc.printf("Release Snapshot: 23 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 768 | pc.printf("Gpio spi communication: 24 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 769 | pc.printf("Gpio i2c write to slave: 25 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 770 | pc.printf("Gpio i2c read from slave: 26 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 771 | pc.printf("Set reset gpo pins: 27 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 772 | |
dpandit1988 | 1:94a3e8fe5e25 | 773 | pc.printf("\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 774 | pc.printf("Print '0' for menu\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 775 | pc.printf("Please enter command: \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 776 | pc.printf("\n\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 777 | } |
dpandit1988 | 1:94a3e8fe5e25 | 778 | |
dpandit1988 | 1:94a3e8fe5e25 | 779 | #else /* IAR */ |
dpandit1988 | 1:94a3e8fe5e25 | 780 | |
dpandit1988 | 1:94a3e8fe5e25 | 781 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 782 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 783 | * Function: printWriteConfig |
dpandit1988 | 1:94a3e8fe5e25 | 784 | * @brief Print write config A/B result. |
dpandit1988 | 1:94a3e8fe5e25 | 785 | * |
dpandit1988 | 1:94a3e8fe5e25 | 786 | * @details This function Print write config result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 787 | * |
dpandit1988 | 1:94a3e8fe5e25 | 788 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 789 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 790 | * |
dpandit1988 | 1:94a3e8fe5e25 | 791 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 792 | * |
dpandit1988 | 1:94a3e8fe5e25 | 793 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 794 | * |
dpandit1988 | 1:94a3e8fe5e25 | 795 | * @param [in] grp Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 796 | * |
dpandit1988 | 1:94a3e8fe5e25 | 797 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 798 | * |
dpandit1988 | 1:94a3e8fe5e25 | 799 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 800 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 801 | void printWriteConfig(uint8_t tIC, cell_asic *IC, TYPE type, GRP grp) |
dpandit1988 | 1:94a3e8fe5e25 | 802 | { |
dpandit1988 | 1:94a3e8fe5e25 | 803 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 804 | { |
dpandit1988 | 1:94a3e8fe5e25 | 805 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 806 | if(type == Config) |
dpandit1988 | 1:94a3e8fe5e25 | 807 | { |
dpandit1988 | 1:94a3e8fe5e25 | 808 | if(grp == A) |
dpandit1988 | 1:94a3e8fe5e25 | 809 | { |
dpandit1988 | 1:94a3e8fe5e25 | 810 | printf("Write Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 811 | printf("0x%X, ", IC[ic].configa.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 812 | printf("0x%X, ", IC[ic].configa.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 813 | printf("0x%X, ", IC[ic].configa.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 814 | printf("0x%X, ", IC[ic].configa.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 815 | printf("0x%X, ", IC[ic].configa.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 816 | printf("0x%X\n\n", IC[ic].configa.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 817 | } |
dpandit1988 | 1:94a3e8fe5e25 | 818 | else if(grp == B) |
dpandit1988 | 1:94a3e8fe5e25 | 819 | { |
dpandit1988 | 1:94a3e8fe5e25 | 820 | printf("Write Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 821 | printf("0x%X, ", IC[ic].configb.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 822 | printf("0x%X, ", IC[ic].configb.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 823 | printf("0x%X, ", IC[ic].configb.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 824 | printf("0x%X, ", IC[ic].configb.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 825 | printf("0x%X, ", IC[ic].configb.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 826 | printf("0x%X\n\n", IC[ic].configb.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 827 | } |
dpandit1988 | 1:94a3e8fe5e25 | 828 | else if(grp == ALL_GRP) |
dpandit1988 | 1:94a3e8fe5e25 | 829 | { |
dpandit1988 | 1:94a3e8fe5e25 | 830 | printf("Write Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 831 | printf("0x%X, ", IC[ic].configa.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 832 | printf("0x%X, ", IC[ic].configa.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 833 | printf("0x%X, ", IC[ic].configa.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 834 | printf("0x%X, ", IC[ic].configa.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 835 | printf("0x%X, ", IC[ic].configa.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 836 | printf("0x%X\n\n", IC[ic].configa.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 837 | |
dpandit1988 | 1:94a3e8fe5e25 | 838 | printf("Write Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 839 | printf("0x%X, ", IC[ic].configb.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 840 | printf("0x%X, ", IC[ic].configb.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 841 | printf("0x%X, ", IC[ic].configb.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 842 | printf("0x%X, ", IC[ic].configb.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 843 | printf("0x%X, ", IC[ic].configb.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 844 | printf("0x%X\n\n", IC[ic].configb.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 845 | } |
dpandit1988 | 1:94a3e8fe5e25 | 846 | else{ printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 847 | } |
dpandit1988 | 1:94a3e8fe5e25 | 848 | } |
dpandit1988 | 1:94a3e8fe5e25 | 849 | } |
dpandit1988 | 1:94a3e8fe5e25 | 850 | |
dpandit1988 | 1:94a3e8fe5e25 | 851 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 852 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 853 | * Function: printReadConfig |
dpandit1988 | 1:94a3e8fe5e25 | 854 | * @brief Print Read config A/B result. |
dpandit1988 | 1:94a3e8fe5e25 | 855 | * |
dpandit1988 | 1:94a3e8fe5e25 | 856 | * @details This function Print read config result into IAR I/O terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 857 | * |
dpandit1988 | 1:94a3e8fe5e25 | 858 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 859 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 860 | * |
dpandit1988 | 1:94a3e8fe5e25 | 861 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 862 | * |
dpandit1988 | 1:94a3e8fe5e25 | 863 | * @param [in] TYPE Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 864 | * |
dpandit1988 | 1:94a3e8fe5e25 | 865 | * @param [in] GRP Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 866 | * |
dpandit1988 | 1:94a3e8fe5e25 | 867 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 868 | * |
dpandit1988 | 1:94a3e8fe5e25 | 869 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 870 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 871 | void printReadConfig(uint8_t tIC, cell_asic *IC, TYPE type, GRP grp) |
dpandit1988 | 1:94a3e8fe5e25 | 872 | { |
dpandit1988 | 1:94a3e8fe5e25 | 873 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 874 | { |
dpandit1988 | 1:94a3e8fe5e25 | 875 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 876 | if(type == Config) |
dpandit1988 | 1:94a3e8fe5e25 | 877 | { |
dpandit1988 | 1:94a3e8fe5e25 | 878 | if(grp == A) |
dpandit1988 | 1:94a3e8fe5e25 | 879 | { |
dpandit1988 | 1:94a3e8fe5e25 | 880 | printf("Read Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 881 | printf("0x%X, ", IC[ic].configa.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 882 | printf("0x%X, ", IC[ic].configa.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 883 | printf("0x%X, ", IC[ic].configa.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 884 | printf("0x%X, ", IC[ic].configa.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 885 | printf("0x%X, ", IC[ic].configa.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 886 | printf("0x%X, ", IC[ic].configa.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 887 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 888 | printf("PECError:%d\n\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 889 | } |
dpandit1988 | 1:94a3e8fe5e25 | 890 | else if(grp == B) |
dpandit1988 | 1:94a3e8fe5e25 | 891 | { |
dpandit1988 | 1:94a3e8fe5e25 | 892 | printf("Read Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 893 | printf("0x%X, ", IC[ic].configb.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 894 | printf("0x%X, ", IC[ic].configb.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 895 | printf("0x%X, ", IC[ic].configb.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 896 | printf("0x%X, ", IC[ic].configb.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 897 | printf("0x%X, ", IC[ic].configb.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 898 | printf("0x%X, ", IC[ic].configb.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 899 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 900 | printf("PECError:%d\n\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 901 | } |
dpandit1988 | 1:94a3e8fe5e25 | 902 | else if(grp == ALL_GRP) |
dpandit1988 | 1:94a3e8fe5e25 | 903 | { |
dpandit1988 | 1:94a3e8fe5e25 | 904 | printf("Read Config A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 905 | printf("0x%X, ", IC[ic].configa.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 906 | printf("0x%X, ", IC[ic].configa.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 907 | printf("0x%X, ", IC[ic].configa.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 908 | printf("0x%X, ", IC[ic].configa.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 909 | printf("0x%X, ", IC[ic].configa.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 910 | printf("0x%X, ", IC[ic].configa.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 911 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 912 | printf("PECError:%d\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 913 | |
dpandit1988 | 1:94a3e8fe5e25 | 914 | printf("Read Config B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 915 | printf("0x%X, ", IC[ic].configb.rx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 916 | printf("0x%X, ", IC[ic].configb.rx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 917 | printf("0x%X, ", IC[ic].configb.rx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 918 | printf("0x%X, ", IC[ic].configb.rx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 919 | printf("0x%X, ", IC[ic].configb.rx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 920 | printf("0x%X, ", IC[ic].configb.rx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 921 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 922 | printf("PECError:%d\n\n",IC[ic].cccrc.cfgr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 923 | } |
dpandit1988 | 1:94a3e8fe5e25 | 924 | else{ printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 925 | } |
dpandit1988 | 1:94a3e8fe5e25 | 926 | } |
dpandit1988 | 1:94a3e8fe5e25 | 927 | } |
dpandit1988 | 1:94a3e8fe5e25 | 928 | |
dpandit1988 | 1:94a3e8fe5e25 | 929 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 930 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 931 | * Function: PrintDeviceSID |
dpandit1988 | 1:94a3e8fe5e25 | 932 | * @brief Print Device SID. |
dpandit1988 | 1:94a3e8fe5e25 | 933 | * |
dpandit1988 | 1:94a3e8fe5e25 | 934 | * @details This function Print Device SID into IAR I/O terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 935 | * |
dpandit1988 | 1:94a3e8fe5e25 | 936 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 937 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 938 | * |
dpandit1988 | 1:94a3e8fe5e25 | 939 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 940 | * |
dpandit1988 | 1:94a3e8fe5e25 | 941 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 942 | * |
dpandit1988 | 1:94a3e8fe5e25 | 943 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 944 | * |
dpandit1988 | 1:94a3e8fe5e25 | 945 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 946 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 947 | void printDeviceSID(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 948 | { |
dpandit1988 | 1:94a3e8fe5e25 | 949 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 950 | { |
dpandit1988 | 1:94a3e8fe5e25 | 951 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 952 | if(type == SID) |
dpandit1988 | 1:94a3e8fe5e25 | 953 | { |
dpandit1988 | 1:94a3e8fe5e25 | 954 | printf("Read Device SID:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 955 | printf("0x%X, ", IC[ic].sid.sid[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 956 | printf("0x%X, ", IC[ic].sid.sid[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 957 | printf("0x%X, ", IC[ic].sid.sid[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 958 | printf("0x%X, ", IC[ic].sid.sid[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 959 | printf("0x%X, ", IC[ic].sid.sid[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 960 | printf("0x%X, ", IC[ic].sid.sid[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 961 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 962 | printf("PECError:%d\n\n",IC[ic].cccrc.sid_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 963 | } |
dpandit1988 | 1:94a3e8fe5e25 | 964 | else{ printf("Wrong Register Type Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 965 | } |
dpandit1988 | 1:94a3e8fe5e25 | 966 | } |
dpandit1988 | 1:94a3e8fe5e25 | 967 | |
dpandit1988 | 1:94a3e8fe5e25 | 968 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 969 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 970 | * Function: printWriteCommData |
dpandit1988 | 1:94a3e8fe5e25 | 971 | * @brief Print Write Comm data. |
dpandit1988 | 1:94a3e8fe5e25 | 972 | * |
dpandit1988 | 1:94a3e8fe5e25 | 973 | * @details This function Print write comm data. |
dpandit1988 | 1:94a3e8fe5e25 | 974 | * |
dpandit1988 | 1:94a3e8fe5e25 | 975 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 976 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 977 | * |
dpandit1988 | 1:94a3e8fe5e25 | 978 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 979 | * |
dpandit1988 | 1:94a3e8fe5e25 | 980 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 981 | * |
dpandit1988 | 1:94a3e8fe5e25 | 982 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 983 | * |
dpandit1988 | 1:94a3e8fe5e25 | 984 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 985 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 986 | void printWriteCommData(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 987 | { |
dpandit1988 | 1:94a3e8fe5e25 | 988 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 989 | { |
dpandit1988 | 1:94a3e8fe5e25 | 990 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 991 | if(type == Comm) |
dpandit1988 | 1:94a3e8fe5e25 | 992 | { |
dpandit1988 | 1:94a3e8fe5e25 | 993 | printf("Write Comm Data:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 994 | printf("0x%X, ", IC[ic].com.tx_data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 995 | printf("0x%X, ", IC[ic].com.tx_data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 996 | printf("0x%X, ", IC[ic].com.tx_data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 997 | printf("0x%X, ", IC[ic].com.tx_data[3]); |
dpandit1988 | 1:94a3e8fe5e25 | 998 | printf("0x%X, ", IC[ic].com.tx_data[4]); |
dpandit1988 | 1:94a3e8fe5e25 | 999 | printf("0x%X\n\n", IC[ic].com.tx_data[5]); |
dpandit1988 | 1:94a3e8fe5e25 | 1000 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1001 | else{ printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 1002 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1003 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1004 | |
dpandit1988 | 1:94a3e8fe5e25 | 1005 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1006 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1007 | * Function: printReadCommData |
dpandit1988 | 1:94a3e8fe5e25 | 1008 | * @brief Print Read Comm Data. |
dpandit1988 | 1:94a3e8fe5e25 | 1009 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1010 | * @details This function print read comm data. |
dpandit1988 | 1:94a3e8fe5e25 | 1011 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1012 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1013 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1014 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1015 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1016 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1017 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 1018 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1019 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1020 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1021 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1022 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1023 | void printReadCommData(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 1024 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1025 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1026 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1027 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1028 | if(type == Comm) |
dpandit1988 | 1:94a3e8fe5e25 | 1029 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1030 | printf("Read Comm Data:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1031 | printf("ICOM0:0x%X, ", IC[ic].rx_comm.icomm[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 1032 | printf("ICOM1:0x%X, ", IC[ic].rx_comm.icomm[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 1033 | printf("ICOM2:0x%X\n", IC[ic].rx_comm.icomm[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 1034 | printf("FCOM0:0x%X, ", IC[ic].rx_comm.fcomm[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 1035 | printf("FCOM1:0x%X, ", IC[ic].rx_comm.fcomm[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 1036 | printf("FCOM2:0x%X\n", IC[ic].rx_comm.fcomm[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 1037 | printf("DATA0:0x%X, ", IC[ic].rx_comm.data[0]); |
dpandit1988 | 1:94a3e8fe5e25 | 1038 | printf("DATA1:0x%X, ", IC[ic].rx_comm.data[1]); |
dpandit1988 | 1:94a3e8fe5e25 | 1039 | printf("DATA2:0x%X\n", IC[ic].rx_comm.data[2]); |
dpandit1988 | 1:94a3e8fe5e25 | 1040 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1041 | printf("PECError:%d\n\n",IC[ic].cccrc.comm_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1042 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1043 | else{ printf("Wrong Register Type Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 1044 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1045 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1046 | |
dpandit1988 | 1:94a3e8fe5e25 | 1047 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1048 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1049 | * Function: printCr |
dpandit1988 | 1:94a3e8fe5e25 | 1050 | * @brief Print Current Result. |
dpandit1988 | 1:94a3e8fe5e25 | 1051 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1052 | * @details This function Print current result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1053 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1054 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1055 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1056 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1057 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1058 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1059 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1060 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1061 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1062 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1063 | void printCr(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1064 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1065 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1066 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1067 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1068 | printf("Read Current:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1069 | printf("I1:%f, ", getCurrent(IC[ic].i.i1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1070 | printf("I2:%f\n", getCurrent(IC[ic].i.i2)); |
dpandit1988 | 1:94a3e8fe5e25 | 1071 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1072 | printf("PECError:%d\n\n",IC[ic].cccrc.cr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1073 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1074 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1075 | |
dpandit1988 | 1:94a3e8fe5e25 | 1076 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1077 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1078 | * Function: printVoltages |
dpandit1988 | 1:94a3e8fe5e25 | 1079 | * @brief Print Voltages. |
dpandit1988 | 1:94a3e8fe5e25 | 1080 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1081 | * @details This function Print Voltages into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1082 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1083 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1084 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1085 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1086 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1087 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1088 | * @param [in] type Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 1089 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1090 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1091 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1092 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1093 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1094 | void printVoltage(uint8_t tIC, cell_asic *IC, TYPE type) |
dpandit1988 | 1:94a3e8fe5e25 | 1095 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1096 | float voltage; |
dpandit1988 | 1:94a3e8fe5e25 | 1097 | uint16_t temp; |
dpandit1988 | 1:94a3e8fe5e25 | 1098 | uint8_t channel; |
dpandit1988 | 1:94a3e8fe5e25 | 1099 | uint8_t flag = 0; |
dpandit1988 | 1:94a3e8fe5e25 | 1100 | if((type == Vr)){channel = VR_SIZE;} |
dpandit1988 | 1:94a3e8fe5e25 | 1101 | else if((type == Vrx)){channel = VRX_SIZE;} |
dpandit1988 | 1:94a3e8fe5e25 | 1102 | else if (type == Rvr){ channel = RVR_SIZE;} |
dpandit1988 | 1:94a3e8fe5e25 | 1103 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1104 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1105 | printf("IC%d: \n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1106 | for(uint8_t index = 0; index < channel; index++) |
dpandit1988 | 1:94a3e8fe5e25 | 1107 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1108 | if(type == Vr){ temp = IC[ic].vr.v_codes[index];} |
dpandit1988 | 1:94a3e8fe5e25 | 1109 | else if(type == Vrx){ temp = IC[ic].vrx.vx_codes[index]; } |
dpandit1988 | 1:94a3e8fe5e25 | 1110 | else if(type == Rvr){ temp = IC[ic].rvr.redv_codes[index]; } |
dpandit1988 | 1:94a3e8fe5e25 | 1111 | voltage = getVoltage(temp); |
dpandit1988 | 1:94a3e8fe5e25 | 1112 | if(type == Vr) |
dpandit1988 | 1:94a3e8fe5e25 | 1113 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1114 | if(index == 8) |
dpandit1988 | 1:94a3e8fe5e25 | 1115 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1116 | printf("VREF2A = %7.4fV \n", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1117 | flag = 1; |
dpandit1988 | 1:94a3e8fe5e25 | 1118 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1119 | else if(index == (channel-1)) |
dpandit1988 | 1:94a3e8fe5e25 | 1120 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1121 | printf("VREF2B = %7.4fV \n", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1122 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1123 | printf("PECError:%d",IC[ic].cccrc.vr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1124 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1125 | else |
dpandit1988 | 1:94a3e8fe5e25 | 1126 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1127 | if(flag == 1) |
dpandit1988 | 1:94a3e8fe5e25 | 1128 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1129 | printf("V%2d = %7.4fV \n", index, voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1130 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1131 | else{printf("V%2d = %7.4fV \n",(index+1), voltage);} |
dpandit1988 | 1:94a3e8fe5e25 | 1132 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1133 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1134 | else if(type == Vrx) |
dpandit1988 | 1:94a3e8fe5e25 | 1135 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1136 | if(index == 4){printf("VREF2A = %7.4fV \n", voltage);} |
dpandit1988 | 1:94a3e8fe5e25 | 1137 | else if(index == (channel-1)) |
dpandit1988 | 1:94a3e8fe5e25 | 1138 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1139 | printf("VREF2B = %7.4fV \n", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1140 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1141 | printf("PECError:%d",IC[ic].cccrc.vrx_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1142 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1143 | else{printf("V%2d = %7.4fV \n",(index+7), voltage);} |
dpandit1988 | 1:94a3e8fe5e25 | 1144 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1145 | else if(type == Rvr) |
dpandit1988 | 1:94a3e8fe5e25 | 1146 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1147 | printf("V%dR=%fV \n",(index+1), voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1148 | if(index == (channel-1)) |
dpandit1988 | 1:94a3e8fe5e25 | 1149 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1150 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1151 | printf("PECError:%d",IC[ic].cccrc.rvr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1152 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1153 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1154 | else{printf("Wrong Register Group Select\n");} |
dpandit1988 | 1:94a3e8fe5e25 | 1155 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1156 | printf("\n\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1157 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1158 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1159 | |
dpandit1988 | 1:94a3e8fe5e25 | 1160 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1161 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1162 | * Function: printVbat |
dpandit1988 | 1:94a3e8fe5e25 | 1163 | * @brief Print VBAT Result. |
dpandit1988 | 1:94a3e8fe5e25 | 1164 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1165 | * @details This function Print the VBAT result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1166 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1167 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1168 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1169 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1170 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1171 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1172 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1173 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1174 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1175 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1176 | void printVbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1177 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1178 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1179 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1180 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1181 | printf("Read VBAT:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1182 | printf("VBAT1: %f, ", getVoltage(IC[ic].vbat.vbat1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1183 | printf("VBAT2: %f, ", getVoltage(IC[ic].vbat.vbat2)); |
dpandit1988 | 1:94a3e8fe5e25 | 1184 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1185 | printf("PECError:%d\n\n",IC[ic].cccrc.vbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1186 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1187 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1188 | |
dpandit1988 | 1:94a3e8fe5e25 | 1189 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1190 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1191 | * Function: printIvbat |
dpandit1988 | 1:94a3e8fe5e25 | 1192 | * @brief Print IVBAT result. |
dpandit1988 | 1:94a3e8fe5e25 | 1193 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1194 | * @details This function Print the IVBAT result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1195 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1196 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1197 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1198 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1199 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1200 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1201 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1202 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1203 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1204 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1205 | void printIvbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1206 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1207 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1208 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1209 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1210 | printf("Read IVBAT:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1211 | printf("I1:%f, ", getCurrent(IC[ic].ivbat.i1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1212 | printf("VBAT1%f, ", getVoltage(IC[ic].ivbat.vbat1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1213 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1214 | printf("PECError:%d\n\n",IC[ic].cccrc.ivbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1215 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1216 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1217 | |
dpandit1988 | 1:94a3e8fe5e25 | 1218 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1219 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1220 | * Function: printAvgVbat |
dpandit1988 | 1:94a3e8fe5e25 | 1221 | * @brief Print AVGVBAT result. |
dpandit1988 | 1:94a3e8fe5e25 | 1222 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1223 | * @details This function Print the avgvbat result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1224 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1225 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1226 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1227 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1228 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1229 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1230 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1231 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1232 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1233 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1234 | void printAvgVbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1235 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1236 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1237 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1238 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1239 | printf("Read AvgVbat:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1240 | printf("VB1AVG:%f, ", getVoltage(IC[ic].vbavg.vb1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 1241 | printf("VB2AVG:%f, ", getVoltage(IC[ic].vbavg.vb2avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 1242 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1243 | printf("PECError:%d\n\n",IC[ic].cccrc.avgvbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1244 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1245 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1246 | |
dpandit1988 | 1:94a3e8fe5e25 | 1247 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1248 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1249 | * Function: printAvgIVbat |
dpandit1988 | 1:94a3e8fe5e25 | 1250 | * @brief Print AVGIVBAT result. |
dpandit1988 | 1:94a3e8fe5e25 | 1251 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1252 | * @details This function Print the avgivbat result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1253 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1254 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1255 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1256 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1257 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1258 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1259 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1260 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1261 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1262 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1263 | void printAvgIVbat(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1264 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1265 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1266 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1267 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1268 | printf("Read AvgIVbat:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1269 | printf("I1AVG:%f, ", getCurrent(IC[ic].i_vbavg.i1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 1270 | printf("VB1AVG%f, ", getVoltage(IC[ic].i_vbavg.vb1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 1271 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1272 | printf("PECError:%d\n\n",IC[ic].cccrc.avgivbat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1273 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1274 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1275 | |
dpandit1988 | 1:94a3e8fe5e25 | 1276 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1277 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1278 | * Function: printAvgCr |
dpandit1988 | 1:94a3e8fe5e25 | 1279 | * @brief Print IAVG result. |
dpandit1988 | 1:94a3e8fe5e25 | 1280 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1281 | * @details This function Print the iavg result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1282 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1283 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1284 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1285 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1286 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1287 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1288 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1289 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1290 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1291 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1292 | void printAvgCr(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1293 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1294 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1295 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1296 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1297 | printf("Read AvgCr:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1298 | printf("I1AVG:%f, ", getCurrent(IC[ic].iavg.i1avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 1299 | printf("I2AVG:%f, ", getCurrent(IC[ic].iavg.i2avg)); |
dpandit1988 | 1:94a3e8fe5e25 | 1300 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1301 | printf("PECError:%d\n\n",IC[ic].cccrc.avgcr_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1302 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1303 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1304 | |
dpandit1988 | 1:94a3e8fe5e25 | 1305 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1306 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1307 | * Function: printOc |
dpandit1988 | 1:94a3e8fe5e25 | 1308 | * @brief Print OC result. |
dpandit1988 | 1:94a3e8fe5e25 | 1309 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1310 | * @details This function Print the oc result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1311 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1312 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1313 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1314 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1315 | * @param [in] *ic cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1316 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1317 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1318 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1319 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1320 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1321 | void printOc(uint8_t tIC, cell_asic *IC) |
dpandit1988 | 1:94a3e8fe5e25 | 1322 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1323 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1324 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1325 | printf("Read OC:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1326 | printf("OC1R: %f, ", getOverCurrent(IC[ic].oc.oc1r)); |
dpandit1988 | 1:94a3e8fe5e25 | 1327 | printf("OC2R: %f, ", getOverCurrent(IC[ic].oc.oc2r)); |
dpandit1988 | 1:94a3e8fe5e25 | 1328 | printf("CCount:%d,",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1329 | printf("PECError:%d\n\n",IC[ic].cccrc.oc_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1330 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1331 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1332 | |
dpandit1988 | 1:94a3e8fe5e25 | 1333 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1334 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1335 | * Function: PrintStatus |
dpandit1988 | 1:94a3e8fe5e25 | 1336 | * @brief Print status reg. result. |
dpandit1988 | 1:94a3e8fe5e25 | 1337 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1338 | * @details This function Print status result into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1339 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1340 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1341 | * @param [in] tIC Total IC |
dpandit1988 | 1:94a3e8fe5e25 | 1342 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1343 | * @param [in] *IC cell_asic stucture pointer |
dpandit1988 | 1:94a3e8fe5e25 | 1344 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1345 | * @param [in] type Enum type of resistor |
dpandit1988 | 1:94a3e8fe5e25 | 1346 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1347 | * @param [in] grp Enum type of resistor group |
dpandit1988 | 1:94a3e8fe5e25 | 1348 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1349 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1350 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1351 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1352 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1353 | |
dpandit1988 | 1:94a3e8fe5e25 | 1354 | void printStatus(uint8_t tIC, cell_asic *IC, TYPE type, GRP grp) |
dpandit1988 | 1:94a3e8fe5e25 | 1355 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1356 | float voltage; |
dpandit1988 | 1:94a3e8fe5e25 | 1357 | for(uint8_t ic = 0; ic < tIC; ic++) |
dpandit1988 | 1:94a3e8fe5e25 | 1358 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1359 | printf("IC%d:\n",(ic+1)); |
dpandit1988 | 1:94a3e8fe5e25 | 1360 | if(type == Status) |
dpandit1988 | 1:94a3e8fe5e25 | 1361 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1362 | if(grp == A) |
dpandit1988 | 1:94a3e8fe5e25 | 1363 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1364 | printf("Status A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1365 | voltage = getVoltage(IC[ic].stata.vref1p25); |
dpandit1988 | 3:3f1a94897050 | 1366 | printf("VREF1P25:%fV, ", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1367 | printf("ITMP:%f°C, ", (((IC[ic].stata.itmp * 150e-6 )+ 1.5)/0.0075)-273); |
dpandit1988 | 1:94a3e8fe5e25 | 1368 | voltage = getVoltage(IC[ic].stata.vreg2); |
dpandit1988 | 1:94a3e8fe5e25 | 1369 | printf("VREG2:%fV\n", (voltage + 1.5)); |
dpandit1988 | 1:94a3e8fe5e25 | 1370 | printf("CCount:%d, ",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1371 | printf("PECError:%d\n\n",IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1372 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1373 | else if(grp == B) |
dpandit1988 | 1:94a3e8fe5e25 | 1374 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1375 | printf("Status B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1376 | printf("OC1MIN:0x%X, ", IC[ic].statb.oc1min); |
dpandit1988 | 1:94a3e8fe5e25 | 1377 | printf("OC1MAX:0x%X, ", IC[ic].statb.oc1max); |
dpandit1988 | 1:94a3e8fe5e25 | 1378 | printf("OC2MIN:0x%X, ", IC[ic].statb.oc2min); |
dpandit1988 | 1:94a3e8fe5e25 | 1379 | printf("OC2MAX:0x%X\n", IC[ic].statb.oc2max); |
dpandit1988 | 1:94a3e8fe5e25 | 1380 | printf("CCount:%d, ",IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1381 | printf("PECError:%d\n\n",IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1382 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1383 | else if(grp == C) |
dpandit1988 | 1:94a3e8fe5e25 | 1384 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1385 | printf("Status C:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1386 | printf("OC1A:0x%X, ", IC[ic].statc.oc1a); |
dpandit1988 | 1:94a3e8fe5e25 | 1387 | printf("~OC1A:0x%X, ", IC[ic].statc.oc1a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 1388 | printf("OC2A:0x%X, ", IC[ic].statc.oc2a); |
dpandit1988 | 1:94a3e8fe5e25 | 1389 | printf("~OC2A:0x%X, ", IC[ic].statc.oc2a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 1390 | printf("CT:0x%X, ", IC[ic].statc.ct); |
dpandit1988 | 1:94a3e8fe5e25 | 1391 | printf("CTS:0x%X\n", IC[ic].statc.cts); |
dpandit1988 | 1:94a3e8fe5e25 | 1392 | |
dpandit1988 | 1:94a3e8fe5e25 | 1393 | printf("VA_OV:0x%X, ", IC[ic].statc.va_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 1394 | printf("VA_UV:0x%X ", IC[ic].statc.va_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 1395 | printf("VD_OV:0x%X, ", IC[ic].statc.vd_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 1396 | printf("VD_UV:0x%X, ", IC[ic].statc.vd_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 1397 | printf("OTP1_ED:0x%X, ", IC[ic].statc.otp1_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 1398 | printf("OTP1_MED:0x%X, ", IC[ic].statc.otp1_med); |
dpandit1988 | 1:94a3e8fe5e25 | 1399 | printf("OTP2_ED:0x%X, ", IC[ic].statc.otp2_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 1400 | printf("OTP2_MED:0x%X\n", IC[ic].statc.otp2_med); |
dpandit1988 | 1:94a3e8fe5e25 | 1401 | |
dpandit1988 | 1:94a3e8fe5e25 | 1402 | printf("VDE:0x%X, ", IC[ic].statc.vde); |
dpandit1988 | 1:94a3e8fe5e25 | 1403 | printf("VDE1:0x%X, ", IC[ic].statc.vdel); |
dpandit1988 | 1:94a3e8fe5e25 | 1404 | printf("INSYNC:0x%X, ", IC[ic].statc.insync); |
dpandit1988 | 1:94a3e8fe5e25 | 1405 | printf("SPIFLT:0x%X, ", IC[ic].statc.spiflt); |
dpandit1988 | 1:94a3e8fe5e25 | 1406 | printf("SLEEP:0x%X, ", IC[ic].statc.sleep); |
dpandit1988 | 1:94a3e8fe5e25 | 1407 | printf("THSD:0x%X, ", IC[ic].statc.thsd); |
dpandit1988 | 1:94a3e8fe5e25 | 1408 | printf("TMODCHK:0x%X, ", IC[ic].statc.tmodchk); |
dpandit1988 | 1:94a3e8fe5e25 | 1409 | printf("OSCCHK:0x%X\n", IC[ic].statc.oscchk); |
dpandit1988 | 1:94a3e8fe5e25 | 1410 | |
dpandit1988 | 1:94a3e8fe5e25 | 1411 | printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1412 | printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1413 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1414 | else if(grp == D) |
dpandit1988 | 1:94a3e8fe5e25 | 1415 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1416 | printf("Status D:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1417 | printf("OC_CNTR:0x%X, ", IC[ic].statd.oc_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1418 | printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1419 | printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1420 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1421 | else if(grp == E) |
dpandit1988 | 1:94a3e8fe5e25 | 1422 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1423 | printf("Status E:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1424 | printf("GPIO:0x%X, ", IC[ic].state.gpio); |
dpandit1988 | 1:94a3e8fe5e25 | 1425 | printf("GPO:0x%X, ", IC[ic].state.gpo); |
dpandit1988 | 1:94a3e8fe5e25 | 1426 | printf("REV_ID:0x%X\n", IC[ic].state.rev); |
dpandit1988 | 1:94a3e8fe5e25 | 1427 | printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1428 | printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1429 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1430 | else if(grp == ALL_GRP) |
dpandit1988 | 1:94a3e8fe5e25 | 1431 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1432 | printf("Status A:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1433 | voltage = getVoltage(IC[ic].stata.vref1p25); |
dpandit1988 | 3:3f1a94897050 | 1434 | printf("VREF1P25:%fV, ", voltage); |
dpandit1988 | 1:94a3e8fe5e25 | 1435 | printf("ITMP:%f°C, ", (((IC[ic].stata.itmp * 150e-6 )+ 1.5)/0.0075)-273); |
dpandit1988 | 1:94a3e8fe5e25 | 1436 | voltage = getVoltage(IC[ic].stata.vreg2); |
dpandit1988 | 1:94a3e8fe5e25 | 1437 | printf("VREG2:%fV\n", (voltage + 1.5)); |
dpandit1988 | 1:94a3e8fe5e25 | 1438 | |
dpandit1988 | 1:94a3e8fe5e25 | 1439 | printf("Status B:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1440 | printf("OC1MIN:0x%X, ", IC[ic].statb.oc1min); |
dpandit1988 | 1:94a3e8fe5e25 | 1441 | printf("OC1MAX:0x%X, ", IC[ic].statb.oc1max); |
dpandit1988 | 1:94a3e8fe5e25 | 1442 | printf("OC2MIN:0x%X, ", IC[ic].statb.oc2min); |
dpandit1988 | 1:94a3e8fe5e25 | 1443 | printf("OC2MAX:0x%X\n", IC[ic].statb.oc2max); |
dpandit1988 | 1:94a3e8fe5e25 | 1444 | |
dpandit1988 | 1:94a3e8fe5e25 | 1445 | printf("Status C:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1446 | printf("OC1A:0x%X, ", IC[ic].statc.oc1a); |
dpandit1988 | 1:94a3e8fe5e25 | 1447 | printf("~OC1A:0x%X, ", IC[ic].statc.oc1a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 1448 | printf("OC2A:0x%X, ", IC[ic].statc.oc2a); |
dpandit1988 | 1:94a3e8fe5e25 | 1449 | printf("~OC2A:0x%X, ", IC[ic].statc.oc2a_inv); |
dpandit1988 | 1:94a3e8fe5e25 | 1450 | printf("CT:0x%X, ", IC[ic].statc.ct); |
dpandit1988 | 1:94a3e8fe5e25 | 1451 | printf("CTS:0x%X\n", IC[ic].statc.cts); |
dpandit1988 | 1:94a3e8fe5e25 | 1452 | printf("VA_OV:0x%X, ", IC[ic].statc.va_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 1453 | printf("VA_UV:0x%X ", IC[ic].statc.va_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 1454 | printf("VD_OV:0x%X, ", IC[ic].statc.vd_ov); |
dpandit1988 | 1:94a3e8fe5e25 | 1455 | printf("VD_UV:0x%X, ", IC[ic].statc.vd_uv); |
dpandit1988 | 1:94a3e8fe5e25 | 1456 | printf("OTP1_ED:0x%X, ", IC[ic].statc.otp1_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 1457 | printf("OTP1_MED:0x%X, ", IC[ic].statc.otp1_med); |
dpandit1988 | 1:94a3e8fe5e25 | 1458 | printf("OTP2_ED:0x%X, ", IC[ic].statc.otp2_ed); |
dpandit1988 | 1:94a3e8fe5e25 | 1459 | printf("OTP2_MED:0x%X\n", IC[ic].statc.otp2_med); |
dpandit1988 | 1:94a3e8fe5e25 | 1460 | printf("VDE:0x%X, ", IC[ic].statc.vde); |
dpandit1988 | 1:94a3e8fe5e25 | 1461 | printf("VDE1:0x%X, ", IC[ic].statc.vdel); |
dpandit1988 | 1:94a3e8fe5e25 | 1462 | printf("INSYNC:0x%X, ", IC[ic].statc.insync); |
dpandit1988 | 1:94a3e8fe5e25 | 1463 | printf("SPIFLT:0x%X, ", IC[ic].statc.spiflt); |
dpandit1988 | 1:94a3e8fe5e25 | 1464 | printf("SLEEP:0x%X, ", IC[ic].statc.sleep); |
dpandit1988 | 1:94a3e8fe5e25 | 1465 | printf("THSD:0x%X, ", IC[ic].statc.thsd); |
dpandit1988 | 1:94a3e8fe5e25 | 1466 | printf("TMODCHK:0x%X, ", IC[ic].statc.tmodchk); |
dpandit1988 | 1:94a3e8fe5e25 | 1467 | printf("OSCCHK:0x%X\n", IC[ic].statc.oscchk); |
dpandit1988 | 1:94a3e8fe5e25 | 1468 | |
dpandit1988 | 1:94a3e8fe5e25 | 1469 | printf("Status D:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1470 | printf("OC_CNTR:0x%X\n", IC[ic].statd.oc_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1471 | |
dpandit1988 | 1:94a3e8fe5e25 | 1472 | printf("Status E:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1473 | printf("GPIO:0x%X, ", IC[ic].state.gpio); |
dpandit1988 | 1:94a3e8fe5e25 | 1474 | printf("GPO:0x%X, ", IC[ic].state.gpo); |
dpandit1988 | 1:94a3e8fe5e25 | 1475 | printf("REV_ID:0x%X\n", IC[ic].state.rev); |
dpandit1988 | 1:94a3e8fe5e25 | 1476 | printf("CCount:%d, ", IC[ic].cccrc.cmd_cntr); |
dpandit1988 | 1:94a3e8fe5e25 | 1477 | printf("PECError:%d\n\n", IC[ic].cccrc.stat_pec); |
dpandit1988 | 1:94a3e8fe5e25 | 1478 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1479 | else{ printf("Wrong Register Group Select\n"); } |
dpandit1988 | 1:94a3e8fe5e25 | 1480 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1481 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1482 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1483 | |
dpandit1988 | 1:94a3e8fe5e25 | 1484 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1485 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1486 | * Function: printMenu |
dpandit1988 | 1:94a3e8fe5e25 | 1487 | * @brief Print Command Menu. |
dpandit1988 | 1:94a3e8fe5e25 | 1488 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1489 | * @details This function print all command menu. |
dpandit1988 | 1:94a3e8fe5e25 | 1490 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1491 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1492 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1493 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1494 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1495 | void printMenu() |
dpandit1988 | 1:94a3e8fe5e25 | 1496 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1497 | printf("List of ADBMS2950 Command:\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1498 | printf("Write and Read Configuration: 1 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1499 | printf("Read Configuration: 2 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1500 | printf("Start Adi1 Conversion: 3 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1501 | printf("Start Adi2 Conversion: 4 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1502 | printf("Read Current Registers: 5 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1503 | printf("Read Battery Voltage Register: 6 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1504 | printf("Read Current and Battery Voltage Register: 7 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1505 | printf("Read Overcurrent ADC Register: 8 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1506 | printf("Read Average Current Register: 9 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1507 | printf("Read Average Batter Voltage Register: 10 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1508 | printf("Read Average Battery Current and Voltage Register: 11 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1509 | printf("Start Adv Conversion: 12 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1510 | printf("Read Voltage Registers: 13 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1511 | printf("Read Voltage X Registers: 14 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1512 | printf("Read Redundant Voltage Registers: 15 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1513 | printf("Start Adaux Conversion: 16 \n"); |
dpandit1988 | 2:4a10c825f860 | 1514 | printf("Read Adaux Measurement: 17 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1515 | printf("Read All Status Registers: 18 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1516 | printf("Read Device SID: 19 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1517 | printf("Soft Reset: 20 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1518 | printf("Reset cmd counter: 21 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1519 | printf("Snapshot: 22 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1520 | printf("Release Snapshot: 23 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1521 | printf("Gpio spi communication: 24 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1522 | printf("Gpio i2c write to slave: 25 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1523 | printf("Gpio i2c read from slave: 26 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1524 | printf("Set reset gpo pins: 27 \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1525 | |
dpandit1988 | 1:94a3e8fe5e25 | 1526 | printf("\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1527 | printf("Print '0' for menu\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1528 | printf("Please enter command: \n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1529 | printf("\n\n"); |
dpandit1988 | 1:94a3e8fe5e25 | 1530 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1531 | #endif /* MBED */ |
dpandit1988 | 1:94a3e8fe5e25 | 1532 | |
dpandit1988 | 1:94a3e8fe5e25 | 1533 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1534 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1535 | * Function: printMsg |
dpandit1988 | 1:94a3e8fe5e25 | 1536 | * @brief Print Message. |
dpandit1988 | 1:94a3e8fe5e25 | 1537 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1538 | * @details This function print message into terminal. |
dpandit1988 | 1:94a3e8fe5e25 | 1539 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1540 | * @param [in] msg Message string |
dpandit1988 | 1:94a3e8fe5e25 | 1541 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1542 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1543 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1544 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1545 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1546 | void printMsg(char *msg) |
dpandit1988 | 1:94a3e8fe5e25 | 1547 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1548 | #ifdef MBED |
dpandit1988 | 1:94a3e8fe5e25 | 1549 | pc.printf("%s\n\n", msg); |
dpandit1988 | 1:94a3e8fe5e25 | 1550 | #else /* IAR */ |
dpandit1988 | 1:94a3e8fe5e25 | 1551 | printf("%s\n\n", msg); |
dpandit1988 | 1:94a3e8fe5e25 | 1552 | #endif /* MBED */ |
dpandit1988 | 1:94a3e8fe5e25 | 1553 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1554 | |
dpandit1988 | 1:94a3e8fe5e25 | 1555 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1556 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1557 | * Function: printPollAdcConvTime |
dpandit1988 | 1:94a3e8fe5e25 | 1558 | * @brief Print Poll adc conversion Time. |
dpandit1988 | 1:94a3e8fe5e25 | 1559 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1560 | * @details This function print poll adc conversion Time. |
dpandit1988 | 1:94a3e8fe5e25 | 1561 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1562 | * @return None |
dpandit1988 | 1:94a3e8fe5e25 | 1563 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1564 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1565 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1566 | void printPollAdcConvTime(int count) |
dpandit1988 | 1:94a3e8fe5e25 | 1567 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1568 | #ifdef MBED |
dpandit1988 | 1:94a3e8fe5e25 | 1569 | pc.printf("Adc Conversion Time = %fms\n", (float)(count/1000.0)); |
dpandit1988 | 1:94a3e8fe5e25 | 1570 | #else /* IAR */ |
dpandit1988 | 1:94a3e8fe5e25 | 1571 | printf("Adc Conversion Time = %fms\n", (float)(count/64000.0)); |
dpandit1988 | 1:94a3e8fe5e25 | 1572 | #endif /* MBED */ |
dpandit1988 | 1:94a3e8fe5e25 | 1573 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1574 | |
dpandit1988 | 1:94a3e8fe5e25 | 1575 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1576 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1577 | * Function: getVoltage |
dpandit1988 | 1:94a3e8fe5e25 | 1578 | * @brief Get Voltage with multiplication factor. |
dpandit1988 | 1:94a3e8fe5e25 | 1579 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1580 | * @details This function calculates the voltage. |
dpandit1988 | 1:94a3e8fe5e25 | 1581 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1582 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1583 | * @param [in] data Register value(uint16_t) |
dpandit1988 | 1:94a3e8fe5e25 | 1584 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1585 | * @return Voltage(float) |
dpandit1988 | 1:94a3e8fe5e25 | 1586 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1587 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1588 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1589 | float getVoltage(int data) |
dpandit1988 | 1:94a3e8fe5e25 | 1590 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1591 | float voltage; |
dpandit1988 | 1:94a3e8fe5e25 | 1592 | voltage = 100e-6 * (int16_t)data; // interpreting as 16-bit to be sure of length so signed works |
dpandit1988 | 1:94a3e8fe5e25 | 1593 | return voltage; |
dpandit1988 | 1:94a3e8fe5e25 | 1594 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1595 | |
dpandit1988 | 1:94a3e8fe5e25 | 1596 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1597 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1598 | * Function: getCurrent |
dpandit1988 | 1:94a3e8fe5e25 | 1599 | * @brief Get Current with multiplication factor. |
dpandit1988 | 1:94a3e8fe5e25 | 1600 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1601 | * @details This function calculates the current. |
dpandit1988 | 1:94a3e8fe5e25 | 1602 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1603 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1604 | * @param [in] data Register value(uint32_t) |
dpandit1988 | 1:94a3e8fe5e25 | 1605 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1606 | * @return Current(float) |
dpandit1988 | 1:94a3e8fe5e25 | 1607 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1608 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1609 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1610 | float getCurrent(uint32_t data) |
dpandit1988 | 1:94a3e8fe5e25 | 1611 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1612 | float current; |
dpandit1988 | 1:94a3e8fe5e25 | 1613 | current = 1e-6 * ((int32_t)(data << (32-18)) >> (32-18)); |
dpandit1988 | 1:94a3e8fe5e25 | 1614 | return current; |
dpandit1988 | 1:94a3e8fe5e25 | 1615 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1616 | |
dpandit1988 | 1:94a3e8fe5e25 | 1617 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1618 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1619 | * Function: getAvgCurrent |
dpandit1988 | 1:94a3e8fe5e25 | 1620 | * @brief Get Average Current with multiplication factor. |
dpandit1988 | 1:94a3e8fe5e25 | 1621 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1622 | * @details This function calculates the current. |
dpandit1988 | 1:94a3e8fe5e25 | 1623 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1624 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1625 | * @param [in] data Register value(uint32_t) |
dpandit1988 | 1:94a3e8fe5e25 | 1626 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1627 | * @return Current(float) |
dpandit1988 | 1:94a3e8fe5e25 | 1628 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1629 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1630 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1631 | float getAvgCurrent(uint32_t data) |
dpandit1988 | 1:94a3e8fe5e25 | 1632 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1633 | float current; |
dpandit1988 | 1:94a3e8fe5e25 | 1634 | current = 1e-6 * 0.125 * ((int32_t)(data << (32-18)) >> (32-18)); |
dpandit1988 | 1:94a3e8fe5e25 | 1635 | return current; |
dpandit1988 | 1:94a3e8fe5e25 | 1636 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1637 | |
dpandit1988 | 1:94a3e8fe5e25 | 1638 | /** |
dpandit1988 | 1:94a3e8fe5e25 | 1639 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1640 | * Function: getOverCurrent |
dpandit1988 | 1:94a3e8fe5e25 | 1641 | * @brief Get Over Current with multiplication factor. |
dpandit1988 | 1:94a3e8fe5e25 | 1642 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1643 | * @details This function calculates the over current. |
dpandit1988 | 1:94a3e8fe5e25 | 1644 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1645 | * Parameters: |
dpandit1988 | 1:94a3e8fe5e25 | 1646 | * @param [in] data Register value(uint8_t) |
dpandit1988 | 1:94a3e8fe5e25 | 1647 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1648 | * @return Current(float) |
dpandit1988 | 1:94a3e8fe5e25 | 1649 | * |
dpandit1988 | 1:94a3e8fe5e25 | 1650 | ******************************************************************************* |
dpandit1988 | 1:94a3e8fe5e25 | 1651 | */ |
dpandit1988 | 1:94a3e8fe5e25 | 1652 | float getOverCurrent(uint8_t data) |
dpandit1988 | 1:94a3e8fe5e25 | 1653 | { |
dpandit1988 | 1:94a3e8fe5e25 | 1654 | float over_current; |
dpandit1988 | 1:94a3e8fe5e25 | 1655 | over_current = 0.005 * ((int8_t)(data << (8-7)) >> (8-7)); |
dpandit1988 | 1:94a3e8fe5e25 | 1656 | return over_current; |
dpandit1988 | 1:94a3e8fe5e25 | 1657 | } |
dpandit1988 | 1:94a3e8fe5e25 | 1658 | |
dpandit1988 | 1:94a3e8fe5e25 | 1659 | /** @}*/ |
dpandit1988 | 1:94a3e8fe5e25 | 1660 | /** @}*/ |