00001 /******************************************************************************/ 00013 #ifndef W1_H_ 00014 #define W1_H_ 00015 00016 // \cond 00017 #include <inttypes.h> 00018 00019 #define W1_ANY_FAMILY 0x00 00020 #define DS2411 0x01 00021 00022 // w1 status 00023 typedef enum 00024 { 00025 W1_NO_DEVICE_STATUS, // There is no device on the bus 00026 W1_SUCCESS_STATUS, // At least one device is on the bus 00027 W1_INVALID_CRC // Invalid CRC was read during the device search operation 00028 } W1Status_t; 00029 // \endcond 00030 00031 /*************************************************************************/ 00050 W1Status_t HAL_SearchW1Device(uint8_t family, 00051 uint8_t *data, 00052 uint8_t count, 00053 uint8_t *actCount); 00054 00055 /**************************************************************************/ 00073 W1Status_t HAL_AlarmSearchW1Device(uint8_t family, 00074 uint8_t *data, 00075 uint8_t count, 00076 uint8_t *actCount); 00077 00078 /***************************************************************************/ 00084 uint8_t HAL_ResetW1(void); 00085 00086 /***************************************************************************/ 00091 void HAL_WriteW1(uint8_t value); 00092 00093 /***************************************************************************/ 00098 uint8_t HAL_ReadW1(void); 00099 00100 // \cond 00101 /**************************************************************************** 00102 Calculating 1-Wire 8-bit CRC 00103 Parameters: 00104 data - data buffer pointer. 00105 length - data length. 00106 Returns: 00107 CRC value based on polynomial x<sup>8</sup> + x<sup>5</sup> + x<sup>4</sup> + 1 00108 ******************************************************************************/ 00109 uint8_t halW1CRC(uint8_t *data, uint8_t length); 00110 // \endcond 00111 00112 #endif /* W1_H_ */ 00113 // eof w1.h