esp32-warm-water
esp32 based project for the control of a heating element based on temperature
Macros | Functions | Variables
ds18b20_wrapper.c File Reference

implementation for wrapper component to help setup and interface with temp sensor More...

#include <stdbool.h>
#include "ds18b20_wrapper.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_log.h"
#include "owb.h"
#include "ds18b20.h"
Include dependency graph for ds18b20_wrapper.c:

Go to the source code of this file.

Macros

#define GPIO_DS18B20_0   (CONFIG_TEMP_OWB_GPIO)
 the gpio pin to search for sensors on More...
 
#define MAX_DEVICES   (CONFIG_TEMP_MAX_DEVS)
 maximum number of devices to search for More...
 
#define DS18B20_RESOLUTION   (DS18B20_RESOLUTION_12_BIT)
 the resolution of the temp sensor More...
 

Functions

int ds18b20_wrapped_init (void)
 init the sensor intitialises the onewire bus and finds and intialises ds18b20 sensors along the pin More...
 
void ds18b20_wrapped_deinit (void)
 deinit the sensor cleans up and frees all of the devices and the onewire bus More...
 
void ds18b20_wrapped_read (void)
 print the temps runs conversion on all the owb devices, waits for the conversion and then prints out the results when it receives them More...
 
void ds18b20_wrapped_capture (float *results, int size)
 capture temps to results this function runs conversion on all the owb devices, waits for conversion to finish and then reads the temperatures into the provided results array More...
 

Variables

OneWireBusowb
 onewire bus pointer More...
 
int num_devices = 0
 current number of devices found More...
 
DS18B20_Infodevices [MAX_DEVICES] = {0}
 list of devices More...
 
owb_rmt_driver_info rmt_driver_info
 the rmt driver info for communicating over the owb More...
 

Detailed Description

implementation for wrapper component to help setup and interface with temp sensor

Definition in file ds18b20_wrapper.c.

Macro Definition Documentation

◆ DS18B20_RESOLUTION

the resolution of the temp sensor

Definition at line 48 of file ds18b20_wrapper.c.

◆ GPIO_DS18B20_0

#define GPIO_DS18B20_0   (CONFIG_TEMP_OWB_GPIO)

the gpio pin to search for sensors on

Definition at line 46 of file ds18b20_wrapper.c.

◆ MAX_DEVICES

#define MAX_DEVICES   (CONFIG_TEMP_MAX_DEVS)

maximum number of devices to search for

Definition at line 47 of file ds18b20_wrapper.c.

Function Documentation

◆ ds18b20_wrapped_capture()

void ds18b20_wrapped_capture ( float *  results,
int  size 
)

capture temps to results this function runs conversion on all the owb devices, waits for conversion to finish and then reads the temperatures into the provided results array

Parameters
[in]resultsa pointer to the array to capture results to
[out]resultsthe array pointer that has been populated with data
sizethe number of devices found and the size of the results array

Definition at line 248 of file ds18b20_wrapper.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ds18b20_wrapped_deinit()

void ds18b20_wrapped_deinit ( void  )

deinit the sensor cleans up and frees all of the devices and the onewire bus

Definition at line 174 of file ds18b20_wrapper.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ds18b20_wrapped_init()

int ds18b20_wrapped_init ( void  )

init the sensor intitialises the onewire bus and finds and intialises ds18b20 sensors along the pin

Returns
the number of devices it found on the bus as an int

Definition at line 61 of file ds18b20_wrapper.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ds18b20_wrapped_read()

void ds18b20_wrapped_read ( void  )

print the temps runs conversion on all the owb devices, waits for the conversion and then prints out the results when it receives them

Definition at line 195 of file ds18b20_wrapper.c.

Here is the call graph for this function:

Variable Documentation

◆ devices

DS18B20_Info* devices[MAX_DEVICES] = {0}

list of devices

Definition at line 52 of file ds18b20_wrapper.c.

◆ num_devices

int num_devices = 0

current number of devices found

Definition at line 51 of file ds18b20_wrapper.c.

◆ owb

OneWireBus* owb

onewire bus pointer

Definition at line 50 of file ds18b20_wrapper.c.

◆ rmt_driver_info

owb_rmt_driver_info rmt_driver_info

the rmt driver info for communicating over the owb

Definition at line 53 of file ds18b20_wrapper.c.