summaryrefslogtreecommitdiff
path: root/usb-1wire
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-08-03 15:47:02 +0000
committerChristian Pointner <equinox@spreadspace.org>2013-08-03 15:47:02 +0000
commit7d8e2b9e783f766abc5ce747e896e6a8ab83f84e (patch)
tree0eb53dc6a4bf6f9c288dc12ea7be3a2218e00ded /usb-1wire
parentupdated svn:ignore for usb-1wire (diff)
whitespace cleanups
git-svn-id: https://svn.spreadspace.org/avr/trunk@213 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'usb-1wire')
-rw-r--r--usb-1wire/usb-1wire.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/usb-1wire/usb-1wire.c b/usb-1wire/usb-1wire.c
index 6fed4f5..4480a0a 100644
--- a/usb-1wire/usb-1wire.c
+++ b/usb-1wire/usb-1wire.c
@@ -51,10 +51,10 @@ void discoverOWIBus(void)
printf(" !something is there! ");
owi_reset_search();
_delay_ms(250);
-
+
//Search only for DS1820 temp sensors
owi_target_search(DS1820_FAMILY_ID);
-
+
while ( owi_search(owi_addr_[ d ]))
{
d++;
@@ -66,7 +66,7 @@ void discoverOWIBus(void)
num_owi_dev_found_ = d;
printf(" done \r\n");
printf("%d devices found\r\n", d);
-
+
for (d=0; d<num_owi_dev_found_; d++)
{
printf("OW Dev #%d: addr = ", d);
@@ -75,13 +75,13 @@ void discoverOWIBus(void)
if (owi_crc8(owi_addr_[d], 7) == owi_addr_[d][7])
printf(" CRC OK");
else
- printf(" CRC ERROR");
+ printf(" CRC ERROR");
printf("\r\n");
}
led_off();
}
-void tempToUSB(uint8_t resolution)
+void tempToUSB(uint8_t resolution)
{
uint8_t data[9];
int16_t celsius = 0;
@@ -90,7 +90,7 @@ void tempToUSB(uint8_t resolution)
uint8_t d=0;
uint8_t cfg_res=12;
uint8_t crc_result = 0;
-
+
led_on();
owi_reset();
@@ -99,7 +99,7 @@ void tempToUSB(uint8_t resolution)
for (d=0; d<num_owi_dev_found_; d++)
{
owi_select(owi_addr_[d]);
-
+
owi_write(DS1820_WRITE_SCRATCHPAD, 0);
owi_write(0xFF, 0);
owi_write(0x7F, 0);
@@ -109,19 +109,19 @@ void tempToUSB(uint8_t resolution)
owi_write(DS1820_START_CONVERSION, 0);
}
- switch (resolution)
+ switch (resolution)
{
case DS1820_RESOLUTION_9BITS: _delay_ms(DS1820_TCONV_MS_9BITS); break;
case DS1820_RESOLUTION_10BITS: _delay_ms(DS1820_TCONV_MS_10BITS); break;
case DS1820_RESOLUTION_11BITS: _delay_ms(DS1820_TCONV_MS_11BITS); break;
default: _delay_ms(DS1820_TCONV_MS_12BITS); break;
}
-
+
if (owi_reset()) //reset is needed
printf("Sensor present\r\n");
else
- printf("Sensor NOT present\r\n");
-
+ printf("Sensor NOT present\r\n");
+
for (d=0; d<num_owi_dev_found_; d++)
{
owi_select(owi_addr_[d]);
@@ -135,7 +135,7 @@ void tempToUSB(uint8_t resolution)
printf(" crc: %x is %s\r\n" , crc_result, (crc_result == data[8])? "OK": "ERRORENOUS");
// the first ROM byte indicates which chip
- switch (owi_addr_[d][0])
+ switch (owi_addr_[d][0])
{
case 0x10:
//~ Serial.println(" Chip = DS18S20"); // or old DS1820
@@ -151,8 +151,8 @@ void tempToUSB(uint8_t resolution)
break;
default:
continue;
- }
-
+ }
+
// Convert the data to actual temperature
// because the result is a 16 bit signed integer, it should
// be stored to an "int16_t" type, which is always 16 bits
@@ -186,7 +186,7 @@ void tempToUSB(uint8_t resolution)
//// default is 12 bit resolution, 750 ms conversion time
}
celsius = raw / 16;
-
+
printf("Temperature: raw %d, celsius: %d, resolution: %d bits\r\n", raw, celsius, cfg_res);
}
led_off();
@@ -219,10 +219,10 @@ int main(void)
DDRC &= ~7;
owi_init(7, &PINC);
- for(;;)
+ for(;;)
{
int16_t BytesReceived = usbio_bytes_received();
- while(BytesReceived > 0)
+ while(BytesReceived > 0)
{
int ReceivedByte = fgetc(stdin);
if(ReceivedByte != EOF) {