11th feb i2c checking chaitu's code
Dependencies: SimpleDMA eeprom mbed-rtos mbed
Fork of CDMS_CODE_FM_28JAN2017 by
FMS_all.h@256:0f9aeeaf5a1d, 2016-07-12 (annotated)
- Committer:
- chaithanyarss
- Date:
- Tue Jul 12 09:05:25 2016 +0000
- Revision:
- 256:0f9aeeaf5a1d
- Parent:
- 255:642ea552ac77
Tcs testing : Merging ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ee12b079 | 209:63e9c8f8b5d2 | 1 | |
chaithanyarss | 255:642ea552ac77 | 2 | /*===================================================FMS Functions=================================================*/ |
chaithanyarss | 256:0f9aeeaf5a1d | 3 | |
chaithanyarss | 256:0f9aeeaf5a1d | 4 | void STANDBY_PRCS(); |
chaithanyarss | 256:0f9aeeaf5a1d | 5 | |
ee12b079 | 245:da9d1bd999da | 6 | //Run processes |
ee12b079 | 209:63e9c8f8b5d2 | 7 | void P_PL_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 8 | void P_PL_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 9 | void P_COM_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 10 | void P_CDMS_HK_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 11 | void P_PL_RCV_SC_DATA(); |
ee12b079 | 209:63e9c8f8b5d2 | 12 | void P_CDMS_INIT_SD(); |
ee12b079 | 245:da9d1bd999da | 13 | |
ee12b079 | 245:da9d1bd999da | 14 | // Switch ON/OFF functions |
ee12b079 | 209:63e9c8f8b5d2 | 15 | void CDMS_SD_SW_ON(); |
ee12b079 | 209:63e9c8f8b5d2 | 16 | void CDMS_SD_SW_OFF(); |
ee12b079 | 245:da9d1bd999da | 17 | void CDMS_RTC_ON(); |
ee12b079 | 245:da9d1bd999da | 18 | void CDMS_RTC_OFF(); |
ee12b079 | 209:63e9c8f8b5d2 | 19 | void SW_ON_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 20 | void SW_OFF_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 21 | void SW_ON_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 22 | void SW_OFF_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 23 | void SW_ON_PL_EPS(); |
ee12b079 | 209:63e9c8f8b5d2 | 24 | void SW_OFF_PL_EPS(); |
ee12b079 | 209:63e9c8f8b5d2 | 25 | void SW_ON_V_A_EN(); |
ee12b079 | 209:63e9c8f8b5d2 | 26 | void SW_OFF_V_A_EN(); |
ee12b079 | 245:da9d1bd999da | 27 | |
ee12b079 | 245:da9d1bd999da | 28 | // RST functions |
ee12b079 | 209:63e9c8f8b5d2 | 29 | void RST_SD(); |
ee12b079 | 245:da9d1bd999da | 30 | void SW_RST_BAE(); |
ee12b079 | 245:da9d1bd999da | 31 | void SW_RST_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 32 | void RST_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 33 | void RST_PL_BEE(); |
chaithanyarss | 255:642ea552ac77 | 34 | void CDMS_RESET(); |
ee12b079 | 245:da9d1bd999da | 35 | void SYS_PWR_RESET(); // Have to be decided with EPS team. |
ee12b079 | 245:da9d1bd999da | 36 | void EPS_V_A_EN(); |
ee12b079 | 245:da9d1bd999da | 37 | void EPS_V_C_EN(); |
ee12b079 | 245:da9d1bd999da | 38 | |
ee12b079 | 209:63e9c8f8b5d2 | 39 | void RST_HK_COUNTER(); |
chaithanyarss | 256:0f9aeeaf5a1d | 40 | int8_t CDMS_RD_SD_HK(uint8_t *); |
ee12b079 | 245:da9d1bd999da | 41 | void CDMS_RD_RTC(uint64_t *); |
chaithanyarss | 256:0f9aeeaf5a1d | 42 | void CDMS_CALIB_RTC(uint8_t *); |
chaithanyarss | 255:642ea552ac77 | 43 | void TOTAL_RESET_WITH_CDMS(); |
ee12b079 | 245:da9d1bd999da | 44 | |
ee12b079 | 209:63e9c8f8b5d2 | 45 | |
chaithanyarss | 256:0f9aeeaf5a1d | 46 | void STANDBY_PRCS() |
chaithanyarss | 256:0f9aeeaf5a1d | 47 | { |
chaithanyarss | 256:0f9aeeaf5a1d | 48 | |
chaithanyarss | 256:0f9aeeaf5a1d | 49 | } |
chaithanyarss | 256:0f9aeeaf5a1d | 50 | |
ee12b079 | 209:63e9c8f8b5d2 | 51 | void P_PL_INIT() |
ee12b079 | 209:63e9c8f8b5d2 | 52 | { |
ee12b079 | 209:63e9c8f8b5d2 | 53 | |
ee12b079 | 209:63e9c8f8b5d2 | 54 | } |
ee12b079 | 209:63e9c8f8b5d2 | 55 | |
ee12b079 | 209:63e9c8f8b5d2 | 56 | void P_PL_MAIN() |
ee12b079 | 209:63e9c8f8b5d2 | 57 | { |
chaithanyarss | 255:642ea552ac77 | 58 | FCTN_CDMS_PL_MAIN((void *)NULL); |
ee12b079 | 209:63e9c8f8b5d2 | 59 | } |
ee12b079 | 209:63e9c8f8b5d2 | 60 | |
ee12b079 | 209:63e9c8f8b5d2 | 61 | void P_COM_INIT() |
ee12b079 | 209:63e9c8f8b5d2 | 62 | { |
ee12b079 | 245:da9d1bd999da | 63 | P_COM_INIT; |
ee12b079 | 209:63e9c8f8b5d2 | 64 | } |
ee12b079 | 209:63e9c8f8b5d2 | 65 | |
ee12b079 | 209:63e9c8f8b5d2 | 66 | void P_CDMS_HK_MAIN() |
ee12b079 | 209:63e9c8f8b5d2 | 67 | { |
ee12b079 | 245:da9d1bd999da | 68 | FCTN_CDMS_HK_MAIN((void *)NULL); |
ee12b079 | 209:63e9c8f8b5d2 | 69 | } |
ee12b079 | 209:63e9c8f8b5d2 | 70 | |
ee12b079 | 209:63e9c8f8b5d2 | 71 | void P_PL_RCV_SC_DATA() |
ee12b079 | 209:63e9c8f8b5d2 | 72 | { |
ee12b079 | 245:da9d1bd999da | 73 | |
ee12b079 | 209:63e9c8f8b5d2 | 74 | } |
ee12b079 | 209:63e9c8f8b5d2 | 75 | |
ee12b079 | 209:63e9c8f8b5d2 | 76 | void P_CDMS_INIT_SD() |
ee12b079 | 209:63e9c8f8b5d2 | 77 | { |
ee12b079 | 209:63e9c8f8b5d2 | 78 | FCTN_CDMS_SD_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 79 | } |
ee12b079 | 209:63e9c8f8b5d2 | 80 | |
ee12b079 | 209:63e9c8f8b5d2 | 81 | void CDMS_SD_SW_ON() |
ee12b079 | 209:63e9c8f8b5d2 | 82 | { |
ee12b079 | 245:da9d1bd999da | 83 | SD_SW_EN_DS = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 84 | } |
ee12b079 | 209:63e9c8f8b5d2 | 85 | |
ee12b079 | 209:63e9c8f8b5d2 | 86 | void CDMS_SD_SW_OFF() |
ee12b079 | 209:63e9c8f8b5d2 | 87 | { |
ee12b079 | 245:da9d1bd999da | 88 | SD_SW_EN_DS = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 89 | } |
ee12b079 | 209:63e9c8f8b5d2 | 90 | |
ee12b079 | 245:da9d1bd999da | 91 | void CDMS_RTC_ON() |
ee12b079 | 209:63e9c8f8b5d2 | 92 | { |
chaithanyarss | 255:642ea552ac77 | 93 | //FCTN_CDMS_INIT_RTC(); |
chaithanyarss | 255:642ea552ac77 | 94 | SPI_mutex.lock(); |
chaithanyarss | 255:642ea552ac77 | 95 | gCS_RTC=1; |
chaithanyarss | 255:642ea552ac77 | 96 | gCS_RTC=0; |
chaithanyarss | 255:642ea552ac77 | 97 | spi.write(0x81); //register address with write flag |
chaithanyarss | 255:642ea552ac77 | 98 | spi.write(0x00);//disabling stop bit in the seconds register |
chaithanyarss | 255:642ea552ac77 | 99 | SPI_mutex.unlock(); |
ee12b079 | 209:63e9c8f8b5d2 | 100 | } |
ee12b079 | 209:63e9c8f8b5d2 | 101 | |
ee12b079 | 245:da9d1bd999da | 102 | void CDMS_RTC_OFF() |
ee12b079 | 209:63e9c8f8b5d2 | 103 | { |
chaithanyarss | 255:642ea552ac77 | 104 | SPI_mutex.lock(); |
chaithanyarss | 255:642ea552ac77 | 105 | gCS_RTC=1; |
chaithanyarss | 255:642ea552ac77 | 106 | gCS_RTC=0; |
chaithanyarss | 255:642ea552ac77 | 107 | spi.write(0x81); //register address with write flag |
chaithanyarss | 255:642ea552ac77 | 108 | spi.write(0x80);//enabling stop bit in the seconds register |
chaithanyarss | 255:642ea552ac77 | 109 | SPI_mutex.unlock(); |
ee12b079 | 209:63e9c8f8b5d2 | 110 | } |
ee12b079 | 209:63e9c8f8b5d2 | 111 | |
ee12b079 | 245:da9d1bd999da | 112 | void SW_ON_BAE() |
ee12b079 | 245:da9d1bd999da | 113 | { |
ee12b079 | 245:da9d1bd999da | 114 | BAE_SW_EN_DS = 0; |
ee12b079 | 245:da9d1bd999da | 115 | } |
ee12b079 | 245:da9d1bd999da | 116 | |
ee12b079 | 245:da9d1bd999da | 117 | void SW_OFF_BAE() |
ee12b079 | 245:da9d1bd999da | 118 | { |
ee12b079 | 245:da9d1bd999da | 119 | BAE_SW_EN_DS = 1; |
ee12b079 | 245:da9d1bd999da | 120 | } |
ee12b079 | 245:da9d1bd999da | 121 | |
ee12b079 | 245:da9d1bd999da | 122 | void SW_ON_PL_BEE() |
ee12b079 | 245:da9d1bd999da | 123 | { |
ee12b079 | 245:da9d1bd999da | 124 | PYLD_DFF_CLK = 0;\ |
ee12b079 | 245:da9d1bd999da | 125 | PYLD_DFF = 1;\ |
ee12b079 | 245:da9d1bd999da | 126 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 127 | PYLD_DFF_CLK = 1;\ |
ee12b079 | 245:da9d1bd999da | 128 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 129 | PYLD_DFF_CLK = 0;\ |
ee12b079 | 245:da9d1bd999da | 130 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 131 | } |
ee12b079 | 245:da9d1bd999da | 132 | |
ee12b079 | 245:da9d1bd999da | 133 | void SW_OFF_PL_BEE() |
ee12b079 | 245:da9d1bd999da | 134 | { |
ee12b079 | 245:da9d1bd999da | 135 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 136 | PYLD_DFF = 0; |
ee12b079 | 245:da9d1bd999da | 137 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 138 | PYLD_DFF_CLK = 1; |
ee12b079 | 245:da9d1bd999da | 139 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 140 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 141 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 142 | } |
ee12b079 | 245:da9d1bd999da | 143 | |
ee12b079 | 245:da9d1bd999da | 144 | void SW_ON_PL_EPS() |
ee12b079 | 245:da9d1bd999da | 145 | { |
ee12b079 | 245:da9d1bd999da | 146 | PYLD_EPS_DFF_PWR_CLK = 0;\ |
ee12b079 | 245:da9d1bd999da | 147 | PYLD_EPS_DFF_PWR = 1;\ |
ee12b079 | 245:da9d1bd999da | 148 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 149 | PYLD_EPS_DFF_PWR_CLK = 1;\ |
ee12b079 | 245:da9d1bd999da | 150 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 151 | PYLD_EPS_DFF_PWR_CLK = 0;\ |
ee12b079 | 245:da9d1bd999da | 152 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 153 | } |
ee12b079 | 245:da9d1bd999da | 154 | |
ee12b079 | 209:63e9c8f8b5d2 | 155 | void SW_OFF_PL_EPS() |
ee12b079 | 209:63e9c8f8b5d2 | 156 | { |
ee12b079 | 245:da9d1bd999da | 157 | PYLD_EPS_DFF_PWR_CLK = 0;\ |
ee12b079 | 245:da9d1bd999da | 158 | PYLD_EPS_DFF_PWR = 0;\ |
ee12b079 | 245:da9d1bd999da | 159 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 160 | PYLD_EPS_DFF_PWR_CLK = 1;\ |
ee12b079 | 245:da9d1bd999da | 161 | wait_us(1);\ |
ee12b079 | 245:da9d1bd999da | 162 | PYLD_EPS_DFF_PWR_CLK = 0;\ |
ee12b079 | 245:da9d1bd999da | 163 | wait_us(1);\ |
ee12b079 | 209:63e9c8f8b5d2 | 164 | } |
ee12b079 | 209:63e9c8f8b5d2 | 165 | |
ee12b079 | 209:63e9c8f8b5d2 | 166 | void SW_ON_V_A_EN() |
ee12b079 | 209:63e9c8f8b5d2 | 167 | { |
chaithanyarss | 255:642ea552ac77 | 168 | V_A_EN = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 169 | } |
ee12b079 | 209:63e9c8f8b5d2 | 170 | |
ee12b079 | 209:63e9c8f8b5d2 | 171 | void SW_OFF_V_A_EN() |
ee12b079 | 209:63e9c8f8b5d2 | 172 | { |
chaithanyarss | 255:642ea552ac77 | 173 | V_A_EN = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 174 | } |
ee12b079 | 209:63e9c8f8b5d2 | 175 | |
ee12b079 | 209:63e9c8f8b5d2 | 176 | void RST_SD() |
ee12b079 | 209:63e9c8f8b5d2 | 177 | { |
ee12b079 | 245:da9d1bd999da | 178 | SD_SW_EN_DS = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 179 | wait_ms(10); |
ee12b079 | 209:63e9c8f8b5d2 | 180 | SD_SW_EN_DS = 0; |
ee12b079 | 245:da9d1bd999da | 181 | } |
ee12b079 | 245:da9d1bd999da | 182 | |
ee12b079 | 245:da9d1bd999da | 183 | void SW_RST_BAE() |
ee12b079 | 245:da9d1bd999da | 184 | { |
ee12b079 | 245:da9d1bd999da | 185 | BAE_SW_EN_DS = 1; |
ee12b079 | 245:da9d1bd999da | 186 | wait_ms(10); |
ee12b079 | 245:da9d1bd999da | 187 | BAE_SW_EN_DS = 0; |
ee12b079 | 245:da9d1bd999da | 188 | } |
ee12b079 | 245:da9d1bd999da | 189 | |
ee12b079 | 245:da9d1bd999da | 190 | void SW_RST_PL_BEE() |
ee12b079 | 245:da9d1bd999da | 191 | { |
ee12b079 | 245:da9d1bd999da | 192 | PYLD_DFF = 1; |
ee12b079 | 245:da9d1bd999da | 193 | wait_ms(10); |
ee12b079 | 245:da9d1bd999da | 194 | PYLD_DFF = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 195 | } |
ee12b079 | 209:63e9c8f8b5d2 | 196 | |
ee12b079 | 209:63e9c8f8b5d2 | 197 | void RST_BAE() |
ee12b079 | 209:63e9c8f8b5d2 | 198 | { |
ee12b079 | 245:da9d1bd999da | 199 | RESET_TO_BAE = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 200 | wait_ms(10); |
ee12b079 | 245:da9d1bd999da | 201 | RESET_TO_BAE = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 202 | } |
ee12b079 | 209:63e9c8f8b5d2 | 203 | |
ee12b079 | 209:63e9c8f8b5d2 | 204 | void RST_PL_BEE() |
ee12b079 | 209:63e9c8f8b5d2 | 205 | { |
ee12b079 | 245:da9d1bd999da | 206 | RESET_TO_PYLD = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 207 | wait_ms(10); |
ee12b079 | 245:da9d1bd999da | 208 | RESET_TO_PYLD = 0; |
ee12b079 | 245:da9d1bd999da | 209 | } |
ee12b079 | 245:da9d1bd999da | 210 | |
ee12b079 | 245:da9d1bd999da | 211 | void CDMS_INTERNAL_RESET() |
ee12b079 | 245:da9d1bd999da | 212 | { |
ee12b079 | 245:da9d1bd999da | 213 | NVIC_SystemReset(); |
ee12b079 | 245:da9d1bd999da | 214 | } |
ee12b079 | 245:da9d1bd999da | 215 | |
ee12b079 | 245:da9d1bd999da | 216 | void SYS_PWR_RESET() // Have to be decided with EPS team. |
ee12b079 | 245:da9d1bd999da | 217 | { |
chaithanyarss | 256:0f9aeeaf5a1d | 218 | sys_pwr_rst = 1; |
ee12b079 | 245:da9d1bd999da | 219 | } |
ee12b079 | 245:da9d1bd999da | 220 | |
ee12b079 | 245:da9d1bd999da | 221 | void EPS_V_A_EN() // This is a reset function |
ee12b079 | 245:da9d1bd999da | 222 | { |
chaithanyarss | 255:642ea552ac77 | 223 | V_A_EN = 0; |
ee12b079 | 245:da9d1bd999da | 224 | wait_ms(10); |
chaithanyarss | 255:642ea552ac77 | 225 | V_A_EN = 1; |
ee12b079 | 245:da9d1bd999da | 226 | } |
ee12b079 | 245:da9d1bd999da | 227 | |
ee12b079 | 245:da9d1bd999da | 228 | void EPS_V_C_EN() // This is a reset function |
ee12b079 | 245:da9d1bd999da | 229 | { |
ee12b079 | 245:da9d1bd999da | 230 | COM_RX_CNTRL = 0; |
ee12b079 | 245:da9d1bd999da | 231 | wait_ms(10); |
ee12b079 | 245:da9d1bd999da | 232 | COM_RX_CNTRL = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 233 | } |
ee12b079 | 209:63e9c8f8b5d2 | 234 | |
ee12b079 | 209:63e9c8f8b5d2 | 235 | void RST_HK_COUNTER() |
ee12b079 | 209:63e9c8f8b5d2 | 236 | { |
ee12b079 | 209:63e9c8f8b5d2 | 237 | firstCount = true; |
ee12b079 | 209:63e9c8f8b5d2 | 238 | } |
ee12b079 | 209:63e9c8f8b5d2 | 239 | |
chaithanyarss | 256:0f9aeeaf5a1d | 240 | int8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits) |
ee12b079 | 209:63e9c8f8b5d2 | 241 | { |
chaithanyarss | 256:0f9aeeaf5a1d | 242 | int8_t p; |
ee12b079 | 209:63e9c8f8b5d2 | 243 | if(SD_SW_EN_DS != DEVICE_POWERED) |
ee12b079 | 209:63e9c8f8b5d2 | 244 | { |
ee12b079 | 209:63e9c8f8b5d2 | 245 | SD_RD_ERROR = 1; |
chaithanyarss | 256:0f9aeeaf5a1d | 246 | p = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 247 | } |
ee12b079 | 209:63e9c8f8b5d2 | 248 | else |
ee12b079 | 209:63e9c8f8b5d2 | 249 | { |
ee12b079 | 209:63e9c8f8b5d2 | 250 | p = disk_read_statusbits(sd_statusbits); |
ee12b079 | 209:63e9c8f8b5d2 | 251 | } |
chaithanyarss | 256:0f9aeeaf5a1d | 252 | return p; |
ee12b079 | 209:63e9c8f8b5d2 | 253 | } |
ee12b079 | 209:63e9c8f8b5d2 | 254 | |
ee12b079 | 245:da9d1bd999da | 255 | void CDMS_RD_RTC(uint64_t *time) |
ee12b079 | 245:da9d1bd999da | 256 | { |
ee12b079 | 245:da9d1bd999da | 257 | *time = FCTN_CDMS_RD_RTC(); |
ee12b079 | 245:da9d1bd999da | 258 | } |
ee12b079 | 245:da9d1bd999da | 259 | |
chaithanyarss | 256:0f9aeeaf5a1d | 260 | void CDMS_CALIB_RTC(uint64_t *time) |
ee12b079 | 245:da9d1bd999da | 261 | { |
chaithanyarss | 256:0f9aeeaf5a1d | 262 | SPI_mutex.lock(); |
chaithanyarss | 256:0f9aeeaf5a1d | 263 | gCS_RTC=1; |
chaithanyarss | 256:0f9aeeaf5a1d | 264 | spi.format(8,0); |
chaithanyarss | 256:0f9aeeaf5a1d | 265 | spi.frequency(1000000); |
chaithanyarss | 256:0f9aeeaf5a1d | 266 | |
chaithanyarss | 256:0f9aeeaf5a1d | 267 | gCS_RTC=0; |
chaithanyarss | 256:0f9aeeaf5a1d | 268 | spi.write(0x82); |
chaithanyarss | 256:0f9aeeaf5a1d | 269 | spi.write(time[0]);//set minutes |
chaithanyarss | 256:0f9aeeaf5a1d | 270 | gCS_RTC=1; |
chaithanyarss | 256:0f9aeeaf5a1d | 271 | |
chaithanyarss | 256:0f9aeeaf5a1d | 272 | gCS_RTC=0; |
chaithanyarss | 256:0f9aeeaf5a1d | 273 | spi.write(0x83); |
chaithanyarss | 256:0f9aeeaf5a1d | 274 | spi.write(time[1] & 0x3F); //set hours |
chaithanyarss | 256:0f9aeeaf5a1d | 275 | gCS_RTC=1; |
ee12b079 | 245:da9d1bd999da | 276 | |
chaithanyarss | 256:0f9aeeaf5a1d | 277 | gCS_RTC=0; |
chaithanyarss | 256:0f9aeeaf5a1d | 278 | spi.write(0x85); |
chaithanyarss | 256:0f9aeeaf5a1d | 279 | spi.write(time[2] & 0x3F); //set date |
chaithanyarss | 256:0f9aeeaf5a1d | 280 | gCS_RTC=1; |
chaithanyarss | 256:0f9aeeaf5a1d | 281 | |
chaithanyarss | 256:0f9aeeaf5a1d | 282 | gCS_RTC=0; |
chaithanyarss | 256:0f9aeeaf5a1d | 283 | spi.write(0x86); |
chaithanyarss | 256:0f9aeeaf5a1d | 284 | spi.write(time[3] & 0x1F); //set month |
chaithanyarss | 256:0f9aeeaf5a1d | 285 | gCS_RTC=1; |
chaithanyarss | 256:0f9aeeaf5a1d | 286 | |
chaithanyarss | 256:0f9aeeaf5a1d | 287 | gCS_RTC=0; |
chaithanyarss | 256:0f9aeeaf5a1d | 288 | spi.write(0x87); |
chaithanyarss | 256:0f9aeeaf5a1d | 289 | spi.write(time[4]); //set year to 00(2000) |
chaithanyarss | 256:0f9aeeaf5a1d | 290 | gCS_RTC=1; |
chaithanyarss | 256:0f9aeeaf5a1d | 291 | gPC.puts("\n\r rtc initalised \n"); |
chaithanyarss | 256:0f9aeeaf5a1d | 292 | SPI_mutex.unlock(); |
ee12b079 | 245:da9d1bd999da | 293 | } |
ee12b079 | 245:da9d1bd999da | 294 | |
chaithanyarss | 224:3ac1f91e0ebc | 295 | void CDMS_RESET() |
chaithanyarss | 224:3ac1f91e0ebc | 296 | { |
chaithanyarss | 224:3ac1f91e0ebc | 297 | NVIC_SystemReset(); |
chaithanyarss | 224:3ac1f91e0ebc | 298 | } |
chaithanyarss | 224:3ac1f91e0ebc | 299 | |
ee12b079 | 245:da9d1bd999da | 300 | /* |
ee12b079 | 245:da9d1bd999da | 301 | //void CDMS_INTERNAL_RESET() |
ee12b079 | 209:63e9c8f8b5d2 | 302 | { |
ee12b079 | 209:63e9c8f8b5d2 | 303 | |
ee12b079 | 245:da9d1bd999da | 304 | } |
chaithanyarss | 255:642ea552ac77 | 305 | */ |