Microchip® Advanced Software Framework

tsens.c File Reference

SAM Temperature Sensor (TSENS) Driver.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include "tsens.h"

Macros

#define GAIN_1_OFFSET   20
 
#define WINDOW_MAX_VALUE   105
 
#define WINDOW_MIN_VALUE   -40
 

Functions

static enum status_code _tsens_set_config (struct tsens_config *const config)
 
void tsens_get_config_defaults (struct tsens_config *const config)
 Initializes an TSENS configuration structure to defaults. More...
 
enum status_code tsens_init (struct tsens_config *config)
 Initializes the TSENS. More...
 
enum status_code tsens_read (int32_t *result)
 Reads the TSENS result. More...
 

#define GAIN_1_OFFSET   20
#define WINDOW_MAX_VALUE   105

Referenced by _tsens_set_config().

#define WINDOW_MIN_VALUE   -40

Referenced by _tsens_set_config().

static enum status_code _tsens_set_config ( struct tsens_config *const  config)
static

Writes an TSENS configuration to the hardware module

Writes out a given TSENS module configuration to the hardware module.

Parameters
[in]configPointer to configuration struct
Returns
Status of the configuration procedure.
Return values
STATUS_OKThe configuration was successful
STATUS_ERR_INVALID_ARGInvalid argument(s) were provided

References tsens_config::calibration, tsens_config::clock_source, tsens_config::event_action, tsens_config::free_running, tsens_calibration::gain, tsens_calibration::offset, tsens_config::run_in_standby, system_gclk_chan_config::source_generator, STATUS_ERR_INVALID_ARG, STATUS_OK, system_gclk_chan_enable(), system_gclk_chan_get_config_defaults(), system_gclk_chan_set_config(), TSENS_WINDOW_MODE_DISABLE, tsens_config::window, tsens_window_config::window_lower_value, WINDOW_MAX_VALUE, WINDOW_MIN_VALUE, tsens_window_config::window_mode, and tsens_window_config::window_upper_value.

Referenced by tsens_init().