K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches
Temperature sensor example

Data Structures

struct  kfsw_temp_example_reading
 

Macros

#define KFSW_TEMP_EXAMPLE_ALARM_MIN_MILLI_C   (-40000)
 
#define KFSW_TEMP_EXAMPLE_ALARM_MAX_MILLI_C   125000
 

Functions

int kfsw_temp_example_init (void)
 
int kfsw_temp_example_get (struct kfsw_temp_example_reading *reading)
 
int kfsw_temp_example_set_alarm (int32_t milli_c)
 
int kfsw_temp_example_clear (void)
 

Variables

const struct kfsw_param_definition_set kfsw_temp_example_param_definitions
 
const struct kfsw_command_definition_set kfsw_temp_example_command_definitions
 

Description

A sensor read into a parameter table, for housekeeping.

Macro Documentation

◆ KFSW_TEMP_EXAMPLE_ALARM_MIN_MILLI_C

#define KFSW_TEMP_EXAMPLE_ALARM_MIN_MILLI_C   (-40000)

#include <temperature_sensor_example.h>

Lowest and highest accepted alarm threshold, the die's rated range.

Function Documentation

◆ kfsw_temp_example_clear()

int kfsw_temp_example_clear ( void  )

#include <temperature_sensor_example.h>

Zero the read, failure and alarm counters.

The cached reading is kept.

Returns
0, or -EACCES before initialization.

◆ kfsw_temp_example_get()

int kfsw_temp_example_get ( struct kfsw_temp_example_reading *  reading)

#include <temperature_sensor_example.h>

Copy a consistent snapshot of the cached reading.

Doesn't touch the ADC, so it can be called from a parameter sample callback. Readings older than CONFIG_KFSW_TEMP_EXAMPLE_MAX_AGE_MS are returned as invalid.

Parameters
readingDestination.
Returns
0 on success, -EINVAL for a NULL destination, or -EACCES before initialization.

◆ kfsw_temp_example_init()

int kfsw_temp_example_init ( void  )

#include <temperature_sensor_example.h>

Initialize the cache and start the configured sensor.

Queues the first reading on the module's workqueue. The cache stays invalid until that read completes; initialization does not wait for a conversion.

Returns
0 when initialized, or a negative errno if the sensor cannot be bound.

◆ kfsw_temp_example_set_alarm()

int kfsw_temp_example_set_alarm ( int32_t  milli_c)

#include <temperature_sensor_example.h>

Set the alarm threshold.

Takes effect at the next reading.

Parameters
milli_cThreshold in thousandths of a degree Celsius.
Returns
0, or -ERANGE outside KFSW_TEMP_EXAMPLE_ALARM_MIN_MILLI_C and KFSW_TEMP_EXAMPLE_ALARM_MAX_MILLI_C.

Variable Documentation

◆ kfsw_temp_example_command_definitions

const struct kfsw_command_definition_set kfsw_temp_example_command_definitions
extern

#include <temperature_sensor_example.h>

Commands of the temperature example, for the app's command registry.

◆ kfsw_temp_example_param_definitions

const struct kfsw_param_definition_set kfsw_temp_example_param_definitions
extern

#include <temperature_sensor_example.h>

Parameter table of the temperature example.