60 #define ONEWIRE_BIT PA0
61 #define ONEWIRE_PIN PINA
62 #define ONEWIRE_PORT PORTA
63 #define ONEWIRE_DDR DDRA
70 #define ONEWIRE_STRONG_PU_ON ONEWIRE_PORT |= ONEWIRE_MASK; ONEWIRE_DDR |= ONEWIRE_MASK;
71 #define ONEWIRE_STRONG_PU_OFF ONEWIRE_DDR &= ~ONEWIRE_MASK;
78 #define ONEWIRE_MASK (1<<ONEWIRE_BIT)
85 #define ONEWIRE_MATCH_ROM 0x55
86 #define ONEWIRE_SEARCH_ROM 0xF0
87 #define ONEWIRE_SKIP_ROM 0xCC
88 #define ONEWIRE_READ_ROM 0x33
89 #define ONEWIRE_ALARM_SEARCH 0xEC
96 #define ONEWIRE_OK 0 // no error
97 #define ONEWIRE_NO_PRESENCE 1 // no presence pulse detected during onewire reset
98 #define ONEWIRE_CRC_ERROR 2 // crc error in data reception
99 #define ONEWIRE_SCAN_ERROR 3 // scan error during ROM scan
100 #define ONEWIRE_LAST_CODE 4 // last rom code scanned (no error, just info)
101 #define ONEWIRE_GND_SHORT 5 // bus short circuit to GND
221 uint8_t
onewire_crc(
const uint8_t *data, uint8_t cnt);
uint8_t onewire_reset(void)
OneWire reset.
uint8_t onewire_match_rom(const uint8_t rom[8])
select device on bus
void onewire_write_byte(uint8_t data)
write one byte
uint8_t onewire_read_rom(uint8_t rom[8])
read ROM ID of device
void onewire_search_init(uint8_t buffer[8])
init rom search buffer and internal variables
uint8_t onewire_crc(const uint8_t *data, uint8_t cnt)
calculate CRC over data array, fast version, 0.3ms for 8 bytes @1MHz
void onewire_write_bit(uint8_t data)
write one bit to bus
uint8_t onewire_search(uint8_t buffer[8], uint8_t cmd)
scan OneWire bus for normal ROM or alarm search
uint8_t onewire_skip_rom(void)
select device on bus
uint8_t onewire_read_bit(void)
read one bit from bus
uint8_t onewire_read_byte(void)
read one byte
uint8_t onewire_alarm_search(uint8_t buffer[8])
scan OneWire bus for devices with active alarm flag
uint8_t onewire_search_rom(uint8_t buffer[8])
scan OneWire bus for ROMs