summaryrefslogtreecommitdiff
path: root/avr
diff options
context:
space:
mode:
Diffstat (limited to 'avr')
-rw-r--r--avr/1wire.c18
-rw-r--r--avr/main.c5
2 files changed, 15 insertions, 8 deletions
diff --git a/avr/1wire.c b/avr/1wire.c
index 5dbca82..affd80d 100644
--- a/avr/1wire.c
+++ b/avr/1wire.c
@@ -79,15 +79,20 @@ uint8_t w1_bit_io( uint8_t b )
_delay_us( 1 );
if( b )
{
- //hard_vcc;
- //asm volatile("nop" ::: );
+ hard_vcc;
+ _delay_us(7 );
soft_vcc;
+ _delay_us( 15 - 1 - 7 );
+ }
+ else
+ {
+ _delay_us( 15 - 1 );
}
- _delay_us( 15 - 1 );
if( (W1_IN & (1<<W1_PIN)) == 0 )
b = 0;
_delay_us( 60 - 15 );
- soft_vcc;
+ //soft_vcc;
+ hard_vcc;
sei();
return b;
}
@@ -104,6 +109,7 @@ uint8_t w1_byte_wr( uint8_t b )
b |= 0x80;
}
while( --i );
+ soft_vcc;
return b;
}
@@ -113,7 +119,7 @@ uint8_t w1_byte_rd( void )
return w1_byte_wr( 0xFF );
}
-
+/*
uint8_t w1_rom_search( uint8_t diff, uint8_t *id )
{
uint8_t i, j, next_diff;
@@ -158,7 +164,7 @@ uint8_t w1_rom_search( uint8_t diff, uint8_t *id )
}
while( i );
return next_diff; // to continue search
-}
+}*/
void ds1992_read(uint16_t addr, uint8_t* buf, uint8_t len)
{
diff --git a/avr/main.c b/avr/main.c
index 5c9742f..e1a4099 100644
--- a/avr/main.c
+++ b/avr/main.c
@@ -72,7 +72,8 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
case FUNC_WRITE:
PORTC ^= LED_RED;
//strcpy(replyBuffer, "Hello world");
- len = strlen(replyBuffer)+1;
+ //len = strlen(replyBuffer)+1;
+ len = 130;
break;
}
@@ -159,7 +160,7 @@ int main(void)
if (result == 0)
{
PORTC &= ~LED_GREEN;
- ds1992_read(0x00, replyBuffer, 128);
+ ds1992_read(42, replyBuffer, 128);
}
else if (result == 1)
PORTC &= ~LED_RED;