Embedded Artistry C Interfaces
A reference collection of abstract interfaces in C.
temperature_sensor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2022 Embedded Artistry LLC <contact@embeddedartistry.com>
2// SPDX-License-Identifier: MIT
3
4#include <stdbool.h>
5#include <stdint.h>
6
40#pragma mark - Basic Interface -
41
62typedef struct
63{
78 bool (*readTemperature)(int16_t* const temperature);
80
81#pragma mark - With Callback Support -
82
98typedef void (*NewTemperatureSampleCb)(int16_t temperature);
99
113typedef void (*TemperatureErrorCb)(void);
114
144typedef struct
145{
173 bool (*readTemperature)(int16_t* const temperature);
174
186 void (*registerNewSampleCb)(const NewTemperatureSampleCb callback);
187
199 void (*unregisterNewSampleCb)(const NewTemperatureSampleCb callback);
200
212 void (*registerErrorCb)(const TemperatureErrorCb callback);
213
225 void (*unregisterErrorCb)(const TemperatureErrorCb callback);
Virtual Temperature Sensor Interface with Callback Support.
Virtual Temperature Sensor Interface.
void(* TemperatureErrorCb)(void)
Callback function prototype for temperature sensor errors.
void(* NewTemperatureSampleCb)(int16_t temperature)
Callback function prototype for processing new temperature samples.