|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
30 #include "pprzlink/messages.h"
51 #if PERIODIC_TELEMETRY
58 #ifndef TEMP_ADC_CHANNEL1
59 #ifndef TEMP_ADC_CHANNEL2
60 #ifndef TEMP_ADC_CHANNEL3
61 #error "at least one TEMP_ADC_CHANNEL1/2/3 needs to be defined to use the temp_adc module"
66 #ifdef TEMP_ADC_CHANNEL1
67 static struct adc_buf temp_buf1;
69 #ifndef TEMP_ADC_CHANNEL1_TYPE
70 #define TEMP_ADC_CHANNEL1_TYPE LM35
74 #ifdef TEMP_ADC_CHANNEL2
75 static struct adc_buf temp_buf2;
77 #ifndef TEMP_ADC_CHANNEL2_TYPE
78 #define TEMP_ADC_CHANNEL2_TYPE LM35
82 #ifdef TEMP_ADC_CHANNEL3
83 static struct adc_buf temp_buf3;
85 #ifndef TEMP_ADC_CHANNEL3_TYPE
86 #define TEMP_ADC_CHANNEL3_TYPE LM35
90 #ifndef TEMP_ADC_NB_SAMPLES
91 #define TEMP_ADC_NB_SAMPLES DEFAULT_AV_NB_SAMPLE
97 #ifndef TEMP_ADC_SYNC_SEND
98 #define TEMP_ADC_SYNC_SEND FALSE
107 float log_r = log((pull_up_r * raw_adc) / (
ADC_RESOLUTION - raw_adc));
111 float temp_c = 1 / (a + (
b * log_r) + (
c * log_r * log_r * log_r));
112 temp_c = temp_c - 273.15;
118 return ((
float)raw_temp * (3300.0
f / 1024.0
f) / 10.0
f);
133 #ifdef TEMP_ADC_CHANNEL1
137 #ifdef TEMP_ADC_CHANNEL2
141 #ifdef TEMP_ADC_CHANNEL3
145 #if PERIODIC_TELEMETRY
155 #ifdef TEMP_ADC_CHANNEL1
156 adc_raw = temp_buf1.sum / temp_buf1.av_nb_sample;
157 #if TEMP_ADC_CHANNEL1_TYPE == LM35
159 #elif TEMP_ADC_CHANNEL1_TYPE == NTC
165 #ifdef TEMP_ADC_CHANNEL2
166 adc_raw = temp_buf2.sum / temp_buf2.av_nb_sample;
167 #if TEMP_ADC_CHANNEL2_TYPE == LM35
169 #elif TEMP_ADC_CHANNEL2_TYPE == NTC
175 #ifdef TEMP_ADC_CHANNEL3
176 adc_raw = temp_buf3.sum / temp_buf3.av_nb_sample;
177 #if TEMP_ADC_CHANNEL3_TYPE == LM35
179 #elif TEMP_ADC_CHANNEL3_TYPE == NTC
181 TEMP_ADC_CHANNEL3_A, TEMP_ADC_CHANNEL3_B, TEMP_ADC_CHANNEL3_C);
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
#define TEMP_ADC_CHANNEL1_B
#define TEMP_ADC_CHANNEL2_C
#define TEMP_ADC_CHANNEL1_PU_R
#define TEMP_ADC_CHANNEL1_A
#define TEMP_ADC_CHANNEL1
void adc_buf_channel(uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample)
Link between ChibiOS ADC drivers and Paparazzi adc_buffers.
arch independent ADC (Analog to Digital Converter) API
#define TEMP_ADC_SYNC_SEND
Send a TEMP_ADC message with every new measurement.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static float calc_ntc(int16_t raw_adc, uint16_t pull_up_r, float a, float b, float c)
Calculate the NTC tempreature in celcius based on the Steinhart equation.
float get_temp(uint8_t nr)
static const struct usb_device_descriptor dev
void temp_adc_periodic(void)
#define TEMP_ADC_CHANNEL2
#define TEMP_ADC_NB_SAMPLES
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
#define TEMP_ADC_CHANNEL2_A
static float calc_lm35(int16_t raw_temp)
#define TEMP_ADC_CHANNEL2_PU_R
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
Common code for AP and FBW telemetry.
static void temp_adc_downlink(struct transport_tx *trans, struct link_device *dev)
#define TEMP_ADC_CHANNEL2_B
#define TEMP_ADC_CHANNEL1_C
void temp_adc_init(void)
Temperature ADC initialize channels.
#define DefaultPeriodic
Set default periodic telemetry.
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.