LibDriver MCP9600
Loading...
Searching...
No Matches
driver_mcp9600.c File Reference

driver mcp9600 source file More...

#include "driver_mcp9600.h"
Include dependency graph for driver_mcp9600.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Microchip MCP9600"
 chip information definition
#define MANUFACTURER_NAME   "Microchip"
#define SUPPLY_VOLTAGE_MIN   2.7f
#define SUPPLY_VOLTAGE_MAX   5.5f
#define MAX_CURRENT   2.5f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define MCP9600_REG_THERMOCOUPLE_HOT_JUNCTION   0x00
 chip register definition
#define MCP9600_REG_JUNCTIONS_TEMPERATURE_DELTA   0x01
#define MCP9600_REG_COLD_JUNCTION_TEMPERATURE   0x02
#define MCP9600_REG_RAW_ADC_DATA   0x03
#define MCP9600_REG_STATUS   0x04
#define MCP9600_REG_THERMOCOUPLE_SENSOR_CONFIGURATION   0x05
#define MCP9600_REG_DEVICE_CONFIGURATION   0x06
#define MCP9600_REG_ALERT1_CONFIGURATION   0x08
#define MCP9600_REG_ALERT2_CONFIGURATION   0x09
#define MCP9600_REG_ALERT3_CONFIGURATION   0x0A
#define MCP9600_REG_ALERT4_CONFIGURATION   0x0B
#define MCP9600_REG_ALERT1_HYSTERESIS   0x0C
#define MCP9600_REG_ALERT2_HYSTERESIS   0x0D
#define MCP9600_REG_ALERT3_HYSTERESIS   0x0E
#define MCP9600_REG_ALERT4_HYSTERESIS   0x0F
#define MCP9600_REG_TEMPERATURE_ALERT1_LIMIT   0x10
#define MCP9600_REG_TEMPERATURE_ALERT2_LIMIT   0x11
#define MCP9600_REG_TEMPERATURE_ALERT3_LIMIT   0x12
#define MCP9600_REG_TEMPERATURE_ALERT4_LIMIT   0x13
#define MCP9600_REG_DEVICE_ID_REVISON   0x20

Functions

uint8_t mcp9600_set_addr_pin (mcp9600_handle_t *handle, mcp9600_address_t addr_pin)
 set the iic address pin
uint8_t mcp9600_get_addr_pin (mcp9600_handle_t *handle, mcp9600_address_t *addr_pin)
 get the iic address pin
uint8_t mcp9600_init (mcp9600_handle_t *handle)
 initialize the chip
uint8_t mcp9600_deinit (mcp9600_handle_t *handle)
 close the chip
uint8_t mcp9600_start_continuous_read (mcp9600_handle_t *handle)
 start reading data
uint8_t mcp9600_stop_continuous_read (mcp9600_handle_t *handle)
 stop reading data
uint8_t mcp9600_continuous_read (mcp9600_handle_t *handle, int16_t *hot_raw, float *hot_s, int16_t *delta_raw, float *delta_s, int16_t *cold_raw, float *cold_s)
 read data continuously
uint8_t mcp9600_single_read (mcp9600_handle_t *handle, int16_t *hot_raw, float *hot_s, int16_t *delta_raw, float *delta_s, int16_t *cold_raw, float *cold_s)
 read data once
uint8_t mcp9600_get_status_burst_complete_flag (mcp9600_handle_t *handle, mcp9600_bool_t *status)
 get the burst complete status flag
uint8_t mcp9600_clear_status_burst_complete_flag (mcp9600_handle_t *handle)
 clear the burst complete status flag
uint8_t mcp9600_get_status_temperature_update_flag (mcp9600_handle_t *handle, mcp9600_bool_t *status)
 get the temperature update status flag
uint8_t mcp9600_clear_status_temperature_update_flag (mcp9600_handle_t *handle)
 clear the temperature update status flag
uint8_t mcp9600_get_status_input_range (mcp9600_handle_t *handle, mcp9600_input_range_t *range)
 get the input range status
uint8_t mcp9600_get_alert_status (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_alert_status_t *status)
 get the alert status
uint8_t mcp9600_get_hot_junction_temperature (mcp9600_handle_t *handle, int16_t *raw, float *s)
 get the hot junction temperature
uint8_t mcp9600_get_junction_thermocouple_delta (mcp9600_handle_t *handle, int16_t *raw, float *s)
 get the junction thermocouple delta
uint8_t mcp9600_get_cold_junction_temperature (mcp9600_handle_t *handle, int16_t *raw, float *s)
 get the cold junction temperature
uint8_t mcp9600_get_raw_adc (mcp9600_handle_t *handle, int32_t *raw, double *uv)
 get the raw adc
uint8_t mcp9600_set_cold_junction_resolution (mcp9600_handle_t *handle, mcp9600_cold_junction_resolution_t resolution)
 set the cold junction resolution
uint8_t mcp9600_get_cold_junction_resolution (mcp9600_handle_t *handle, mcp9600_cold_junction_resolution_t *resolution)
 get the cold junction resolution
uint8_t mcp9600_set_adc_resolution (mcp9600_handle_t *handle, mcp9600_adc_resolution_t resolution)
 set the adc resolution
uint8_t mcp9600_get_adc_resolution (mcp9600_handle_t *handle, mcp9600_adc_resolution_t *resolution)
 get the adc resolution
uint8_t mcp9600_set_burst_mode_sample (mcp9600_handle_t *handle, mcp9600_burst_mode_sample_t sample)
 set the burst mode sample
uint8_t mcp9600_get_burst_mode_sample (mcp9600_handle_t *handle, mcp9600_burst_mode_sample_t *sample)
 get the burst mode sample
uint8_t mcp9600_set_mode (mcp9600_handle_t *handle, mcp9600_mode_t mode)
 set the mode
uint8_t mcp9600_get_mode (mcp9600_handle_t *handle, mcp9600_mode_t *mode)
 get the mode
uint8_t mcp9600_set_thermocouple_type (mcp9600_handle_t *handle, mcp9600_thermocouple_type_t type)
 set the thermocouple type
uint8_t mcp9600_get_thermocouple_type (mcp9600_handle_t *handle, mcp9600_thermocouple_type_t *type)
 get the thermocouple type
uint8_t mcp9600_set_filter_coefficient (mcp9600_handle_t *handle, mcp9600_filter_coefficient_t coefficient)
 set the filter coefficient
uint8_t mcp9600_get_filter_coefficient (mcp9600_handle_t *handle, mcp9600_filter_coefficient_t *coefficient)
 get the filter coefficient
uint8_t mcp9600_alert_limit_convert_to_register (mcp9600_handle_t *handle, float c, int16_t *reg)
 convert the alert limit to the register raw data
uint8_t mcp9600_alert_limit_convert_to_data (mcp9600_handle_t *handle, int16_t reg, float *c)
 convert the register raw data to the alert limit
uint8_t mcp9600_set_alert_limit (mcp9600_handle_t *handle, mcp9600_alert_t alert, int16_t reg)
 set the alert limit
uint8_t mcp9600_get_alert_limit (mcp9600_handle_t *handle, mcp9600_alert_t alert, int16_t *reg)
 get the alert limit
uint8_t mcp9600_alert_hysteresis_convert_to_register (mcp9600_handle_t *handle, float c, uint8_t *reg)
 convert the alert hysteresis to the register raw data
uint8_t mcp9600_alert_hysteresis_convert_to_data (mcp9600_handle_t *handle, uint8_t reg, float *c)
 convert the register raw data to the alert hysteresis
uint8_t mcp9600_set_alert_hysteresis (mcp9600_handle_t *handle, mcp9600_alert_t alert, uint8_t reg)
 set the alert hysteresis
uint8_t mcp9600_get_alert_hysteresis (mcp9600_handle_t *handle, mcp9600_alert_t alert, uint8_t *reg)
 get the alert hysteresis
uint8_t mcp9600_clear_interrupt (mcp9600_handle_t *handle, mcp9600_alert_t alert)
 clear the interrupt flag
uint8_t mcp9600_get_interrupt (mcp9600_handle_t *handle, mcp9600_alert_t alert, uint8_t *status)
 get the interrupt flag
uint8_t mcp9600_set_temperature_maintain_detect (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_temperature_maintain_detect_t maintain_detect)
 set the temperature maintain detect
uint8_t mcp9600_get_temperature_maintain_detect (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_temperature_maintain_detect_t *maintain_detect)
 get the temperature maintain detect
uint8_t mcp9600_set_detect_edge (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_detect_edge_t edge)
 set the detect edge
uint8_t mcp9600_get_detect_edge (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_detect_edge_t *edge)
 get the detect edge
uint8_t mcp9600_set_active_level (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_active_level_t level)
 set the active level
uint8_t mcp9600_get_active_level (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_active_level_t *level)
 get the active level
uint8_t mcp9600_set_interrupt_mode (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_interrupt_mode_t mode)
 set the interrupt mode
uint8_t mcp9600_get_interrupt_mode (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_interrupt_mode_t *mode)
 get the interrupt mode
uint8_t mcp9600_set_alert_output (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_bool_t enable)
 set the alert output
uint8_t mcp9600_get_alert_output (mcp9600_handle_t *handle, mcp9600_alert_t alert, mcp9600_bool_t *enable)
 get the alert output
uint8_t mcp9600_get_device_id_revision (mcp9600_handle_t *handle, uint8_t *id, uint8_t *revision)
 get the device id and revision
uint8_t mcp9600_set_reg (mcp9600_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t mcp9600_get_reg (mcp9600_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t mcp9600_info (mcp9600_info_t *info)
 get chip information

Detailed Description

driver mcp9600 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2021-09-12

history

Date Version Author Description
2021/09/12 1.0 Shifeng Li first upload

Definition in file driver_mcp9600.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Microchip MCP9600"

chip information definition

chip name

Definition at line 42 of file driver_mcp9600.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_mcp9600.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Microchip"

manufacturer name

Definition at line 43 of file driver_mcp9600.c.

◆ MAX_CURRENT

#define MAX_CURRENT   2.5f

chip max current

Definition at line 46 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT1_CONFIGURATION

#define MCP9600_REG_ALERT1_CONFIGURATION   0x08

alert 1 configuration register

Definition at line 61 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT1_HYSTERESIS

#define MCP9600_REG_ALERT1_HYSTERESIS   0x0C

alert 1 hysteresis register

Definition at line 65 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT2_CONFIGURATION

#define MCP9600_REG_ALERT2_CONFIGURATION   0x09

alert 2 configuration register

Definition at line 62 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT2_HYSTERESIS

#define MCP9600_REG_ALERT2_HYSTERESIS   0x0D

alert 2 hysteresis register

Definition at line 66 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT3_CONFIGURATION

#define MCP9600_REG_ALERT3_CONFIGURATION   0x0A

alert 3 configuration register

Definition at line 63 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT3_HYSTERESIS

#define MCP9600_REG_ALERT3_HYSTERESIS   0x0E

alert 3 hysteresis register

Definition at line 67 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT4_CONFIGURATION

#define MCP9600_REG_ALERT4_CONFIGURATION   0x0B

alert 4 configuration register

Definition at line 64 of file driver_mcp9600.c.

◆ MCP9600_REG_ALERT4_HYSTERESIS

#define MCP9600_REG_ALERT4_HYSTERESIS   0x0F

alert 4 hysteresis register

Definition at line 68 of file driver_mcp9600.c.

◆ MCP9600_REG_COLD_JUNCTION_TEMPERATURE

#define MCP9600_REG_COLD_JUNCTION_TEMPERATURE   0x02

cold junction temperature register

Definition at line 56 of file driver_mcp9600.c.

◆ MCP9600_REG_DEVICE_CONFIGURATION

#define MCP9600_REG_DEVICE_CONFIGURATION   0x06

device configuration register

Definition at line 60 of file driver_mcp9600.c.

◆ MCP9600_REG_DEVICE_ID_REVISON

#define MCP9600_REG_DEVICE_ID_REVISON   0x20

device id/revision register

Definition at line 73 of file driver_mcp9600.c.

◆ MCP9600_REG_JUNCTIONS_TEMPERATURE_DELTA

#define MCP9600_REG_JUNCTIONS_TEMPERATURE_DELTA   0x01

junctions temperature delta register

Definition at line 55 of file driver_mcp9600.c.

◆ MCP9600_REG_RAW_ADC_DATA

#define MCP9600_REG_RAW_ADC_DATA   0x03

raw adc data register

Definition at line 57 of file driver_mcp9600.c.

◆ MCP9600_REG_STATUS

#define MCP9600_REG_STATUS   0x04

status register

Definition at line 58 of file driver_mcp9600.c.

◆ MCP9600_REG_TEMPERATURE_ALERT1_LIMIT

#define MCP9600_REG_TEMPERATURE_ALERT1_LIMIT   0x10

temperature alert 1 limit register

Definition at line 69 of file driver_mcp9600.c.

◆ MCP9600_REG_TEMPERATURE_ALERT2_LIMIT

#define MCP9600_REG_TEMPERATURE_ALERT2_LIMIT   0x11

temperature alert 2 limit register

Definition at line 70 of file driver_mcp9600.c.

◆ MCP9600_REG_TEMPERATURE_ALERT3_LIMIT

#define MCP9600_REG_TEMPERATURE_ALERT3_LIMIT   0x12

temperature alert 3 limit register

Definition at line 71 of file driver_mcp9600.c.

◆ MCP9600_REG_TEMPERATURE_ALERT4_LIMIT

#define MCP9600_REG_TEMPERATURE_ALERT4_LIMIT   0x13

temperature alert 4 limit register

Definition at line 72 of file driver_mcp9600.c.

◆ MCP9600_REG_THERMOCOUPLE_HOT_JUNCTION

#define MCP9600_REG_THERMOCOUPLE_HOT_JUNCTION   0x00

chip register definition

thermocouple hot junction register

Definition at line 54 of file driver_mcp9600.c.

◆ MCP9600_REG_THERMOCOUPLE_SENSOR_CONFIGURATION

#define MCP9600_REG_THERMOCOUPLE_SENSOR_CONFIGURATION   0x05

thermocouple sensor configuration register

Definition at line 59 of file driver_mcp9600.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.5f

chip max supply voltage

Definition at line 45 of file driver_mcp9600.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.7f

chip min supply voltage

Definition at line 44 of file driver_mcp9600.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_mcp9600.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_mcp9600.c.