Переструктурирован проект, перенесена ветка тестирования modbus и чуть скомпрессированная библиотека dallas

This commit is contained in:
2025-03-03 13:05:37 +03:00
parent 0f2736b8a5
commit b6978c385a
14 changed files with 387 additions and 4321 deletions

View File

@@ -18,6 +18,7 @@
/* Declarations and definitions --------------------------------------------*/
DALLAS_HandleTypeDef hdallas1;
/* Functions ---------------------------------------------------------------*/
/**
@@ -25,7 +26,7 @@
* @param sensor Óêàçàòåëü íà ñòðóêòóðó äàò÷èêà
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_ReplaceLostedSensor(DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_ReplaceLostedSensor(DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
@@ -40,7 +41,7 @@ HAL_StatusTypeDef Dallas_ReplaceLostedSensor(DALLAS_HandleTypeDef *sensor)
if(DS18B20_Search(&DS, &OW) != HAL_OK)
return HAL_ERROR;
if(sensor->Init.init_func(sensor->onewire, sensor) != HAL_OK)
if(sensor->Init.init_func(sensor->hdallas->onewire, sensor) != HAL_OK)
return HAL_ERROR;
return HAL_OK;
@@ -58,18 +59,18 @@ HAL_StatusTypeDef Dallas_ReplaceLostedSensor(DALLAS_HandleTypeDef *sensor)
* @param sensor Óêàçàòåëü íà ñòðóêòóðó äàò÷èêà
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_AddNewSensors(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_AddNewSensors(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(sensor == NULL)
return HAL_ERROR;
sensor->onewire = onewire;
sensor->hdallas = hdallas;
result = sensor->Init.init_func(onewire, sensor);
result = sensor->Init.init_func(hdallas, sensor);
return result;
}
@@ -82,31 +83,31 @@ HAL_StatusTypeDef Dallas_AddNewSensors(OneWire_t *onewire, DALLAS_HandleTypeDef
* @param sensor Óêàçàòåëü íà ñòðóêòóðó äàò÷èêà
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_SensorInitByROM(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_SensorInitByROM(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(sensor == NULL)
return HAL_ERROR;
uint8_t ROM[8] = {0};
ROM[0] = (sensor->Init.ROM >> (7*8)) & 0xFF;
ROM[1] = (sensor->Init.ROM >> (6*8)) & 0xFF;
ROM[2] = (sensor->Init.ROM >> (5*8)) & 0xFF;
ROM[3] = (sensor->Init.ROM >> (4*8)) & 0xFF;
ROM[4] = (sensor->Init.ROM >> (3*8)) & 0xFF;
ROM[5] = (sensor->Init.ROM >> (2*8)) & 0xFF;
ROM[6] = (sensor->Init.ROM >> (1*8)) & 0xFF;
ROM[7] = (sensor->Init.ROM >> (0*8)) & 0xFF;
ROM[0] = (sensor->Init.InitParam >> (7*8)) & 0xFF;
ROM[1] = (sensor->Init.InitParam >> (6*8)) & 0xFF;
ROM[2] = (sensor->Init.InitParam >> (5*8)) & 0xFF;
ROM[3] = (sensor->Init.InitParam >> (4*8)) & 0xFF;
ROM[4] = (sensor->Init.InitParam >> (3*8)) & 0xFF;
ROM[5] = (sensor->Init.InitParam >> (2*8)) & 0xFF;
ROM[6] = (sensor->Init.InitParam >> (1*8)) & 0xFF;
ROM[7] = (sensor->Init.InitParam >> (0*8)) & 0xFF;
if(DS18B20_IsValidAddress(ROM) != HAL_OK)
return HAL_ERROR;
uint8_t comparebytes = DALLAS_ROM_SIZE;
int ROM_ind = 0;
for(int i = 0; i < onewire->RomCnt; i++)
for(int i = 0; i < hdallas->onewire->RomCnt; i++)
{
comparebytes = DALLAS_ROM_SIZE;
for(int rom_byte = 0; rom_byte < DALLAS_ROM_SIZE; rom_byte++)
@@ -125,7 +126,7 @@ HAL_StatusTypeDef Dallas_SensorInitByROM(OneWire_t *onewire, DALLAS_HandleTypeDe
if(comparebytes == 0)
{
result = Dallas_SensorInit(onewire, sensor, &DS.DevAddr[ROM_ind]);
result = Dallas_SensorInit(hdallas, sensor, &DS.DevAddr[ROM_ind]);
return result;
}
else
@@ -144,35 +145,34 @@ HAL_StatusTypeDef Dallas_SensorInitByROM(OneWire_t *onewire, DALLAS_HandleTypeDe
* @param sensor Óêàçàòåëü íà ñòðóêòóðó äàò÷èêà
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_SensorInitByUserBytes(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_SensorInitByUserBytes(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(sensor == NULL)
return HAL_ERROR;
uint8_t UserByte1 = sensor->Init.UserBytes12 & 0xFF;
uint8_t UserByte2 = sensor->Init.UserBytes12 >> 8;
uint8_t UserByte3 = sensor->Init.UserBytes34 & 0xFF;
uint8_t UserByte4 = sensor->Init.UserBytes34 >> 8;
uint8_t UserByte1 = sensor->Init.InitParam & 0xFF;
uint8_t UserByte2 = sensor->Init.InitParam >> 8;
uint8_t UserByte3 = (sensor->Init.InitParam >> 16) & 0xFF;
uint8_t UserByte4 = (sensor->Init.InitParam >> 16) >> 8;
uint8_t UserByte12Cmp = 0;
uint8_t UserByte34Cmp = 0;
DALLAS_ScratchpadTypeDef scratchpad;
for(int i = 0; i < onewire->RomCnt; i++)
for(int i = 0; i < hdallas->onewire->RomCnt; i++)
{
/* Ïðîâåðêà ïðèñóòñòâóåò ëè âûáðàííûé äàò÷èê íà ëèíèè */
result = DS18B20_ReadScratchpad(onewire, (uint8_t *)&DS.DevAddr[i], (uint8_t *)&scratchpad);
result = DS18B20_ReadScratchpad(hdallas->onewire, (uint8_t *)&DS.DevAddr[i], (uint8_t *)&hdallas->scratchpad);
if (result != HAL_OK)
return result;
/* Ñðàâíåíèå UserByte1 è UserByte2, åñëè îíè íå ðàâíû íóëþ */
if(sensor->Init.UserBytes12 != NULL)
if((sensor->Init.InitParam & 0xFFFF) != NULL)
{
if( (scratchpad.tHighRegister == UserByte1) &&
(scratchpad.tLowRegister == UserByte2))
if( (hdallas->scratchpad.tHighRegister == UserByte1) &&
(hdallas->scratchpad.tLowRegister == UserByte2))
{
UserByte12Cmp = 1;
}
@@ -182,10 +182,10 @@ HAL_StatusTypeDef Dallas_SensorInitByUserBytes(OneWire_t *onewire, DALLAS_Handle
UserByte12Cmp = 1;
}
/* Ñðàâíåíèå UserByte3 è UserByte4, åñëè îíè íå ðàâíû íóëþ */
if(sensor->Init.UserBytes34 != NULL)
if((sensor->Init.InitParam & 0xFFFF0000) != NULL)
{
if( (scratchpad.UserByte3 == UserByte3) &&
(scratchpad.UserByte4 == UserByte4))
if( (hdallas->scratchpad.UserByte3 == UserByte3) &&
(hdallas->scratchpad.UserByte4 == UserByte4))
{
UserByte34Cmp = 1;
}
@@ -199,13 +199,12 @@ HAL_StatusTypeDef Dallas_SensorInitByUserBytes(OneWire_t *onewire, DALLAS_Handle
{
// sensor->isInitialized = 1;
// sensor->Init.init_func = (HAL_StatusTypeDef (*)())Dallas_SensorInitByUserBytes;
result = Dallas_SensorInit(onewire, sensor, &DS.DevAddr[i]);
result = Dallas_SensorInit(hdallas, sensor, &DS.DevAddr[i]);
return result;
}
}
sensor->sensROM = 0;
memset(&sensor->scratchpad, 0, sizeof(DALLAS_ScratchpadTypeDef));
/* Âîçâðàùàåì îøèáêó åñëè íå íàøëè */
return HAL_ERROR;
}
@@ -218,20 +217,16 @@ HAL_StatusTypeDef Dallas_SensorInitByUserBytes(OneWire_t *onewire, DALLAS_Handle
* @details Ïîðÿäêîâûé íîìåð äàò÷èêà â ñïèñêå íàéäåííûõ.
* Ò.å. êàêèì ïî ñ÷åòó ýòîò äàò÷èê áûë íàéäåí
*/
HAL_StatusTypeDef Dallas_SensorInitByInd(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_SensorInitByInd(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(sensor == NULL)
return HAL_ERROR;
// sensor->onewire = onewire;
// sensor->sensROM = &DS.DevAddr[sensor->Init.SensInd];
// sensor->Init.init_func = (HAL_StatusTypeDef (*)())Dallas_SensorInitByInd;
result = Dallas_SensorInit(onewire, sensor, &DS.DevAddr[sensor->Init.SensInd]);
result = Dallas_SensorInit(hdallas, sensor, &DS.DevAddr[sensor->Init.InitParam]);
return result;
}
@@ -243,27 +238,27 @@ HAL_StatusTypeDef Dallas_SensorInitByInd(OneWire_t *onewire, DALLAS_HandleTypeDe
* @param ROM ROM äàò÷èêà, êîòîðûé íàäî èíèöèàëèçèðîâàòü
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_SensorInit(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor, uint8_t (*ROM)[DALLAS_ROM_SIZE])
HAL_StatusTypeDef Dallas_SensorInit(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor, uint8_t (*ROM)[DALLAS_ROM_SIZE])
{
HAL_StatusTypeDef result;
if(sensor == NULL)
return HAL_ERROR;
if(onewire == 0)
if(hdallas == 0)
return HAL_ERROR;
sensor->onewire = onewire;
sensor->hdallas = hdallas;
sensor->sensROM = 0;
sensor->sensROM = *(uint64_t *)(ROM);
// for(int i = 0; i < DALLAS_ROM_SIZE; i++)
// sensor->sensROM |= ((uint64_t)(*ROM)[i] << (56 - 8*i));
/* Ïðîâåðêà ïðèñóòñòâóåò ëè âûáðàííûé äàò÷èê íà ëèíèè */
result = DS18B20_ReadScratchpad(sensor->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->scratchpad);
result = DS18B20_ReadScratchpad(hdallas->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&hdallas->scratchpad);
if (result == HAL_OK)
{
/* Óñòàíîâêà ðàçðåøåíèÿ */
result = DS18B20_SetResolution(onewire, (uint8_t *)ROM, sensor->Init.Resolution);
result = DS18B20_SetResolution(hdallas->onewire, (uint8_t *)ROM, sensor->Init.Resolution);
if (result == HAL_OK)
{
sensor->isInitialized = 1;
@@ -289,14 +284,14 @@ HAL_StatusTypeDef Dallas_SensorInit(OneWire_t *onewire, DALLAS_HandleTypeDef *se
* @param sens_ind Ïîðÿäêîâûé íîìåð äàò÷èêà â ñòðóêòóðå
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_SensorDeInit(DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_SensorDeInit(DALLAS_SensorHandleTypeDef *sensor)
{
if(sensor == NULL)
return HAL_ERROR;
DALLAS_InitStructTypeDef initbuff = sensor->Init;
memset(sensor, 0, sizeof(DALLAS_HandleTypeDef));
memset(sensor, 0, sizeof(DALLAS_SensorHandleTypeDef));
sensor->Init = initbuff;
@@ -310,16 +305,16 @@ HAL_StatusTypeDef Dallas_SensorDeInit(DALLAS_HandleTypeDef *sensor)
* @param dallas_delay_ms Âðåìÿ îæèäàíèÿ îêîí÷àíèÿ êîíâåðñèè
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_StartConvertTAll(OneWire_t *onewire, DALLAS_WaitConvertionTypeDef waitCondition, uint8_t dallas_delay_ms)
HAL_StatusTypeDef Dallas_StartConvertTAll(DALLAS_HandleTypeDef *hdallas, DALLAS_WaitConvertionTypeDef waitCondition, uint8_t dallas_delay_ms)
{
HAL_StatusTypeDef result;
uint8_t rxDummyData;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
// Îòïðàâêà êîìàíäû íà÷àëà ïðåîáðàçîâàíèÿ òåìïåðàòóðû
result = DS18B20_StartConvTAll(onewire);
result = DS18B20_StartConvTAll(hdallas->onewire);
if(result != HAL_OK)
{
return result;
@@ -331,7 +326,7 @@ HAL_StatusTypeDef Dallas_StartConvertTAll(OneWire_t *onewire, DALLAS_WaitConvert
// Îæèäàíèå çàâåðøåíèÿ ïðåîáðàçîâàíèÿ, ïóòåì ïðîâåðêè øèíû
if (waitCondition == DALLAS_WAIT_BUS)
{
result = DS18B20_WaitForEndConvertion(onewire);
result = DS18B20_WaitForEndConvertion(hdallas->onewire);
return result;
}
@@ -374,7 +369,7 @@ HAL_StatusTypeDef Dallas_StartConvertTAll(OneWire_t *onewire, DALLAS_WaitConvert
* @param waitCondition Óñëîâèå îæèäàíèÿ çàâåðøåíèÿ ïðåîáðàçîâàíèÿ
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_ConvertT(DALLAS_HandleTypeDef *sensor, DALLAS_WaitConvertionTypeDef waitCondition)
HAL_StatusTypeDef Dallas_ConvertT(DALLAS_SensorHandleTypeDef *sensor, DALLAS_WaitConvertionTypeDef waitCondition)
{
HAL_StatusTypeDef result;
uint8_t rxDummyData;
@@ -390,7 +385,7 @@ HAL_StatusTypeDef Dallas_ConvertT(DALLAS_HandleTypeDef *sensor, DALLAS_WaitConve
return result;
// Îòïðàâêà êîìàíäû íà÷àëà ïðåîáðàçîâàíèÿ òåìïåðàòóðû
result = DS18B20_StartConvT(sensor->onewire, (uint8_t *)&sensor->sensROM);
result = DS18B20_StartConvT(sensor->hdallas->onewire, (uint8_t *)&sensor->sensROM);
if(result != HAL_OK)
{
return result;
@@ -399,7 +394,7 @@ HAL_StatusTypeDef Dallas_ConvertT(DALLAS_HandleTypeDef *sensor, DALLAS_WaitConve
// Îæèäàíèå çàâåðøåíèÿ ïðåîáðàçîâàíèÿ, ïóòåì ïðîâåðêè øèíû
if (waitCondition == DALLAS_WAIT_BUS)
{
result = DS18B20_WaitForEndConvertion(sensor->onewire);
result = DS18B20_WaitForEndConvertion(sensor->hdallas->onewire);
if(result == HAL_TIMEOUT)
{
sensor->f.timeout_convertion_cnt++;
@@ -412,7 +407,7 @@ HAL_StatusTypeDef Dallas_ConvertT(DALLAS_HandleTypeDef *sensor, DALLAS_WaitConve
{
uint32_t delayValueMs = 0;
switch (sensor->scratchpad.ConfigRegister)
switch (sensor->hdallas->scratchpad.ConfigRegister)
{
case DALLAS_CONFIG_9_BITS:
delayValueMs = DALLAS_DELAY_MS_9_BITS;
@@ -452,7 +447,7 @@ HAL_StatusTypeDef Dallas_ConvertT(DALLAS_HandleTypeDef *sensor, DALLAS_WaitConve
* @param sensor Óêàçàòåëü íà ñòðóêòóðó äàò÷èêà
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
@@ -467,7 +462,7 @@ HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_HandleTypeDef *sensor)
return result;
result = DS18B20_CalcTemperature(sensor->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->scratchpad, &sensor->temperature);
result = DS18B20_CalcTemperature(sensor->hdallas->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->hdallas->scratchpad, &sensor->temperature);
if (result != HAL_OK)
{
@@ -483,14 +478,14 @@ HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_HandleTypeDef *sensor)
* @param sensor Óêàçàòåëü íà ñòðóêòóðó äàò÷èêà
* @retval HAL Status
*/
HAL_StatusTypeDef Dallas_IsConnected(DALLAS_HandleTypeDef *sensor)
HAL_StatusTypeDef Dallas_IsConnected(DALLAS_SensorHandleTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(sensor->isInitialized == 0)
return HAL_ERROR;
result = DS18B20_ReadScratchpad(sensor->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->scratchpad);
result = DS18B20_ReadScratchpad(sensor->hdallas->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->hdallas->scratchpad);
if (result == HAL_OK)
{
@@ -522,7 +517,7 @@ HAL_StatusTypeDef Dallas_IsConnected(DALLAS_HandleTypeDef *sensor)
* @retval HAL Status
* @details ñòàðøèé áàéò - UserByte4/UserByte2, ìëàäøèé - UserByte3/UserByte1.
*/
HAL_StatusTypeDef Dallas_WriteUserBytes(DALLAS_HandleTypeDef *sensor, uint16_t UserBytes12, uint16_t UserBytes34, uint8_t UserBytesMask)
HAL_StatusTypeDef Dallas_WriteUserBytes(DALLAS_SensorHandleTypeDef *sensor, uint16_t UserBytes12, uint16_t UserBytes34, uint8_t UserBytesMask)
{
HAL_StatusTypeDef result;
@@ -534,13 +529,13 @@ HAL_StatusTypeDef Dallas_WriteUserBytes(DALLAS_HandleTypeDef *sensor, uint16_t U
if (result != HAL_OK)
return result;
result = DS18B20_WriteUserBytes(sensor->onewire, (uint8_t *)&sensor->sensROM, UserBytes12, UserBytes34, UserBytesMask);
result = DS18B20_WriteUserBytes(sensor->hdallas->onewire, (uint8_t *)&sensor->sensROM, UserBytes12, UserBytes34, UserBytesMask);
if (result != HAL_OK)
{
sensor->f.other_err_cnt++;
sensor->f.write_err_cnt++;
return result;
}
result = DS18B20_ReadScratchpad(sensor->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->scratchpad);
result = DS18B20_ReadScratchpad(sensor->hdallas->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->hdallas->scratchpad);
if (result != HAL_OK)
{
return result;

View File

@@ -61,24 +61,31 @@ typedef struct
/** @brief Структура флагов ошибок датчиков DALLAS */
typedef struct
{
unsigned disconnect_cnt; ///< Ñ÷åò÷èê îòêëþ÷åíèé äàò÷èêà
unsigned read_temperature_err_cnt; ///< Ñ÷åò÷èê îøèáîê ÷òåíèÿ òåìïåðàòóðû
unsigned timeout_convertion_cnt; ///< Ñ÷åò÷èê îøèáîê òàéìàóòà êîíâåðòàöèè
unsigned other_err_cnt; ///< Ñ÷åò÷èê äðóãèõ îøèáîê
uint8_t disconnect_cnt; ///< Ñ÷åò÷èê îòêëþ÷åíèé äàò÷èêà
uint8_t read_temperature_err_cnt; ///< Ñ÷åò÷èê îøèáîê ÷òåíèÿ òåìïåðàòóðû
uint8_t timeout_convertion_cnt; ///< Ñ÷åò÷èê îøèáîê òàéìàóòà êîíâåðòàöèè
uint8_t write_err_cnt; ///< Ñ÷åò÷èê äðóãèõ îøèáîê
}DALLAS_FlagsTypeDef;
/** @brief Структура инициализации датчика DALLAS */
typedef struct
typedef struct __packed
{
uint64_t ROM; ///< Óíèêàëüíûé ROM-êîä äàò÷èêà
uint16_t UserBytes12; ///< Ïîëüçîâàòåëüñêèå áàéòû 1 è 2
uint16_t UserBytes34; ///< Ïîëüçîâàòåëüñêèå áàéòû 3 è 4
uint8_t SensInd; ///< Èíäåêñ ñåíñîðà
uint64_t InitParam; ///< Ïàðàìåòð äëÿ èíèöèàëèçàöèè: ROM/UserBytes/Èíäåêñ
uint8_t Resolution; ///< Разрешение датчика
HAL_StatusTypeDef (*init_func)(); ///< Функция инициализации
} DALLAS_InitStructTypeDef;
/** @brief Còðóêòóðà îáðàáîò÷èêà DALLAS äëÿ îáùåíèÿ ñ äàò÷èêîì*/
typedef struct
{
OneWire_t *onewire;
DALLAS_ScratchpadTypeDef scratchpad;
}DALLAS_HandleTypeDef;
extern DALLAS_HandleTypeDef hdallas1;
/** @brief Основная структура обработчика датчика DALLAS */
typedef struct
{
@@ -86,16 +93,14 @@ typedef struct
unsigned isInitialized:1; ///< Флаг инициализации
unsigned isLost:1; ///< Флаг потери связи
OneWire_t *onewire; ///< Èíòåðôåéñ OneWire
DALLAS_HandleTypeDef *hdallas;
uint64_t sensROM; ///< ROM-код датчика
DALLAS_ScratchpadTypeDef scratchpad; ///< Scratchpad äàò÷èêà
float temperature; ///< Текущая температура
DALLAS_InitStructTypeDef Init; ///< Структура инициализации
DALLAS_FlagsTypeDef f; ///< Ôëàãè
} DALLAS_HandleTypeDef;
DALLAS_FlagsTypeDef f; ///< Ôëàãè
} DALLAS_SensorHandleTypeDef;
@@ -112,29 +117,29 @@ typedef enum
/* Functions ---------------------------------------------------------------*/
/* Функция для нахождения нового датчика на место потерянного */
HAL_StatusTypeDef Dallas_ReplaceLostedSensor(DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_ReplaceLostedSensor(DALLAS_SensorHandleTypeDef *sensor);
/* Функция для иниицализации нового датчика в структуре */
HAL_StatusTypeDef Dallas_AddNewSensors(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_AddNewSensors(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor);
/* Инициализирует структуру датчика по ROM */
HAL_StatusTypeDef Dallas_SensorInitByROM(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_SensorInitByROM(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor);
/* Инициализирует структуру датчика по пользовательским байтам */
HAL_StatusTypeDef Dallas_SensorInitByUserBytes(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_SensorInitByUserBytes(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor);
/* Инициализирует структуру датчика по порядковому номеру */
HAL_StatusTypeDef Dallas_SensorInitByInd(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_SensorInitByInd(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor);
/* Инициализирует датчик для работы */
HAL_StatusTypeDef Dallas_SensorInit(OneWire_t *onewire, DALLAS_HandleTypeDef *sensor, uint8_t (*ROM)[DALLAS_ROM_SIZE]);
HAL_StatusTypeDef Dallas_SensorInit(DALLAS_HandleTypeDef *hdallas, DALLAS_SensorHandleTypeDef *sensor, uint8_t (*ROM)[DALLAS_ROM_SIZE]);
/* Деинициализирует структуру датчика */
HAL_StatusTypeDef Dallas_SensorDeInit(DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_SensorDeInit(DALLAS_SensorHandleTypeDef *sensor);
/* Запускает измерение температуры на всех датчиках */
HAL_StatusTypeDef Dallas_StartConvertTAll(OneWire_t *onewire, DALLAS_WaitConvertionTypeDef waitCondition, uint8_t dallas_delay_ms);
HAL_StatusTypeDef Dallas_StartConvertTAll(DALLAS_HandleTypeDef *hdallas, DALLAS_WaitConvertionTypeDef waitCondition, uint8_t dallas_delay_ms);
/* Измеряет температуру на датчике */
HAL_StatusTypeDef Dallas_ConvertT(DALLAS_HandleTypeDef *sensor, DALLAS_WaitConvertionTypeDef waitCondition);
HAL_StatusTypeDef Dallas_ConvertT(DALLAS_SensorHandleTypeDef *sensor, DALLAS_WaitConvertionTypeDef waitCondition);
/* Читает измеренную датчиком температуру */
HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_SensorHandleTypeDef *sensor);
/* Проверяет подключен ли датчик (чтение scratchpad) */
HAL_StatusTypeDef Dallas_IsConnected(DALLAS_HandleTypeDef *sensor);
HAL_StatusTypeDef Dallas_IsConnected(DALLAS_SensorHandleTypeDef *sensor);
/* Записывает пользовательские байты */
HAL_StatusTypeDef Dallas_WriteUserBytes(DALLAS_HandleTypeDef *sensor, uint16_t UserBytes12, uint16_t UserBytes34, uint8_t UserBytesMask);
HAL_StatusTypeDef Dallas_WriteUserBytes(DALLAS_SensorHandleTypeDef *sensor, uint16_t UserBytes12, uint16_t UserBytes34, uint8_t UserBytesMask);
#endif // #ifndef DALLAS_TOOLS_H

View File

@@ -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

View File

@@ -26,7 +26,7 @@
#define DS_GPIO_Port GPIOB
/* Data Structure ------------------------------------------------------------*/
#define DS18B20_DEVICE_AMOUNT 8
#define DS18B20_DEVICE_AMOUNT 27
/* Register ------------------------------------------------------------------*/
#define DS18B20_CMD_CONVERT 0x44
@@ -77,8 +77,6 @@ typedef enum {
typedef struct
{
uint8_t DevAddr[DS18B20_DEVICE_AMOUNT][8];
uint8_t AlmAddr[DS18B20_DEVICE_AMOUNT][8];
float Temperature[DS18B20_DEVICE_AMOUNT];
DS18B20_Res_t Resolution;
} DS18B20_Drv_t;
extern DS18B20_Drv_t DS;

View File

@@ -8,30 +8,33 @@
/* Includes ----------------------------------------------------------------*/
#include "pch_sensors.h"
PCHSens_UnknownSensorsTypeDef UnknownSensors;
PCHSens_DallasBusHandle DallasBus;
PCHSens_SensorActionsTypeDef action;
/* Declarations and definitions --------------------------------------------*/
PCHSens_ModuleTypeDef module1;
PCHSens_ModuleTypeDef module2;
PCHSens_ModuleTypeDef module3;
PCHSens_ModuleTypeDef module4;
PCHSens_ModuleTypeDef module5;
PCHSens_ModuleTypeDef module6;
/* Functions ---------------------------------------------------------------*/
HAL_StatusTypeDef PCHSens_InitNewSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* sensor, uint64_t ROM)
HAL_StatusTypeDef PCHSens_InitNewSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor, uint64_t ROM)
{
DALLAS_HandleTypeDef tempsens;
DALLAS_SensorHandleTypeDef tempsens;
HAL_StatusTypeDef result;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(sensor == NULL)
return HAL_ERROR;
// sensor->UserBytes = (PCHSens_LocationTypeDef *)&sensor->sens.scratchpad.tHighRegister;
sensor->sens.Init.ROM = ROM;
sensor->sens.Init.UserBytes12 = sensor->Location.all;
sensor->sens.Init.InitParam = ROM;
sensor->sens.Init.init_func = &Dallas_SensorInitByROM;
result = Dallas_AddNewSensors(onewire, &sensor->sens);
result = Dallas_AddNewSensors(hdallas, &sensor->sens);
if(result != HAL_OK)
{
sensor->not_found = 1;
@@ -42,9 +45,10 @@ HAL_StatusTypeDef PCHSens_InitNewSensor(OneWire_t *onewire, PCHSens_SensorTypeDe
if(result != HAL_OK)
return result;
sensor->sens.Init.InitParam = sensor->Location.all;
sensor->sens.Init.init_func = &Dallas_SensorInitByUserBytes;
result = Dallas_AddNewSensors(onewire, &sensor->sens);
result = Dallas_AddNewSensors(hdallas, &sensor->sens);
if(result == HAL_OK)
{
sensor->not_found = 0;
@@ -60,21 +64,21 @@ HAL_StatusTypeDef PCHSens_InitNewSensor(OneWire_t *onewire, PCHSens_SensorTypeDe
HAL_StatusTypeDef PCHSens_AddSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* sensor)
HAL_StatusTypeDef PCHSens_AddSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor)
{
HAL_StatusTypeDef result;
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(sensor == NULL)
return HAL_ERROR;
// sensor->UserBytes = (PCHSens_LocationTypeDef *)&sensor->sens.scratchpad.tHighRegister;
sensor->sens.Init.UserBytes12 = sensor->Location.all;
sensor->sens.Init.InitParam = sensor->Location.all;
sensor->sens.Init.init_func = &Dallas_SensorInitByUserBytes;
result = Dallas_AddNewSensors(onewire, &sensor->sens);
result = Dallas_AddNewSensors(hdallas, &sensor->sens);
if(result == HAL_OK)
{
@@ -88,38 +92,36 @@ HAL_StatusTypeDef PCHSens_AddSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* s
return result;
}
HAL_StatusTypeDef PCHSens_InitModule(OneWire_t *onewire, PCHSens_ModuleTypeDef* module, uint16_t param)
HAL_StatusTypeDef PCHSens_InitModule(DALLAS_HandleTypeDef *hdallas, PCHSens_ModuleTypeDef* module, uint16_t param)
{
if(onewire == NULL)
if(hdallas == NULL)
return HAL_ERROR;
if(module == NULL)
return HAL_ERROR;
PCHSens_LocationTypeDef initlocation;
initlocation.all = param;
action.read = 1;
module->onewire = onewire;
module->hdallas = hdallas;
module->refLocation = initlocation;
module->sens1.Location.all = module->refLocation.all;
module->sens1.Location.param.Location = 0;
module->sens1.action.read = 1;
PCHSens_AddSensor(onewire, &module->sens1);
PCHSens_AddSensor(hdallas, &module->sens1);
module->sens2.Location.all = module->refLocation.all;
module->sens2.Location.param.Location = 1;
module->sens2.action.read = 1;
PCHSens_AddSensor(onewire, &module->sens2);
PCHSens_AddSensor(hdallas, &module->sens2);
module->sens3.Location.all = module->refLocation.all;
module->sens3.Location.param.Location = 2;
module->sens3.action.read = 1;
PCHSens_AddSensor(onewire, &module->sens3);
PCHSens_AddSensor(hdallas, &module->sens3);
module->sens4.Location.all = module->refLocation.all;
module->sens4.Location.param.Location = 3;
module->sens4.action.read = 1;
PCHSens_AddSensor(onewire, &module->sens4);
PCHSens_AddSensor(hdallas, &module->sens4);
return HAL_OK;
}
@@ -131,20 +133,18 @@ HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_ModuleTypeDef *module)
if(module == NULL)
return HAL_ERROR;
result = Dallas_StartConvertTAll(module->onewire, DALLAS_WAIT_BUS, 0);
result = PCHSens_SensorHandleActions(module->onewire, &module->sens1);
result = PCHSens_SensorHandleActions(module->onewire, &module->sens2);
result = PCHSens_SensorHandleActions(module->onewire, &module->sens3);
result = PCHSens_SensorHandleActions(module->onewire, &module->sens4);
PCHSens_DefineUnknownSensor(&UnknownSensors, NULL);
result = Dallas_StartConvertTAll(module->hdallas, DALLAS_WAIT_BUS, 0);
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens1);
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens2);
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens3);
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens4);
return result;
}
HAL_StatusTypeDef PCHSens_CheckSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* sensor)
HAL_StatusTypeDef PCHSens_CheckSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor)
{
HAL_StatusTypeDef result;
PCHSens_LocationTypeDef initlocation;
@@ -171,23 +171,19 @@ HAL_StatusTypeDef PCHSens_CheckSensor(OneWire_t *onewire, PCHSens_SensorTypeDef*
}
HAL_StatusTypeDef PCHSens_FindUnknownSensors(OneWire_t *onewire, PCHSens_UnknownSensorsTypeDef *unknowns)
HAL_StatusTypeDef PCHSens_FindUnknownSensors(PCHSens_DallasBusHandle *hbus)
{
HAL_StatusTypeDef result;
if(onewire == NULL)
return HAL_ERROR;
if(unknowns == NULL)
if(hbus == NULL)
return HAL_ERROR;
unknowns->onewire = onewire;
unknowns->UnknownCnt = 0;
DALLAS_ScratchpadTypeDef scratchpad;
hbus->UnknownCnt = 0;
PCHSens_LocationTypeDef *param = (PCHSens_LocationTypeDef *)&scratchpad.tHighRegister;
for(int i = 0; i < onewire->RomCnt; i++)
PCHSens_LocationTypeDef *param = (PCHSens_LocationTypeDef *)&hbus->hdallas->scratchpad.tHighRegister;
for(int i = 0; i < hbus->hdallas->onewire->RomCnt; i++)
{
/* Ïðîâåðêà ïðèñóòñòâóåò ëè âûáðàííûé äàò÷èê íà ëèíèè */
result = DS18B20_ReadScratchpad(onewire, (uint8_t *)&DS.DevAddr[i], (uint8_t *)&scratchpad);
result = DS18B20_ReadScratchpad(hbus->hdallas->onewire, (uint8_t *)&DS.DevAddr[i], (uint8_t *)&hbus->hdallas->scratchpad);
if(result != HAL_OK)
__NOP();
@@ -195,31 +191,32 @@ HAL_StatusTypeDef PCHSens_FindUnknownSensors(OneWire_t *onewire, PCHSens_Unknown
(IS_REG_PCH_LOCATION(param) == 0) ||
(IS_REG_PCH_NUMB(param) == 0) )
{
unknowns->unknown_sensors[unknowns->UnknownCnt].Init.SensInd = i;
unknowns->unknown_sensors[unknowns->UnknownCnt].Init.init_func = &Dallas_SensorInitByInd;
result = Dallas_AddNewSensors(onewire, &unknowns->unknown_sensors[unknowns->UnknownCnt++]);
// unknowns->unknown_sensors[unknowns->UnknownCnt].Init.InitParam = i;
// unknowns->unknown_sensors[unknowns->UnknownCnt].Init.init_func = &Dallas_SensorInitByInd;
// result = Dallas_AddNewSensors(hbus, &unknowns->unknown_sensors[unknowns->UnknownCnt]);
hbus->UnknownCnt++;
if(result != HAL_OK)
__NOP();
}
}
return HAL_OK;
}
HAL_StatusTypeDef PCHSens_DefineUnknownSensor(PCHSens_UnknownSensorsTypeDef *unknowns, PCHSens_SensorTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(sensor == NULL)
return HAL_ERROR;
if((unknowns->ROMtoDefine != NULL) && (unknowns->LocationtoDefine.all != NULL) && (unknowns->senstoDefine != NULL))
{
result = PCHSens_InitNewSensor(unknowns->onewire, unknowns->senstoDefine, unknowns->ROMtoDefine);
unknowns->ROMtoDefine = 0;
unknowns->LocationtoDefine.all = 0;
unknowns->senstoDefine = 0;
return result;
}
return HAL_OK;
}
//HAL_StatusTypeDef PCHSens_DefineUnknownSensor(PCHSens_UnknownSensorsTypeDef *unknowns, PCHSens_SensorTypeDef *sensor)
//{
// HAL_StatusTypeDef result;
// if(sensor == NULL)
// return HAL_ERROR;
//
// if((unknowns->ROMtoDefine != NULL) && (unknowns->LocationtoDefine.all != NULL) && (unknowns->senstoDefine != NULL))
// {
// result = PCHSens_InitNewSensor(unknowns->onewire, unknowns->senstoDefine, unknowns->ROMtoDefine);
// unknowns->ROMtoDefine = 0;
// unknowns->LocationtoDefine.all = 0;
// unknowns->senstoDefine = 0;
// return result;
// }
// return HAL_OK;
//}
HAL_StatusTypeDef PCHSens_UndefineSensor(PCHSens_SensorTypeDef *sensor)
{
@@ -237,28 +234,28 @@ HAL_StatusTypeDef PCHSens_UndefineSensor(PCHSens_SensorTypeDef *sensor)
return result;
}
HAL_StatusTypeDef PCHSens_SensorHandleActions(OneWire_t *onewire, PCHSens_SensorTypeDef *sensor)
HAL_StatusTypeDef PCHSens_SensorHandleActions(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef *sensor)
{
HAL_StatusTypeDef result;
if(sensor == NULL)
return HAL_ERROR;
if(sensor->action.connectROM != NULL)
if(action.connectROM != NULL)
{
result = PCHSens_InitNewSensor(onewire, sensor, sensor->action.connectROM);
sensor->action.connectROM = 0;
result = PCHSens_InitNewSensor(hdallas, sensor, action.connectROM);
action.connectROM = 0;
}
if(sensor->action.read != NULL)
if(action.read != NULL)
{
result = Dallas_ReadTemperature(&sensor->sens);
if(result != HAL_OK)
PCHSens_CheckSensor(onewire, sensor);
PCHSens_CheckSensor(hdallas, sensor);
}
if(sensor->action.deinit != NULL)
if(action.deinit != NULL)
{
sensor->action.deinit = 0;
action.deinit = 0;
result = PCHSens_UndefineSensor(sensor);
}
@@ -275,10 +272,11 @@ void PCHSens_FirstInit(void)
OneWire_Init(&OW);
DS18B20_Search(&DS, &OW);
PCHSens_InitModule(&OW, &module1, REG_PCH_NUMB_11|REG_PCH_DIODE_NUMB_1);
hdallas1.onewire = &OW;
PCHSens_InitModule(&hdallas1, &module1, REG_PCH_NUMB_11|REG_PCH_DIODE_NUMB_1);
PCHSens_FindUnknownSensors(&OW, &UnknownSensors);
PCHSens_DefineUnknownSensor(&UnknownSensors, NULL);
PCHSens_FindUnknownSensors(&DallasBus);
// PCHSens_DefineUnknownSensor(&UnknownSensors, NULL);
// Dallas_SensorInitByInd(&OW, &AllSens.outdoor, 0);
// Dallas_SensorInitByInd(&OW, &AllSens.indoor, 2);
// Dallas_SensorInitByInd(&OW, &AllSens.bathroom, 1);

View File

@@ -127,16 +127,14 @@ typedef struct
typedef struct
{
DALLAS_HandleTypeDef sens;
// PCHSens_LocationTypeDef *UserBytes;
DALLAS_SensorHandleTypeDef sens;
PCHSens_LocationTypeDef Location;
PCHSens_SensorActionsTypeDef action;
unsigned not_found:1;
}PCHSens_SensorTypeDef;
typedef struct
{
OneWire_t *onewire;
DALLAS_HandleTypeDef *hdallas;
PCHSens_SensorTypeDef sens1;
PCHSens_SensorTypeDef sens2;
@@ -147,27 +145,28 @@ typedef struct
}PCHSens_ModuleTypeDef;
extern PCHSens_ModuleTypeDef module1;
extern PCHSens_ModuleTypeDef module2;
extern PCHSens_ModuleTypeDef module3;
extern PCHSens_ModuleTypeDef module4;
extern PCHSens_ModuleTypeDef module5;
extern PCHSens_ModuleTypeDef module6;
typedef struct
{
OneWire_t *onewire;
DALLAS_HandleTypeDef unknown_sensors[DS18B20_DEVICE_AMOUNT];
uint8_t UnknownCnt;
uint64_t ROMtoDefine;
PCHSens_LocationTypeDef LocationtoDefine;
PCHSens_SensorTypeDef *senstoDefine;
}PCHSens_UnknownSensorsTypeDef;
DALLAS_HandleTypeDef *hdallas;
uint8_t UnknownCnt;
}PCHSens_DallasBusHandle;
extern PCHSens_DallasBusHandle DallasBus;
/* Functions ---------------------------------------------------------------*/
HAL_StatusTypeDef PCHSens_FindUnknownSensors(OneWire_t *onewire, PCHSens_UnknownSensorsTypeDef *unknowns);
HAL_StatusTypeDef PCHSens_InitNewSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* sensor, uint64_t ROM);
HAL_StatusTypeDef PCHSens_AddSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_InitModule(OneWire_t *onewire, PCHSens_ModuleTypeDef* module, uint16_t param);
HAL_StatusTypeDef PCHSens_InitNewSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor, uint64_t ROM);
HAL_StatusTypeDef PCHSens_AddSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_InitModule(DALLAS_HandleTypeDef *hdallas, PCHSens_ModuleTypeDef* module, uint16_t param);
HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_ModuleTypeDef *module);
HAL_StatusTypeDef PCHSens_CheckSensor(OneWire_t *onewire, PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_DefineUnknownSensor(PCHSens_UnknownSensorsTypeDef *unknowns, PCHSens_SensorTypeDef *sensor);
HAL_StatusTypeDef PCHSens_SensorHandleActions(OneWire_t *onewire, PCHSens_SensorTypeDef *sensor);
HAL_StatusTypeDef PCHSens_CheckSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_FindUnknownSensors(PCHSens_DallasBusHandle *hbus);
HAL_StatusTypeDef PCHSens_DefineUnknownSensor(PCHSens_DallasBusHandle *hbus, PCHSens_SensorTypeDef *sensor);
HAL_StatusTypeDef PCHSens_SensorHandleActions(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef *sensor);
void PCHSens_FirstInit(void);
#endif // #ifndef PCH_SENSORS_H