Переструктурирован проект, перенесена ветка тестирования modbus и чуть скомпрессированная библиотека dallas
This commit is contained in:
@@ -256,8 +256,6 @@ HAL_StatusTypeDef DS18B20_CalcTemperature(OneWire_t* OW, uint8_t *ROM, uint8_t *
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t scratchpad_buff[8];
|
||||
/**
|
||||
* @brief The function is used as read scratchpad from device
|
||||
* @retval status in OK = 1, Failed = 0
|
||||
@@ -268,7 +266,7 @@ uint8_t scratchpad_buff[8];
|
||||
HAL_StatusTypeDef DS18B20_ReadScratchpad(OneWire_t* OW, uint8_t *ROM, uint8_t *Scratchpad)
|
||||
{
|
||||
if(Scratchpad == NULL)
|
||||
Scratchpad = scratchpad_buff;
|
||||
return HAL_ERROR;
|
||||
|
||||
/* Reset line */
|
||||
OneWire_Reset(OW);
|
||||
@@ -475,35 +473,35 @@ HAL_StatusTypeDef DS18B20_WriteUserBytes(OneWire_t* OW, uint8_t *ROM, int16_t Us
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief The function is used as search device that had temperature alarm
|
||||
* triggered and store it in DS18B20 alarm data structure
|
||||
* @retval status of search, OK = 1, Failed = 0
|
||||
* @param DS DS18B20 HandleTypedef
|
||||
* @param OW OneWire HandleTypedef
|
||||
*/
|
||||
uint8_t DS18B20_AlarmSearch(DS18B20_Drv_t *DS, OneWire_t* OW)
|
||||
{
|
||||
uint8_t t = 0;
|
||||
///**
|
||||
// * @brief The function is used as search device that had temperature alarm
|
||||
// * triggered and store it in DS18B20 alarm data structure
|
||||
// * @retval status of search, OK = 1, Failed = 0
|
||||
// * @param DS DS18B20 HandleTypedef
|
||||
// * @param OW OneWire HandleTypedef
|
||||
// */
|
||||
//uint8_t DS18B20_AlarmSearch(DS18B20_Drv_t *DS, OneWire_t* OW)
|
||||
//{
|
||||
// uint8_t t = 0;
|
||||
|
||||
/* Reset Alarm in DS */
|
||||
for(uint8_t i = 0; i < OW->RomCnt; i++)
|
||||
{
|
||||
for(uint8_t j = 0; j < 8; j++)
|
||||
{
|
||||
DS->AlmAddr[i][j] = 0;
|
||||
}
|
||||
}
|
||||
// /* Reset Alarm in DS */
|
||||
// for(uint8_t i = 0; i < OW->RomCnt; i++)
|
||||
// {
|
||||
// for(uint8_t j = 0; j < 8; j++)
|
||||
// {
|
||||
// DS->AlmAddr[i][j] = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
/* Start alarm search */
|
||||
while (OneWire_Search(OW, DS18B20_CMD_ALARM_SEARCH))
|
||||
{
|
||||
/* Store ROM of device which has alarm flag set */
|
||||
OneWire_GetDevRom(OW, DS->AlmAddr[t]);
|
||||
t++;
|
||||
}
|
||||
return (t > 0) ? 1 : 0;
|
||||
}
|
||||
// /* Start alarm search */
|
||||
// while (OneWire_Search(OW, DS18B20_CMD_ALARM_SEARCH))
|
||||
// {
|
||||
// /* Store ROM of device which has alarm flag set */
|
||||
// OneWire_GetDevRom(OW, DS->AlmAddr[t]);
|
||||
// t++;
|
||||
// }
|
||||
// return (t > 0) ? 1 : 0;
|
||||
//}
|
||||
|
||||
/**
|
||||
* @brief The function is used to initialize the DS18B20 sensor, and search
|
||||
|
||||
Reference in New Issue
Block a user