2.3.1 Polled Example
The code example for the polled drivers will search the buses defined by “BUSES” for devices. The devices are stored in an array of type OWI_device. OWI_device is a struct containing information about what bus a device is connected to and its 64-bit identifier. The driver then searches through the available slave devices for a DS1820 temperature sensor on PORTD0. If the device is found on the bus, it will constantly be negotiated in an eternal loop. In each iteration, the temperature of the DS1820 is polled, and the temperature is output to PORTB, so it can be observed, for instance, on the LEDs of an STK®600 development board.
This code example is intended to show how the different parts of the driver can be used. The code is very general, and not optimized for the objective. Note that because of this, the code example will not fit on a device with less than 4 KB of program memory. The driver is, however, fully compatible with all AVR microcontrollers, including 1 KB devices.