FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_tsensor.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS Common IO V1.0.0
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
31 #ifndef _IOT_TSENSOR_H_
32 #define _IOT_TSENSOR_H_
33 
39 #include <stdint.h>
40 
44 #define IOT_TSENSOR_SUCCESS ( 0 )
45 #define IOT_TSENSOR_INVALID_VALUE ( 1 )
46 #define IOT_TSENSOR_DISABLED ( 2 )
47 #define IOT_TSENSOR_CLOSED ( 3 )
48 #define IOT_TSENSOR_GET_TEMP_FAILED ( 4 )
49 #define IOT_TSENSOR_SET_FAILED ( 5 )
50 #define IOT_TSENSOR_NOT_SUPPORTED ( 6 )
55 typedef enum
56 {
60 
64 typedef enum
65 {
72 
76 struct IotTsensorDescriptor_t;
77 
83 typedef struct IotTsensorDescriptor_t * IotTsensorHandle_t;
84 
91 typedef void( * IotTsensorCallback_t)(IotTsensorStatus_t xStatus, void * pvUserContext);
92 
108 IotTsensorHandle_t iot_tsensor_open(int32_t lTsensorInstance);
109 
125 void iot_tsensor_set_callback(IotTsensorHandle_t const xTsensorHandle,
126  IotTsensorCallback_t xCallback,
127  void * pvUserContext);
128 
140 int32_t iot_tsensor_enable(IotTsensorHandle_t const xTsensorHandle);
141 
153 int32_t iot_tsensor_disable(IotTsensorHandle_t const xTsensorHandle);
154 
171 int32_t iot_tsensor_get_temp(IotTsensorHandle_t const xTsensorHandle,
172  int32_t * plTemp);
173 
198 int32_t iot_tsensor_ioctl(IotTsensorHandle_t const xTsensorHandle,
199  IotTsensorIoctlRequest_t xRequest,
200  void * const pvBuffer);
201 
214 int32_t iot_tsensor_close( IotTsensorHandle_t const xTsensorHandle);
215 
216 
220 // end of group iot_tsensor
221 
222 #endif /* ifndef _IOT_TSENSOR_H_ */
Definition: iot_tsensor.h:57
int32_t iot_tsensor_close(IotTsensorHandle_t const xTsensorHandle)
iot_tsensor_close is used to de-initialize Tsensor.
IotTsensorIoctlRequest_t
Ioctl request types.
Definition: iot_tsensor.h:64
IotTsensorHandle_t iot_tsensor_open(int32_t lTsensorInstance)
iot_tsensor_open is used to initialize the temperature sensor. It sets up the clocks and power etc...
Definition: iot_tsensor.h:70
Definition: iot_tsensor.h:66
int32_t iot_tsensor_ioctl(IotTsensorHandle_t const xTsensorHandle, IotTsensorIoctlRequest_t xRequest, void *const pvBuffer)
iot_tsensor_ioctl is used to set tsensor configuration and tsensor properties like minimum threshold...
IotTsensorStatus_t
tsensor threshold reached status
Definition: iot_tsensor.h:55
Definition: iot_tsensor.h:69
void iot_tsensor_set_callback(IotTsensorHandle_t const xTsensorHandle, IotTsensorCallback_t xCallback, void *pvUserContext)
Set the callback to be called when a threshold is reached on the sensor. The caller must set the thre...
Definition: iot_tsensor.h:58
Definition: iot_tsensor.h:67
void(* IotTsensorCallback_t)(IotTsensorStatus_t xStatus, void *pvUserContext)
The callback function for completion of Tsensor operation.
Definition: iot_tsensor.h:91
int32_t iot_tsensor_enable(IotTsensorHandle_t const xTsensorHandle)
iot_tsensor_enable is used to enable the temperature sensor to start reading the temperature and trig...
Definition: iot_tsensor.h:68
struct IotTsensorDescriptor_t * IotTsensorHandle_t
IotTsensorHandle_t type is the tsensor handle returned by calling iot_tsensor_open() this is initiali...
Definition: iot_tsensor.h:83
int32_t iot_tsensor_disable(IotTsensorHandle_t const xTsensorHandle)
iot_tsensor_disable is used to disable the temperature sensor which stops monitoring the temperature...
int32_t iot_tsensor_get_temp(IotTsensorHandle_t const xTsensorHandle, int32_t *plTemp)
iot_tsensor_get_temp is used to get the current temperature read from the sensor. ...