TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
tm_stm32f4_am2301.h
1 
30 #ifndef TM_AM2301_H
31 #define TM_AM2301_H 130
32 
33 /* C++ detection */
34 #ifdef __cplusplus
35 extern C {
36 #endif
37 
114 #include "stm32f4xx.h"
115 #include "defines.h"
116 #include "tm_stm32f4_delay.h"
117 #include "tm_stm32f4_gpio.h"
118 
128 #ifndef AM2301_PIN
129 #define AM2301_PORT GPIOD
130 #define AM2301_PIN GPIO_PIN_1
131 #endif
132 
133 /* Pin settings */
134 #define AM2301_PIN_LOW TM_GPIO_SetPinLow(AM2301_PORT, AM2301_PIN)
135 #define AM2301_PIN_HIGH TM_GPIO_SetPinHigh(AM2301_PORT, AM2301_PIN)
136 #define AM2301_PIN_IN TM_GPIO_SetPinAsInput(AM2301_PORT, AM2301_PIN)
137 #define AM2301_PIN_OUT TM_GPIO_SetPinAsOutput(AM2301_PORT, AM2301_PIN)
138 #define AM2301_PIN_READ TM_GPIO_GetInputPinValue(AM2301_PORT, AM2301_PIN)
139 
156 typedef enum {
165 } TM_AM2301_t;
166 
170 typedef struct {
171  int16_t Temp;
173  uint16_t Hum;
176 
193 
202 
215 /* C++ detection */
216 #ifdef __cplusplus
217 }
218 #endif
219 
220 
221 #endif
222 
TM_AM2301_t TM_AM2301_Read(TM_AM2301_Data_t *data)
Reads data from sensor.
Definition: tm_stm32f4_am2301.h:157
Definition: tm_stm32f4_am2301.h:158
Definition: tm_stm32f4_am2301.h:161
AM2301 main data structure.
Definition: tm_stm32f4_am2301.h:170
Definition: tm_stm32f4_am2301.h:163
int16_t Temp
Definition: tm_stm32f4_am2301.h:171
uint16_t Hum
Definition: tm_stm32f4_am2301.h:173
Definition: tm_stm32f4_am2301.h:160
TM_AM2301_t TM_AM2301_Init(void)
Initializes AM2301 sensor.
Definition: tm_stm32f4_am2301.h:162
TM_AM2301_t
Definition: tm_stm32f4_am2301.h:156
Definition: tm_stm32f4_am2301.h:164
Definition: tm_stm32f4_am2301.h:159