Microchip® Advanced Software Framework

tsens.h File Reference

SAM Temperature Sensor (TSENS) Driver.

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

#include <compiler.h>
#include <system.h>

Data Structures

struct  tsens_calibration
 Calibration configuration structure. More...
 
struct  tsens_config
 TSENS configuration structure. More...
 
struct  tsens_events
 TSENS event enable/disable structure. More...
 
struct  tsens_window_config
 Window monitor configuration structure. More...
 

Macros

#define ERRATA_14476   true
 The magnitude of the temperature measurement value decreases with increasing temperature, i.e. More...
 
Module Status Flags

TSENS status flags, returned by tsens_get_status() and cleared by tsens_clear_status().

#define TSENS_STATUS_RESULT_READY   (1UL << 0)
 TSENS result ready. More...
 
#define TSENS_STATUS_OVERRUN   (1UL << 1)
 TSENS result overwritten before read. More...
 
#define TSENS_STATUS_WINDOW   (1UL << 2)
 Window monitor match. More...
 
#define TSENS_STATUS_OVERFLOW   (1UL << 3)
 TSENS result overflows. More...
 

Enumerations

enum  tsens_event_action {
  TSENS_EVENT_ACTION_DISABLED = 0,
  TSENS_EVENT_ACTION_START_CONV = TSENS_EVCTRL_STARTEI
}
 TSENS event action enum. More...
 
enum  tsens_window_mode {
  TSENS_WINDOW_MODE_DISABLE = TSENS_CTRLC_WINMODE_DISABLE,
  TSENS_WINDOW_MODE_ABOVE = TSENS_CTRLC_WINMODE_ABOVE,
  TSENS_WINDOW_MODE_BELOW = TSENS_CTRLC_WINMODE_BELOW,
  TSENS_WINDOW_MODE_INSIDE = TSENS_CTRLC_WINMODE_INSIDE,
  TSENS_WINDOW_MODE_OUTSIDE = TSENS_CTRLC_WINMODE_OUTSIDE,
  TSENS_WINDOW_MODE_HYST_ABOVE = TSENS_CTRLC_WINMODE_HYST_ABOVE,
  TSENS_WINDOW_MODE_HYST_BELOW = TSENS_CTRLC_WINMODE_HYST_BELOW
}
 TSENS window monitor mode enum. More...
 

Functions

Driver Initialization and Configuration
enum status_code tsens_init (struct tsens_config *config)
 Initializes the TSENS. More...
 
void tsens_get_config_defaults (struct tsens_config *const config)
 Initializes an TSENS configuration structure to defaults. More...
 
Status Management
static uint32_t tsens_get_status (void)
 Retrieves the current module status. More...
 
static void tsens_clear_status (const uint32_t status_flags)
 Clears a module status flag. More...
 
Enable, Disable, and Reset TSENS Module, Start Conversion and Read Result
static bool tsens_is_syncing (void)
 Determines if the hardware module is currently synchronizing to the bus. More...
 
static void tsens_enable (void)
 Enables the TSENS module. More...
 
static void tsens_disable (void)
 Disables the TSENS module. More...
 
static void tsens_reset (void)
 Resets the TSENS module. More...
 
static void tsens_enable_events (struct tsens_events *const events)
 Enables an TSENS event output. More...
 
static void tsens_disable_events (struct tsens_events *const events)
 Disables an TSENS event output. More...
 
static void tsens_start_conversion (void)
 Start a TSENS conversion. More...
 
enum status_code tsens_read (int32_t *result)
 Reads the TSENS result. More...