Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "std.h"
#include "mcu_periph/gpio.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "subsystems/datalink/downlink.h"
#include "humid_sht.h"
Go to the source code of this file.
Macros | |
#define | noACK 0 |
#define | ACK 1 |
#define | TEMP 0 |
#define | HUMI 1 |
#define | STATUS_REG_W 0x06 |
#define | STATUS_REG_R 0x07 |
#define | MEASURE_TEMP 0x03 |
#define | MEASURE_HUMI 0x05 |
#define | RESET 0x1e |
#define | SHT_IDLE 0 |
#define | SHT_MEASURING_HUMID 1 |
#define | SHT_MEASURING_TEMP 2 |
#define | DATA_SET gpio_setup_input(SHT_DAT_GPIO) |
set data pin to input More... | |
#define | DATA_CLR gpio_setup_output(SHT_DAT_GPIO) |
set data pin to output More... | |
#define | DATA_IN gpio_get(SHT_DAT_GPIO) |
get data pin More... | |
#define | SCK_SET gpio_set(SHT_SCK_GPIO) |
set clock pin to high More... | |
#define | SCK_CLR gpio_clear(SHT_SCK_GPIO) |
set clock pin to low More... | |
Functions | |
uint8_t | s_write_byte (uint8_t value) |
uint8_t | s_read_byte (uint8_t ack) |
void | s_transstart (void) |
void | s_connectionreset (void) |
uint8_t | s_read_statusreg (uint8_t *p_value, uint8_t *p_checksum) |
uint8_t | s_write_statusreg (uint8_t *p_value) |
uint8_t | s_measure (uint16_t *p_value, uint8_t *p_checksum, uint8_t mode) |
uint8_t | s_start_measure (uint8_t mode) |
uint8_t | s_read_measure (uint16_t *p_value, uint8_t *p_checksum) |
void | calc_sht (uint16_t hum, uint16_t tem, float *fhum, float *ftem) |
uint8_t | humid_sht_reset (void) |
void | humid_sht_init (void) |
void | humid_sht_periodic (void) |
Variables | |
uint16_t | humidsht |
!SITL More... | |
uint16_t | tempsht |
float | fhumidsht |
float | ftempsht |
bool | humid_sht_available |
uint8_t | humid_sht_status |
SHTxx sensor interface
This reads the values for humidity and temperature from the SHTxx sensor through bit banging.
Definition in file humid_sht.c.
#define ACK 1 |
Definition at line 48 of file humid_sht.c.
#define DATA_CLR gpio_setup_output(SHT_DAT_GPIO) |
set data pin to output
Definition at line 76 of file humid_sht.c.
#define DATA_IN gpio_get(SHT_DAT_GPIO) |
get data pin
Definition at line 78 of file humid_sht.c.
#define DATA_SET gpio_setup_input(SHT_DAT_GPIO) |
set data pin to input
Definition at line 74 of file humid_sht.c.
#define HUMI 1 |
Definition at line 50 of file humid_sht.c.
#define MEASURE_HUMI 0x05 |
Definition at line 60 of file humid_sht.c.
#define MEASURE_TEMP 0x03 |
Definition at line 58 of file humid_sht.c.
#define noACK 0 |
Definition at line 47 of file humid_sht.c.
#define RESET 0x1e |
Definition at line 62 of file humid_sht.c.
#define SCK_CLR gpio_clear(SHT_SCK_GPIO) |
set clock pin to low
Definition at line 83 of file humid_sht.c.
#define SCK_SET gpio_set(SHT_SCK_GPIO) |
set clock pin to high
Definition at line 81 of file humid_sht.c.
#define SHT_IDLE 0 |
Definition at line 65 of file humid_sht.c.
#define SHT_MEASURING_HUMID 1 |
Definition at line 66 of file humid_sht.c.
#define SHT_MEASURING_TEMP 2 |
Definition at line 67 of file humid_sht.c.
#define STATUS_REG_R 0x07 |
Definition at line 56 of file humid_sht.c.
#define STATUS_REG_W 0x06 |
Definition at line 54 of file humid_sht.c.
#define TEMP 0 |
Definition at line 49 of file humid_sht.c.
Definition at line 257 of file humid_sht.c.
Referenced by humid_sht_periodic().
void humid_sht_init | ( | void | ) |
Definition at line 299 of file humid_sht.c.
References gpio_clear(), gpio_setup_input(), gpio_setup_output(), humid_sht_available, humid_sht_status, and SHT_IDLE.
void humid_sht_periodic | ( | void | ) |
Definition at line 316 of file humid_sht.c.
References calc_sht(), checksum, GpsState::course, DefaultChannel, DefaultDevice, fhumidsht, GpsState::fix, ftempsht, gps, GpsState::gspeed, GpsState::hmsl, HUMI, humid_sht_available, humid_sht_status, humidsht, LlaCoor_i::lat, GpsState::lla_pos, LlaCoor_i::lon, GpsState::ned_vel, pprzLogFile, s_connectionreset(), s_read_measure(), s_start_measure(), SHT_IDLE, SHT_MEASURING_HUMID, SHT_MEASURING_TEMP, TEMP, tempsht, GpsState::tow, GpsState::week, and NedCoor_i::z.
uint8_t humid_sht_reset | ( | void | ) |
Definition at line 288 of file humid_sht.c.
References RESET, s_connectionreset(), and s_write_byte().
void s_connectionreset | ( | void | ) |
Definition at line 167 of file humid_sht.c.
References DATA_SET, s_transstart(), SCK_CLR, and SCK_SET.
Referenced by humid_sht_periodic(), and humid_sht_reset().
Definition at line 208 of file humid_sht.c.
References ACK, DATA_IN, HUMI, MEASURE_HUMI, MEASURE_TEMP, mode, noACK, s_read_byte(), s_transstart(), s_write_byte(), and TEMP.
Definition at line 124 of file humid_sht.c.
References DATA_CLR, DATA_IN, DATA_SET, SCK_CLR, SCK_SET, and val.
Referenced by s_measure(), s_read_measure(), and s_read_statusreg().
Definition at line 244 of file humid_sht.c.
References ACK, DATA_IN, noACK, and s_read_byte().
Referenced by humid_sht_periodic().
Definition at line 185 of file humid_sht.c.
References ACK, noACK, s_read_byte(), s_transstart(), s_write_byte(), and STATUS_REG_R.
Definition at line 229 of file humid_sht.c.
References HUMI, MEASURE_HUMI, MEASURE_TEMP, mode, s_transstart(), s_write_byte(), and TEMP.
Referenced by humid_sht_periodic().
void s_transstart | ( | void | ) |
Definition at line 144 of file humid_sht.c.
References DATA_CLR, DATA_SET, SCK_CLR, and SCK_SET.
Referenced by s_connectionreset(), s_measure(), s_read_statusreg(), s_start_measure(), and s_write_statusreg().
Definition at line 104 of file humid_sht.c.
References DATA_CLR, DATA_IN, DATA_SET, SCK_CLR, and SCK_SET.
Referenced by humid_sht_reset(), s_measure(), s_read_statusreg(), s_start_measure(), and s_write_statusreg().
Definition at line 197 of file humid_sht.c.
References s_transstart(), s_write_byte(), and STATUS_REG_W.
float fhumidsht |
Definition at line 87 of file humid_sht.c.
Referenced by humid_sht_periodic().
float ftempsht |
Definition at line 87 of file humid_sht.c.
Referenced by humid_hih_periodic(), and humid_sht_periodic().
bool humid_sht_available |
Definition at line 88 of file humid_sht.c.
Referenced by humid_sht_init(), and humid_sht_periodic().
uint8_t humid_sht_status |
Definition at line 89 of file humid_sht.c.
Referenced by humid_sht_init(), and humid_sht_periodic().
uint16_t humidsht |
uint16_t tempsht |
Definition at line 86 of file humid_sht.c.
Referenced by humid_sht_periodic().