# DS18B20 for the STM32F0 using libopencm3 ## Introduction A simple driver written for libopencm3 and stm32f0, it was written from first principles and uses a GPIO to read and write bits to the DS18b20. ## Limitations: * It ignores the ROM Search therefore can only have a single ds18b20 sensor on each bus (but you can use multiple buses) * It uses `NOP` for some of its timing which is probably not ideal * The timings are rough, it could need some optimisation (but works with the fake ds18b20s I have.) ## Example Usage ``` #include "ds18b20.h" //Get Data from DS18b20 Sensor 1 ds18b20_start_conversion(GPIOB, GPIO1); // Wait for conversion to complete delay_ms(750); int16_t ds_temp = ds18b20_read_raw_temperature(GPIOB, GPIO1); ``` ## References * https://teslabs.com/openplayer/docs/docs/other/ds18b20_pre1.pdf * https://www.circuitbread.com/tutorials/embedded-c-programming-with-the-pic18f14k50-12-digital-thermometer * https://www.analog.com/media/en/technical-documentation/data-sheets/DS18B20.pdf * https://www.st.com/en/microcontrollers-microprocessors/stm32f030k6.html * http://libopencm3.org/docs/latest/stm32f0/html/group__gpio__file.html#ga8970f778a63c9d78ffd8d4d36628c7e1