From 345d16b542a6d7bd8f048125915b13666bfca3e9 Mon Sep 17 00:00:00 2001 From: smallsolar Date: Sat, 19 Apr 2025 16:43:02 +0000 Subject: [PATCH] Update readme.MD Added example code (will obviously need to setup timers etc. --- readme.MD | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/readme.MD b/readme.MD index 6d03c4c..9b6bdf4 100644 --- a/readme.MD +++ b/readme.MD @@ -8,6 +8,17 @@ A simple driver written for libopencm3 and stm32f0, it was written from first pr * 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