MCP980X driver.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "mcp980x.h"
Macros | |
#define | MCP980X_CONF_REG (0x01) /* Configuration Register */ |
#define | MCP980X_DEC_UNIT (625) |
#define | MCP980X_HYST_REG (0x02) /* Temperature Hysteresis Register */ |
#define | MCP980X_LIMT_REG (0x03) /* Temperature Limit-set Register */ |
#define | MCP980X_TEMP_REG (0x00) /* Temperature Register */ |
#define | TWI_SPEED (400000ul) /* 400KHz TWI bus frequency */ |
Functions | |
uint32_t | mcp980x_disable (void) |
Disable the sensor. More... | |
uint32_t | mcp980x_enable (void) |
Enable the sensor. More... | |
uint32_t | mcp980x_get_configuration (uint8_t *p_config) |
Get MCP980X configuration. More... | |
uint32_t | mcp980x_get_temperature (int8_t *p_integer, uint32_t *p_decimal) |
Get ambient temperature. More... | |
uint32_t | mcp980x_get_temperature_hysteresis (int8_t *p_integer, uint32_t *p_decimal) |
Get temperature hysteresis. More... | |
uint32_t | mcp980x_get_temperature_limit (int8_t *p_integer, uint32_t *p_decimal) |
Get temperature limit. More... | |
static void | mcp980x_hex_to_temperature_dec (uint8_t uc_hex, uint32_t *p_decimal) |
Convert hexadecimal value to decimal part of temperature. More... | |
static void | mcp980x_hex_to_temperature_int (uint8_t uc_hex, int8_t *p_integer) |
Convert hexadecimal value to integer part of temperature. More... | |
uint32_t | mcp980x_init (void) |
Init the sensor. More... | |
static uint32_t | mcp980x_interface_init (void) |
Initialize the hardware interface to the controller. More... | |
uint32_t | mcp980x_one_shot_mode (void) |
Enable One-Shot mode and perform a single temperature measure. More... | |
static uint32_t | mcp980x_read_register (uint32_t ul_reg_index, uint8_t *p_reg_value) |
Read the MCP980X register specified by ul_reg_index. More... | |
uint32_t | mcp980x_set_configuration (uint8_t uc_config) |
Set MCP980X configuration. More... | |
uint32_t | mcp980x_set_temperature_hysteresis (int8_t c_integer, uint32_t ul_decimal) |
Set temperature hysteresis. More... | |
uint32_t | mcp980x_set_temperature_limit (int8_t c_integer, uint32_t ul_decimal) |
Set temperature limit. More... | |
static void | mcp980x_temperature_to_hex_dec (uint32_t ul_decimal, uint8_t *p_hex) |
Convert decimal part of temperature to hexadecimal value. More... | |
static void | mcp980x_temperature_to_hex_int (int8_t c_integer, uint8_t *p_hex) |
Convert integer part of temperature to hexadecimal value. More... | |
static uint32_t | mcp980x_write_register (uint32_t ul_reg_index, uint8_t *p_reg_value) |
Write the MCP980X register specified by ul_reg_index. More... | |