Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
temp_adc.c File Reference

Temperature sensor module for LM35 or NTC (10k / 100k) sensor via analog input. More...

#include "std.h"
#include "modules/sensors/temp_adc.h"
#include "mcu_periph/adc.h"
#include "mcu_periph/uart.h"
#include "messages.h"
#include "subsystems/datalink/downlink.h"
#include <BOARD_CONFIG>
+ Include dependency graph for temp_adc.c:

Go to the source code of this file.

Macros

#define LM35   0
 
#define NTC   1
 
#define TEMP_ADC_CHANNEL1_TYPE   LM35
 
#define TEMP_ADC_CHANNEL2_TYPE   LM35
 
#define TEMP_ADC_CHANNEL3_TYPE   LM35
 
#define TEMP_ADC_NB_SAMPLES   DEFAULT_AV_NB_SAMPLE
 
#define TEMP_ADC_SYNC_SEND   FALSE
 Send a TEMP_ADC message with every new measurement. More...
 

Functions

float calc_ntc (int16_t raw_temp)
 
float calc_lm35 (int16_t raw_temp)
 
static void temp_adc_downlink (struct transport_tx *trans, struct link_device *dev)
 
void temp_adc_init (void)
 
void temp_adc_periodic (void)
 

Variables

float temp_c1
 
float temp_c2
 
float temp_c3
 

Detailed Description

Temperature sensor module for LM35 or NTC (10k / 100k) sensor via analog input.

Definition in file temp_adc.c.

Macro Definition Documentation

#define LM35   0

Definition at line 40 of file temp_adc.c.

#define NTC   1

Definition at line 41 of file temp_adc.c.

#define TEMP_ADC_CHANNEL1_TYPE   LM35

Definition at line 52 of file temp_adc.c.

#define TEMP_ADC_CHANNEL2_TYPE   LM35

Definition at line 55 of file temp_adc.c.

#define TEMP_ADC_CHANNEL3_TYPE   LM35

Definition at line 58 of file temp_adc.c.

#define TEMP_ADC_NB_SAMPLES   DEFAULT_AV_NB_SAMPLE

Definition at line 74 of file temp_adc.c.

Referenced by temp_adc_init().

#define TEMP_ADC_SYNC_SEND   FALSE

Send a TEMP_ADC message with every new measurement.

Mainly for debug, use with caution, sends message at ~10Hz.

Definition at line 81 of file temp_adc.c.

Referenced by temp_adc_init().

Function Documentation

float calc_lm35 ( int16_t  raw_temp)

Definition at line 96 of file temp_adc.c.

Referenced by temp_adc_periodic().

+ Here is the caller graph for this function:

float calc_ntc ( int16_t  raw_temp)

Definition at line 84 of file temp_adc.c.

Referenced by temp_adc_periodic().

+ Here is the caller graph for this function:

static void temp_adc_downlink ( struct transport_tx trans,
struct link_device dev 
)
static

Definition at line 101 of file temp_adc.c.

References temp_c1, temp_c2, and temp_c3.

Referenced by temp_adc_init(), and temp_adc_periodic().

+ Here is the caller graph for this function:

void temp_adc_init ( void  )

Definition at line 106 of file temp_adc.c.

References adc_buf_channel(), DefaultPeriodic, register_periodic_telemetry(), temp_adc_downlink(), TEMP_ADC_NB_SAMPLES, temp_adc_sync_send, and TEMP_ADC_SYNC_SEND.

+ Here is the call graph for this function:

void temp_adc_periodic ( void  )

Definition at line 128 of file temp_adc.c.

References calc_lm35(), calc_ntc(), DefaultChannel, DefaultDevice, temp_adc_downlink(), temp_adc_sync_send, temp_c1, temp_c2, and temp_c3.

+ Here is the call graph for this function:

Variable Documentation

float temp_c1

Definition at line 34 of file temp_adc.c.

Referenced by temp_adc_downlink(), and temp_adc_periodic().

float temp_c2

Definition at line 34 of file temp_adc.c.

Referenced by temp_adc_downlink(), and temp_adc_periodic().

float temp_c3

Definition at line 34 of file temp_adc.c.

Referenced by temp_adc_downlink(), and temp_adc_periodic().