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) 
   76#define DATA_CLR        gpio_setup_output(SHT_DAT_GPIO) 
   78#define DATA_IN         gpio_get(SHT_DAT_GPIO) 
   81#define SCK_SET         gpio_set(SHT_SCK_GPIO) 
   83#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;           
 
 
  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");
 
 
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
void gpio_setup_input(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as inputs.
static void gpio_clear(ioportid_t port, uint16_t pin)
Clear a gpio output to low level.
Common code for AP and FBW telemetry.
Some architecture independent helper functions for GPIOs.
struct GpsState gps
global GPS state
Device independent GPS code (interface)
uint32_t tow
GPS time of week in ms.
int32_t hmsl
height above mean sea level (MSL) in mm
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
struct NedCoor_i ned_vel
speed NED in cm/s
uint16_t gspeed
norm of 2d ground speed in cm/s
int32_t lat
in degrees*1e7
int32_t lon
in degrees*1e7
uint8_t s_measure(uint16_t *p_value, uint8_t *p_checksum, uint8_t mode)
void s_connectionreset(void)
#define DATA_CLR
set data pin to output
uint8_t s_start_measure(uint8_t mode)
#define SHT_MEASURING_HUMID
uint8_t s_read_measure(uint16_t *p_value, uint8_t *p_checksum)
#define SCK_CLR
set clock pin to low
void humid_sht_init(void)
uint8_t s_read_statusreg(uint8_t *p_value, uint8_t *p_checksum)
void calc_sht(uint16_t hum, uint16_t tem, float *fhum, float *ftem)
#define SHT_MEASURING_TEMP
#define DATA_IN
get data pin
uint8_t s_read_byte(uint8_t ack)
#define SCK_SET
set clock pin to high
uint8_t s_write_statusreg(uint8_t *p_value)
void humid_sht_periodic(void)
uint8_t s_write_byte(uint8_t value)
uint8_t humid_sht_reset(void)
#define DATA_SET
set data pin to input
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.