144 for (
i = 0;
i < 9;
i++)
160 mix = (crc ^ inbyte) & 0x01;
197 for (
i = 0;
i < 8;
i++)
235 for (
i = 0;
i < 9;
i++)
246 split_point = (split_point == 0x00)? 0xFF : split_point;
266 *(stack +
pos / 8) |= 0x01 << (
pos % 8);
273 *(stack +
pos / 8) |= 0x01 << (
pos % 8);
277 if (split_point == 0xFF ||
pos > split_point)
283 *(stack +
pos / 8) &= ~(0x01 << (
pos % 8));
287 else if (
pos == split_point)
293 *(stack +
pos / 8) |= 0x01 << (
pos % 8);
303 while (split_point > 0 && *(stack + split_point / 8) >> (split_point % 8) & 0x01 == 0x01) split_point--;
void SYS_Delay(uint16_t t)
void SYS_DelayUs(uint16_t t)
void DS18B20_WriteByte(uint8_t byte)
Write one byte to DS18B20.
void DS18B20_ReadScratchpadFromAddr(const uint8_t *addr, uint8_t *buf)
Read SRAM scratchpad from selected slave.
uint8_t DS18B20_Crc(uint8_t *addr, uint8_t len)
8-bit CRC calculation
uint8_t DS18B20_ReadByte(void)
Read one byte from DS18B20.
__BIT DS18B20_ReadBit(void)
Read one bit from DS18B20.
void DS18B20_StartAll(void)
Start conversion on all slaves.
void DS18B20_WriteBit(__BIT b)
Write one bit to DS18B20.
void DS18B20_ReadRom(uint8_t *buf)
Read 64-bit ROM: 8-bit family code "0x28", unique 48-bit serial number, 8-bit CRC.
void DS18B20_ReadScratchpad(uint8_t *buf)
Read SRAM scratchpad.
void DS18B20_Init(void)
Initialize DS18B20.
void DS18B20_Select(const uint8_t *addr)
Select a slave on the bus.
uint8_t DS18B20_Search(uint8_t *buff, uint8_t *stack, uint8_t split_point)
Perform one ROM search.
__BIT DS18B20_AllDone(void)
If read bit is low, then device is not finished yet with calculation temperature.
__BIT DS18B20_Reset(void)
Reset DS18B20.
void DS18B20_Start(const uint8_t *addr)
Start conversion on selected slave.
#define ONEWIRE_CMD_SEARCHROM
#define DS18B20_DQ_INPUT()
#define ONEWIRE_CMD_SKIPROM
#define DS18B20_CMD_CONVERTTEMP
#define DS18B20_DQ_PULLUP()
#define ONEWIRE_CMD_READROM
#define DS18B20_DQ_OUTPUT()
#define ONEWIRE_CMD_MATCHROM
#define ONEWIRE_CMD_RSCRATCHPAD