|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
34 #include "pprzlink/messages.h"
54 #define STATUS_REG_W 0x06
56 #define STATUS_REG_R 0x07
58 #define MEASURE_TEMP 0x03
60 #define MEASURE_HUMI 0x05
66 #define SHT_MEASURING_HUMID 1
67 #define SHT_MEASURING_TEMP 2
69 #if !defined SHT_DAT_GPIO || !defined SHT_SCK_GPIO
70 #error You need to define SHT_DAT_GPIO and SHT_SCK_GPIO
74 #define DATA_SET gpio_setup_input(SHT_DAT_GPIO)
75 #define DATA_CLR gpio_setup_output(SHT_DAT_GPIO)
77 #define DATA_IN gpio_get(SHT_DAT_GPIO)
81 #define SCK_SET gpio_set(SHT_SCK_GPIO)
82 #define SCK_CLR gpio_clear(SHT_SCK_GPIO)
108 for (i = 0x80; i > 0; i /= 2) {
129 for (i = 0x80; i > 0; i /= 2) {
178 for (i = 0; i < 9; i++) {
220 for (i = 0; i < 6665535; i++)
if (
DATA_IN == 0) {
break; }
265 const float C1 = -4.0;
266 const float C2 = 0.0405;
267 const float C3 = -0.0000028;
268 const float T1 = 0.01;
269 const float T2 = 0.00008;
279 t_C = t * 0.01 - 39.66;
280 rh_lin = C3 * rh * rh +
C2 * rh +
C1;
281 rh_true = (t_C - 25) * (T1 + T2 * rh) + rh_lin;
282 if (rh_true > 100) { rh_true = 100; }
283 if (rh_true < 0.1) { rh_true = 0.1; }
311 log_sht_started =
false;
356 if (!log_sht_started) {
357 sdLogWriteLog(
pprzLogFile,
"SHT75: Humid(pct) Temp(degC) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gspeed(cm/s) course(1e7deg) climb(cm/s)\n");
358 log_sht_started =
true;
360 sdLogWriteLog(
pprzLogFile,
"sht75: %9.4f %9.4f %d %d %d %d %d %d %d %d %d\n",
int32_t lon
in degrees*1e7
uint8_t s_read_statusreg(uint8_t *p_value, uint8_t *p_checksum)
uint32_t tow
GPS time of week in ms.
#define SHT_MEASURING_HUMID
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
void humid_sht_periodic(void)
struct NedCoor_i ned_vel
speed NED in cm/s
void humid_sht_init(void)
int32_t lat
in degrees*1e7
static void gpio_clear(ioportid_t port, uint16_t pin)
Clear a gpio output to low level.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
Device independent GPS code (interface)
uint8_t s_write_statusreg(uint8_t *p_value)
uint8_t s_read_byte(uint8_t ack)
void s_connectionreset(void)
void gpio_setup_input(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as inputs.
uint8_t s_start_measure(uint8_t mode)
uint8_t s_write_byte(uint8_t value)
uint16_t gspeed
norm of 2d ground speed in cm/s
#define DATA_SET
set data pin to input
Common code for AP and FBW telemetry.
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
uint8_t s_read_measure(uint16_t *p_value, uint8_t *p_checksum)
#define SCK_CLR
set clock pin to low
#define DATA_IN
get data pin
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
#define DATA_CLR
set data pin to output
uint8_t humid_sht_reset(void)
int32_t hmsl
height above mean sea level (MSL) in mm
#define SCK_SET
set clock pin to high
#define SHT_MEASURING_TEMP
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
void calc_sht(uint16_t hum, uint16_t tem, float *fhum, float *ftem)
struct GpsState gps
global GPS state
uint8_t s_measure(uint16_t *p_value, uint8_t *p_checksum, uint8_t mode)