main/task_ds18b20.h

Tue, 08 Oct 2019 12:00:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 08 Oct 2019 12:00:31 +0200
changeset 0
88d965579617
child 2
c0184362d48c
permissions
-rw-r--r--

Initial import of the CO2 meter application.


/**
 * @file task_ds18b20.h
 * @brief The FreeRTOS task to query the DS18B20 sensors on one or two
 *        one-wire busses. Each bus must have only one sensor. That way
 *        we don't need to care about the DS18B20 internal ROM address.
 *        The task will update the DS18B20_State structure.
 */

#ifndef	_TASK_DS18B20_H
#define	_TASK_DS18B20_H

/*
 * Error codes in this task
 */
#define	DS18B20_ERR_NONE		0			///< No errors
#define DS18B20_ERR_NOSENSOR		1			///< No sensor detected
#define	DS18B20_ERR_TOOMANY		2			///< Too many sensors
#define	DS18B20_ERR_CRC			3			///< CRC read error
#define	DS18B20_ERR_READ		4			///< Generic read error


/**
 * @brief Structure containing the variables for the DS18B20 task.
 */
typedef struct {
    bool   bottle_valid;		///< Bottle sensor valid reading.
    double bottle_temperature;		///< Current bottle temperature.
    int    bottle_error;		///< Bottle error number.
} DS18B20_State;



/**
 * @brief Request a new measurement
 */
void request_ds18b20(void);


/**
 * @brief Measurement ready state
 * @return Returns true if the temperature measurements are ready
 */
bool ready_ds18b20(void);


/**
 * @brief The FreeRTOS task to update the DS18B20 temperature sensors on request.
 */
void task_ds18b20(void *);


#endif

mercurial