Common IO - basic v1.0.0
Common IO - basic v1.0.0 Library
 
Loading...
Searching...
No Matches
iot_tsensor.h
Go to the documentation of this file.
1/*
2 * Common IO - basic V1.0.0
3 * Copyright (C) 2020 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 )
55typedef enum
56{
60
64typedef enum
65{
72
76struct IotTsensorDescriptor;
77
83typedef struct IotTsensorDescriptor * IotTsensorHandle_t;
84
91typedef void ( * IotTsensorCallback_t)( IotTsensorStatus_t xStatus,
92 void * pvUserContext );
93
109IotTsensorHandle_t iot_tsensor_open( int32_t lTsensorInstance );
110
127 IotTsensorCallback_t xCallback,
128 void * pvUserContext );
129
141int32_t iot_tsensor_enable( IotTsensorHandle_t const xTsensorHandle );
142
154int32_t iot_tsensor_disable( IotTsensorHandle_t const xTsensorHandle );
155
172int32_t iot_tsensor_get_temp( IotTsensorHandle_t const xTsensorHandle,
173 int32_t * plTemp );
174
199int32_t iot_tsensor_ioctl( IotTsensorHandle_t const xTsensorHandle,
201 void * const pvBuffer );
202
215int32_t iot_tsensor_close( IotTsensorHandle_t const xTsensorHandle );
216
217
221/* end of group iot_tsensor */
222
223#endif /* ifndef _IOT_TSENSOR_H_ */
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...
int32_t iot_tsensor_close(IotTsensorHandle_t const xTsensorHandle)
iot_tsensor_close is used to de-initialize Tsensor.
IotTsensorStatus_t
tsensor threshold reached status
Definition: iot_tsensor.h:56
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...
int32_t iot_tsensor_disable(IotTsensorHandle_t const xTsensorHandle)
iot_tsensor_disable is used to disable the temperature sensor which stops monitoring the temperature.
struct IotTsensorDescriptor * IotTsensorHandle_t
IotTsensorHandle_t type is the tsensor handle returned by calling iot_tsensor_open() this is initiali...
Definition: iot_tsensor.h:83
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_get_temp(IotTsensorHandle_t const xTsensorHandle, int32_t *plTemp)
iot_tsensor_get_temp is used to get the current temperature read from the sensor.
IotTsensorIoctlRequest_t
Ioctl request types.
Definition: iot_tsensor.h:65
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,...
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,...
@ eTsensorMaxThresholdReached
Definition: iot_tsensor.h:58
@ eTsensorMinThresholdReached
Definition: iot_tsensor.h:57
@ eTsensorSetMinThreshold
Definition: iot_tsensor.h:66
@ eTsensorSetMaxThreshold
Definition: iot_tsensor.h:67
@ eTsensorGetMinThreshold
Definition: iot_tsensor.h:68
@ eTsensorPerformCalibration
Definition: iot_tsensor.h:70
@ eTsensorGetMaxThreshold
Definition: iot_tsensor.h:69