1,18 → 1,14 |
#define ONE_WIRE_PIN PIN_A3 // pro pristup k cidlu jsem zvolil |
|
void onewire_reset() |
|
|
|
{ |
output_low(ONE_WIRE_PIN); |
delay_us(500); |
delay_us(240); |
output_float(ONE_WIRE_PIN); |
delay_us(500); |
delay_us(150); |
output_float(ONE_WIRE_PIN); |
} |
|
|
void onewire_write(int data) |
{ |
int count; |
23,13 → 19,12 |
delay_us( 2 ); |
output_bit(ONE_WIRE_PIN, shift_right(&data,1,1)); |
|
delay_us( 60 ); |
delay_us( 40 ); |
output_float(ONE_WIRE_PIN); |
delay_us( 2 ); |
} |
} |
|
|
int onewire_read() |
{ |
int count, data; |
41,7 → 36,7 |
output_float(ONE_WIRE_PIN); |
delay_us( 8 ); |
shift_right(&data,1,input(ONE_WIRE_PIN)); |
delay_us( 120 ); |
delay_us(5); |
} |
|
return( data ); |