/******************************************************************************* * Outline : EEPROM_Read * Description : This function writes the given contents to the * EEPROM, at the given location. * Argument : offset -- Offset byte from start of EEPROM * aData -- Pointer to bytes to write to EEPROM * aSize -- number of bytes to write to EEPROM * Return value : 0 = success, else failure *******************************************************************************/ uint8_t EEPROM_Read(uint16_t offset, uint8_t *aData, uint16_t aSize) { uint8_t writeData[2]; uint32_t timeout = MSTimerGet(); I2C_Request r; writeData[0] = (uint8_t)offset<<8; writeData[1] = (uint8_t)offset; r.iAddr = EEPROM_ADDR>>1; r.iSpeed = 100; r.iWriteData = writeData; r.iWriteLength = 2; r.iReadData = aData; r.iReadLength = aSize; I2C_Start(); I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < EEPROM_TIMEOUT)) {} I2C_Read(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < EEPROM_TIMEOUT)) {} return 0; }
/*---------------------------------------------------------------------------* * Routine: Temperature_Get *---------------------------------------------------------------------------* * Description: * Read the value of the ADT7420 and return the temperature in Celcius. * Inputs: * void * Outputs: * uint16_t -- temperature with 4 bits of fraction and 12 bits of * integer. *---------------------------------------------------------------------------*/ uint16_t Temperature_Get(void) { uint8_t target_reg; uint8_t target_data[2] = {0x00, 0x00}; uint16_t temp = 0; uint32_t timeout = MSTimerGet(); I2C_Request r; r.iAddr = ADT7420_ADDR>>1; r.iSpeed = 100; r.iWriteData = &target_reg; r.iWriteLength = 1; r.iReadData = target_data; r.iReadLength = 2; I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} I2C_Read(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} /* Convert the device measurement into a decimal number and insert into a temporary string to be displayed */ temp = (target_data[0] << 8) + target_data[1]; // temp = temp >> 3; return temp; }
/*---------------------------------------------------------------------------* * Routine: EEPROM_Seq_Read *---------------------------------------------------------------------------* * Description: * Read the value of the address and return the data . * Inputs: * void * Outputs: * uint16_t -- temperature with 4 bits of fraction and 12 bits of * integer. *---------------------------------------------------------------------------*/ int16_t EEPROM_Seq_Read(uint16_t addr,uint8_t *pdata, uint16_t r_lenth) { uint8_t target_address[2]; uint32_t timeout = MSTimerGet(); I2C_Request r; int16_t result = 0; target_address[0] = addr & 0xFF00; target_address[1] = addr & 0x00FF; r.iAddr = EEPROM_ADDR >> 1; r.iSpeed = 100; r.iWriteData = target_address; r.iWriteLength = 2; r.iReadData = pdata; r.iReadLength = r_lenth; I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} I2C_Read(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} result = 1; return result; }
/*---------------------------------------------------------------------------* * Routine: Accelerometer_Get *---------------------------------------------------------------------------* * Description: * Read the value of the ADT7420 and return the LightSensor in Lux. * Inputs: * void * Outputs: * uint16_t -- LightSensor with 4 bits of fraction and 12 bits of * integer. *---------------------------------------------------------------------------*/ int16_t *Accelerometer_Get(void) { uint8_t target_reg, acc_axis; uint8_t target_data[2] = {0x00, 0x00}; uint32_t timeout = MSTimerGet(); I2C_Request r; //Accelerometer_Init(); for(acc_axis=0; acc_axis<3; acc_axis++) { target_reg = acc_reg_addr[acc_axis]; r.iAddr = ACCEL_ADDR>>1; r.iSpeed = 100; r.iWriteData = &target_reg; r.iWriteLength = 1; r.iReadData = target_data; r.iReadLength = 2; I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} I2C_Read(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} /* Convert the device measurement into a decimal number and insert into a temporary string to be displayed */ gAccData[acc_axis] = (target_data[1] << 8) + target_data[0]; } return gAccData; }
/***************************************************************************** * * UART_ReadBufferLine * * \param buffer: character buffer to tx; len: size of buffer; * * \return failure: -1; success: bytes rx'd * * \brief Reads characters out of the UART buffer into the caller buffer until * the buffer size is hit. Returns number of bytes * read into buffer. Populates fullLine with a '1' if a full line was * read. * *****************************************************************************/ int AtModem_ReadLineTimeOut(unsigned int checkTime, char *buffer, unsigned int bufSize) { char * lineptr = buffer; char * maxptr = buffer + bufSize; uint32_t startTime = MSTimerGet(); while (MSTimerDelta(startTime)< checkTime) { while (UART0_ReceiveByte((unsigned char *)lineptr)) { if ((lineptr + 1) > maxptr) // too many bytes to read into our line! { return lineptr - buffer; } else lineptr++; } } //if we read a partial line, but timed out, we still return how many //bytes we read just in case the caller wants to try to assemble the line //ConsolePrintf("timedout\r\n"); return lineptr - buffer; }
/*---------------------------------------------------------------------------* * Routine: MSTimerDelay *---------------------------------------------------------------------------* * Description: * Routine to idle and delay a given number of milliseconds doing * nothing. * Inputs: * uint32_t ms -- Number of milliseconds to delay * Outputs: * void *---------------------------------------------------------------------------*/ void MSTimerDelay(uint32_t ms) { uint32_t start = MSTimerGet(); while (MSTimerDelta(start) < ms) { } }
/*---------------------------------------------------------------------------* * Routine: EEPROM_Write *---------------------------------------------------------------------------* * Description: * Write EEPROM * Inputs: * uint16_t add, char * pBuff * Outputs: * *---------------------------------------------------------------------------*/ void EEPROM_WriteStr(uint16_t addr, char *pdata) { /* Declare error flag */ uint8_t send[256]; I2C_Request r; uint16_t len = 2; send[0] = addr & 0xFF00; send[1] = addr & 0x00FF; while (*pdata != '\0') { send[len] = (uint8_t)*pdata; len++; pdata++; } uint32_t timeout = MSTimerGet(); r.iAddr = EEPROM_ADDR>>1; r.iSpeed = 100; /* kHz */ r.iWriteData = send; r.iWriteLength = len; r.iReadData = 0; r.iReadLength = 0; I2C_Start(); I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} }
/** * @brief Process in progress timeout * * Checks time since in progress flag is set. If timeout is detected, * appropriate action should be done and in progress flag should be cleared. * * @return In progress flag */ static char MQTT_Msg_TimeoutMsgInProgress(){ if (MQTT_MsgProcessBusy.InProcess) { if (MSTimerDelta(MQTT_MsgProcessBusy.LastAction) > MQTT_MSG_RESPONSE_WAIT_TIMEOUT) { MQTT_OnMsgResponseTimeout(); MQTT_Msg_ClearMsgInProgress(); // timeout } } return MQTT_MsgProcessBusy.InProcess; }
/** * @brief Wait until we receive ack from master ble module * * After sending SPI message to master ble we should wait * for acknowledge or timeout. * * @return True if ack received */ static bool Sensors_Cfg_WaitAck(){ unsigned long long timeout; timeout = MSTimerGet(); Sensors_Cfg_ClrAck(); while (sensors_ack_rcv == false) { if (MSTimerDelta(timeout) > CFG_PASSKEY_WRITE_TIMEOUT) return false; } return sensors_ack_rcv; }
/** * @brief Checks for timeout from previous action * * Checks if the timeout occurred from last actions for the message. * Detects retransmit timeout (action should be repeated), and max number of retransmits. * * @param Message handler * * @return 0 - no timeout; 1 - retransmit timeout, 2 - we should discard message */ static char MQTT_Msg_CheckForTimeout(unsigned char handler){ if (MQTT_Api_Messages[handler].retransmittions > MQTT_MSG_DISCARD_AFTER_RETRANSMITS) { return 2; } else if (MSTimerDelta(MQTT_Api_Messages[handler].TimeOfLastAction) > MQTT_MSG_RETRASMIT_TIMEOUT) { MQTT_Msg_UpdateLastActionTime(handler); MQTT_Api_Messages[handler].retransmittions ++; return 1; } else return 0; }
/** @brief Sends periodic temperature using TCP client connection @private */ static void gs_example_send_tcp_client_data(){ static uint8_t temperatureStr[] = TCP_CLIENT_DATA_STR; // Check for a valid connection and timer interval if(tcpClientCID != GS_API_INVALID_CID && MSTimerDelta(tcpClientSentTime) > TCP_CLIENT_SEND_INTERVAL ){ // Format string with temperature sprintf((char*)temperatureStr, TCP_CLIENT_DATA_STR, GS_Example_GetTemperature()); // Try to send the temperature string if(!GS_API_SendTcpData(tcpClientCID, temperatureStr, sizeof(TCP_CLIENT_DATA_STR) - 1)){ // Sending failed, disable this connection ID tcpClientCID = GS_API_INVALID_CID; GS_API_Printf("Send TCP Data failed"); } // Reset sending interval tcpClientSentTime = MSTimerGet(); } }
/*---------------------------------------------------------------------------*/ void TestGainSpan_ATCommands(void) { bool send = true; const uint8_t match[] = "AT\r\r\nOK\r\n\n\r\n"; uint8_t in[sizeof(match)]; uint8_t pos; uint8_t c; uint32_t start; DisplayLCD(LCD_LINE2, "GS ATCmd"); /* Reset the connection by flushing any waiting data */ start = MSTimerGet(); while (MSTimerDelta(start) < 500) { if (GainSpan_SPI_ReceiveByte(SPI_WIFI_CHANNEL, &c)) { Console_UART_SendByte(c); start = MSTimerGet(); } } start = MSTimerGet(); while (1) { /* Infitine loop */ if (send) { /* Do AT commands as fast as possible. */ GainSpan_SPI_SendData("AT\r\n", 4); send = false; pos = 0; start += 10; } if (GainSpan_SPI_ReceiveByte(SPI_WIFI_CHANNEL, &c)) { if (c != GAINSPAN_SPI_CHAR_IDLE) { in[pos++] = c; Console_UART_SendByte(c); if (pos == (sizeof(match) - 1)) { if (memcmp(match, in, sizeof(match) - 1) != 0) { Console_UART_SendByte('_'); ErrorCode(3); } send = true; } } } } }
/*---------------------------------------------------------------------------* * Routine: Temperature_Init *---------------------------------------------------------------------------* * Description: * Initialize the temperature ADT7420 driver. * Inputs: * void * Outputs: * void *---------------------------------------------------------------------------*/ void Temperature_Init(void) { /* Declare error flag */ uint8_t cmd[2] = { ADT7420_CONFIG_REG, 0x00 }; I2C_Request r; uint32_t timeout = MSTimerGet(); r.iAddr = ADT7420_ADDR>>1; r.iSpeed = 100; /* kHz */ r.iWriteData = cmd; r.iWriteLength = 2; r.iReadData = 0; r.iReadLength = 0; I2C_Start(); I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} }
/*---------------------------------------------------------------------------* * Routine: LightSensor_Init *---------------------------------------------------------------------------* * Description: * Initialize the LightSensor driver. * Inputs: * void * Outputs: * void *---------------------------------------------------------------------------*/ void LightSensor_Init(void) { /* Declare error flag */ uint8_t cmd[2] = { LIGHTSENSOR_CMD, 0x00 }; I2C_Request r; uint32_t timeout = MSTimerGet(); r.iAddr = LIGHTSENSOR_ADDR>>1; r.iSpeed = 100; /* kHz */ r.iWriteData = cmd; r.iWriteLength = 2; r.iReadData = 0; r.iReadLength = 0; I2C_Start(); I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} }
/******************************************************************************* * Outline : EEPROM_Write * Description : This function writes the given contents to the * EEPROM, at the given location. * Argument : offset -- Offset byte from start of EEPROM * aData -- Pointer to bytes to write to EEPROM * aSize -- number of bytes to write to EEPROM * Return value : 0 = success, else failure *******************************************************************************/ uint8_t EEPROM_Write(uint16_t offset, uint8_t *aData, uint16_t aSize) { I2C_Request r; uint32_t timeout = MSTimerGet(); uint8_t writeData[EEPROM_BYTES_PER_WRITE+2]; uint16_t i, j, bytesToWrite; r.iAddr = EEPROM_ADDR>>1; r.iSpeed = 100; /* kHz */ // Write Data in groups of size defined by EEPROM_BYTES_PER_WRITE for(i=0; i<aSize; i+=EEPROM_BYTES_PER_WRITE) { // Data Address in the EEPROM to write to writeData[0] = (uint8_t)(i + offset)<<8; writeData[1] = (uint8_t)(i + offset); for(j=0; j<EEPROM_BYTES_PER_WRITE; j++) { writeData[2+j] = aData[i+j]; } if((aSize - i) < EEPROM_BYTES_PER_WRITE) bytesToWrite = aSize - i; else bytesToWrite = EEPROM_BYTES_PER_WRITE; r.iWriteData = writeData; r.iWriteLength = 2+bytesToWrite; r.iReadData = 0; r.iReadLength = 0; I2C_Start(); I2C_Write(&r, 0); MSTimerDelay(10); // Part requires a 5ms to process a data write while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < EEPROM_TIMEOUT)) {} } return 0; }
/*---------------------------------------------------------------------------* * Routine: Accelerometer_Init *---------------------------------------------------------------------------* * Description: * Initialize the Accelerometer driver. * Inputs: * void * Outputs: * void *---------------------------------------------------------------------------*/ void Accelerometer_Init(void) { I2C_Request r; uint32_t timeout; uint8_t acc_config_cnt; for(acc_config_cnt=0; acc_config_cnt<3; acc_config_cnt++) { timeout = MSTimerGet(); pTxData = (uint8_t *)acc_config[acc_config_cnt]; r.iAddr = ACCEL_ADDR>>1; r.iSpeed = 100; /* kHz */ r.iWriteData = pTxData; r.iWriteLength = 2; r.iReadData = 0; r.iReadLength = 0; I2C_Start(); I2C_Write(&r, 0); while ((I2C_IsBusy()) && (MSTimerDelta(timeout) < 10)) {} } }
/*---------------------------------------------------------------------------*/ void App_TCPClientDemo(void) { ATLIBGS_MSG_ID_E rxMsgId = ATLIBGS_MSG_ID_NONE; static char content[512]; uint8_t cid = 0; static int16_t G_adc_int[2] = { 0, 0 }; static char G_temp_int[2] = { 0, 0 }; uint8_t remoteTcpSrvIp[20]; bool connected = false; // when connected to TCP server this is true uint32_t time = MSTimerGet(); ATLIBGS_TCPMessage msg; ATLIBGS_NetworkStatus networkStatus; AtLibGs_GetNetworkStatus(&networkStatus); AppTCPSetIPMenu(&networkStatus); sprintf((char*)remoteTcpSrvIp, "%d.%d.%d.%d", networkStatus.addr.ipv4[0], networkStatus.addr.ipv4[1], networkStatus.addr.ipv4[2], G_nvsettings.webprov.tcpIPClientHostIP); App_PrepareIncomingData(); while (1) { if (!AtLibGs_IsNodeAssociated()) { App_Connect(&G_nvsettings.webprov); connected = false; } else if (!connected) { DisplayLCD(LCD_LINE7, "Connecting"); // Start a TCP client rxMsgId = AtLibGs_TCPClientStart((char *)remoteTcpSrvIp, TCP_DEMO_REMOTE_TCP_SRVR_PORT, &cid); if (rxMsgId != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE7, "No Connect!"); MSTimerDelay(2000); DisplayLCD(LCD_LINE7, ""); continue; } if (cid == ATLIBGS_INVALID_CID) { DisplayLCD(LCD_LINE7, "No CID!"); MSTimerDelay(2000); DisplayLCD(LCD_LINE7, ""); continue; } DisplayLCD(LCD_LINE7, ""); App_PrepareIncomingData(); connected = true; } else { App_TemperatureReadingUpdate(G_temp_int, true); App_PotentiometerUpdate(G_adc_int, true); // Look to see if there is a message if ((G_receivedCount) || (AtLibGs_WaitForTCPMessage(250) == ATLIBGS_MSG_ID_DATA_RX)) { // Got data! Its sitting in G_received, but in a <CID> <data> format // We need to send it back AtLibGs_ParseTCPData(G_received, G_receivedCount, &msg); // Prepare for the next batch of incoming data App_PrepareIncomingData(); // Copy the data out of the receive message (its sitting in G_recieved) memcpy(content, msg.message, msg.numBytes); // Now send this back over the TCP/IP connection rxMsgId = AtLibGs_SendTCPData(cid, (uint8_t *)content, msg.numBytes); if (rxMsgId != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE7, " Send Fail!"); MSTimerDelay(2000); DisplayLCD(LCD_LINE7, ""); continue; } } else if (MSTimerDelta(time) >= TCP_DEMO_UPDATE_INTERVAL) { time = MSTimerGet(); // send temp and ADC to last received TCP client every X seconds DisplayLCD(LCD_LINE7, " Sending"); sprintf(content, "Temp: %d.%d, Pot: %d.%d%%\r\n", G_temp_int[0], G_temp_int[1], G_adc_int[0], G_adc_int[1]); // send data to server rxMsgId = AtLibGs_SendTCPData(cid, (uint8_t *)content, strlen( content)); if (rxMsgId != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE7, " Send Fail!"); MSTimerDelay(2000); DisplayLCD(LCD_LINE7, ""); connected = false; continue; } // end if DisplayLCD(LCD_LINE7, ""); } // end else if } // end else } // end while }
int main(void) { AppMode_T AppMode; APP_STATE_E state=UPDATE_TEMPERATURE; char LCDString[30], temp_char[2]; uint16_t temp; float ftemp; HardwareSetup(); /************************initializa LCD module********************************/ SPI2_Init(); InitialiseLCD(); led_init(); MSTimerInit(); /* Default app mode */ AppMode = GAINSPAN_DEMO; /* If the CIK is exist, auto into the Exosite mode */ NVSettingsLoad(&GNV_Setting); /* Determine if SW1 & SW3 is pressed at power up to enter programming mode */ if (Switch1IsPressed() && Switch3IsPressed()) { AppMode = PROGRAM_MODE; } else if(Switch3IsPressed() && Switch2IsPressed()) { AppMode = EXOSITE_ERASE; } else if(Switch1IsPressed()) { AppMode = RUN_EXOSITE; } else if(Switch2IsPressed()) { AppMode = RUN_PROVISIONING; } else if(Switch3IsPressed()) { AppMode = RUN_OVER_AIR_DOWNLOAD; } if(AppMode == GAINSPAN_DEMO) { LCDDisplayLogo(); LCDSelectFont(FONT_SMALL); DisplayLCD(LCD_LINE3, "RL78G14 RDK V2.0"); DisplayLCD(LCD_LINE4, " Wi-Fi & Cloud "); DisplayLCD(LCD_LINE5, " demos by: "); DisplayLCD(LCD_LINE6, "Gainspan "); DisplayLCD(LCD_LINE7, "Exosite "); DisplayLCD(LCD_LINE8, "Future Designs, Inc"); MSTimerDelay(3500); ClearLCD(); DisplayLCD(LCD_LINE1, "Demo Modes: "); DisplayLCD(LCD_LINE2, "-RST no key: "); DisplayLCD(LCD_LINE3, " GS Web Server "); DisplayLCD(LCD_LINE4, "-RST + SW1: "); DisplayLCD(LCD_LINE5, " Exosite Cloud "); DisplayLCD(LCD_LINE6, "-RST + SW2: "); DisplayLCD(LCD_LINE7, " AP Provisioning "); DisplayLCD(LCD_LINE8, "-RST + SW3: OTA "); MSTimerDelay(3000); ClearLCD(); LCDSelectFont(FONT_LARGE); if(Exosite_GetCIK(NULL)) { AppMode = RUN_EXOSITE; } } DisplayLCD(LCD_LINE1, "Starting..."); /*****************************************************************************/ SPI_Init(GAINSPAN_SPI_RATE); /* Setup LCD SPI channel for Chip Select P10, active low, active per byte */ SPI_ChannelSetup(GAINSPAN_SPI_CHANNEL, false, true); GainSpan_SPI_Start(); PM15 &= ~(1 << 2); P15 &= ~(1 << 2); if(AppMode == PROGRAM_MODE) { App_ProgramMode(); } else if (AppMode == RUN_EXOSITE) { DisplayLCD(LCD_LINE1, " CLOUD DEMO "); Temperature_Init(); Potentiometer_Init(); App_Exosite(); } else if(AppMode == RUN_PROVISIONING) { App_WebProvisioning(); } else if(AppMode == RUN_OVER_AIR_DOWNLOAD) { App_OverTheAirProgrammingPushMetheod(); } else if (AppMode == EXOSITE_ERASE) { ClearLCD(); LCDSelectFont(FONT_SMALL); DisplayLCD(LCD_LINE3, "EEPROM ERASING ... "); MSTimerDelay(2000); Exosite_Init("renesas", "rl78g14", IF_WIFI, 1); DisplayLCD(LCD_LINE3, " "); DisplayLCD(LCD_LINE4, "Please reset device"); while(1); } else{ UART0_Start(GAINSPAN_CONSOLE_BAUD); // UART2_Start(GAINSPAN_UART_BAUD); Temperature_Init(); Potentiometer_Init(); // sprintf(LCDString, "RDK Demo %s", VERSION_TEXT); // DisplayLCD(LCD_LINE1, (const uint8_t *)LCDString); /* Before doing any tests or apps, startup the module */ /* and nonvolatile stettings */ App_Startup(); // Now connect to the system //App_Connect(&G_nvsettings.webprov); // App_PassThroughSPI(); /******************Start Processing Sensor data******************/ uint32_t start = MSTimerGet(); uint8_t c; Accelerometer_Init(); while(1) { // if (GainSpan_SPI_ReceiveByte(GAINSPAN_SPI_CHANNEL, &c)) if(App_Read(&c, 1, 0)) AtLibGs_ReceiveDataProcess(c); /* Timeout? */ if (MSTimerDelta(start) >= 100) // every 100 ms, read sensor data { led_task(); switch(state) { case UPDATE_TEMPERATURE: // Temperature sensor reading temp = Temperature_Get(); #if 0 // Get the temperature and show it on the LCD temp_char[0] = (int16_t)temp / 16; temp_char[1] = (int16_t)((temp & 0x000F) * 10) / 16; #endif temp_char[1] = (temp & 0xFF00)>>8; temp_char[0] = temp & 0xFF; ftemp = *(uint16_t *)temp_char; gTemp_F = ((ftemp/5)*9)/128 + 22; // Display the contents of lcd_buffer onto the debug LCD //sprintf((char *)LCDString, "TEMP: %d.%d C", temp_char[0], temp_char[1]); sprintf((char *)LCDString, "TEMP: %.1fF", gTemp_F); DisplayLCD(LCD_LINE6, (const uint8_t *)LCDString); state = UPDATE_LIGHT; break; case UPDATE_LIGHT: // Light sensor reading gAmbientLight = LightSensor_Get(); // Display the contents of lcd_buffer onto the debug LCD sprintf((char *)LCDString, "Light: %d ", gAmbientLight); DisplayLCD(LCD_LINE7, (const uint8_t *)LCDString); state = UPDATE_ACCELEROMETER; break; case UPDATE_ACCELEROMETER: // 3-axis accelerometer reading Accelerometer_Get(); sprintf((char *)LCDString, "x%2d y%2d z%2d", gAccData[0], gAccData[1], gAccData[2]); DisplayLCD(LCD_LINE8, (const uint8_t *)LCDString); state = UPDATE_TEMPERATURE; break; } start = MSTimerGet(); } } }