43#define CHIP_NAME "Maxim Integrated MAX30205"
44#define MANUFACTURER_NAME "Maxim Integrated"
45#define SUPPLY_VOLTAGE_MIN 2.7f
46#define SUPPLY_VOLTAGE_MAX 3.3f
47#define MAX_CURRENT 20.0f
48#define TEMPERATURE_MIN 0.0f
49#define TEMPERATURE_MAX 50.0f
50#define DRIVER_VERSION 2000
55#define MAX30205_REG_TEMP 0x00
56#define MAX30205_REG_CONF 0x01
57#define MAX30205_REG_THYST 0x02
58#define MAX30205_REG_TOS 0x03
82 handle->
debug_print(
"max30205: iic_init is null.\n");
88 handle->
debug_print(
"max30205: iic_deinit is null.\n");
94 handle->
debug_print(
"max30205: iic_read is null.\n");
100 handle->
debug_print(
"max30205: iic_write is null.\n");
106 handle->
debug_print(
"max30205: delay_ms is null.\n");
113 handle->
debug_print(
"max30205: iic init failed.\n");
146 reg = handle->
reg | 0x01;
149 handle->
debug_print(
"max30205: power down failed.\n");
155 handle->
debug_print(
"max30205: iic deinit failed.\n");
180 handle->
iic_addr = (uint8_t)addr_pin;
229 handle->
reg = handle->
reg | (1 << 5);
233 handle->
reg = handle->
reg & (~(1 << 5));
260 if ((handle->
reg & (1 << 5)) != 0)
295 handle->
reg = handle->
reg | (1 << 1);
299 handle->
reg = handle->
reg & (~(1 << 1));
326 if ((handle->
reg & (1 << 1)) != 0)
359 handle->
reg = handle->
reg & (~(3 << 3));
360 handle->
reg = (uint8_t)(handle->
reg |
415 handle->
reg = handle->
reg | (1 << 2);
419 handle->
reg = handle->
reg & (~(1 << 2));
446 if ((handle->
reg & (1 << 2)) != 0)
479 if (bus_timeout != 0)
481 handle->
reg = handle->
reg | (1 << 6);
485 handle->
reg = handle->
reg & (~(1 << 6));
512 if ((handle->
reg & (1 << 6)) != 0)
547 reg = handle->
reg & (~(1 << 0));
548 reg = reg & (~(1 << 7));
551 handle->
debug_print(
"max30205: start continuous read failed.\n");
584 reg = handle->
reg | (1 << 0);
585 reg = reg | (1 << 7);
589 handle->
debug_print(
"max30205: stop continuous read failed.\n");
625 memset(buf, 0,
sizeof(uint8_t) * 2);
632 if ((handle->
reg & (1 << 5)) != 0)
634 *raw = (int16_t)(((uint16_t)buf[0]) << 8 | buf[1]);
635 *s = (float)(*raw) * 0.00390625f + 64.0f;
639 *raw = (int16_t)(((uint16_t)buf[0]) << 8 | buf[1]);
640 *s = (float)(*raw) * 0.00390625f;
672 reg = handle->
reg | (1 << 0);
673 reg = reg | (1 << 7);
681 memset(buf, 0,
sizeof(uint8_t) * 2);
688 if ((handle->
reg & (1 << 5)) != 0)
690 *raw = (int16_t)(((uint16_t)buf[0]) << 8 | buf[1]);
691 *s = (float)(*raw) * 0.00390625f + 64.0f;
695 *raw = (int16_t)(((uint16_t)buf[0]) << 8 | buf[1]);
696 *s = (float)(*raw) * 0.00390625f;
726 buf[0] = (threshold >> 8) & 0xFF;
727 buf[1] = threshold & 0xFF;
730 handle->
debug_print(
"max30205: set interrupt low threshold failed.\n");
764 memset(buf, 0,
sizeof(uint8_t) * 2);
771 *threshold = (int16_t)(((uint16_t)buf[0]) << 8 | buf[1]);
800 buf[0] = (threshold >> 8) & 0xFF;
801 buf[1] = threshold & 0xFF;
804 handle->
debug_print(
"max30205: set interrupt high threshold failed.\n");
838 memset(buf, 0,
sizeof(uint8_t) * 2);
845 *threshold = (int16_t)(((uint16_t)buf[0]) << 8 | buf[1]);
872 if ((handle->
reg & (1 << 5)) != 0)
874 *reg = (int16_t)((s - 64.0f) / 0.00390625f);
878 *reg = (int16_t)(s / 0.00390625f);
907 if ((handle->
reg & (1 << 5)) != 0)
909 *s = (float)(reg) * 0.00390625f + 64.0f;
913 *s = (float)(reg) * 0.00390625f;
942 reg = handle->
reg | 0x01;
945 handle->
debug_print(
"max30205: power down failed.\n");
#define MAX30205_REG_TEMP
chip register definition
#define MAX30205_REG_CONF
#define SUPPLY_VOLTAGE_MAX
#define MAX30205_REG_THYST
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
driver max30205 header file
max30205_bus_timeout_t
max30205 bus timeout enumeration definition
struct max30205_handle_s max30205_handle_t
max30205 handle structure definition
uint8_t max30205_set_data_format(max30205_handle_t *handle, max30205_data_format_t format)
set the chip data format
uint8_t max30205_get_addr_pin(max30205_handle_t *handle, max30205_address_t *addr_pin)
get the iic address pin
uint8_t max30205_get_bus_timeout(max30205_handle_t *handle, max30205_bus_timeout_t *bus_timeout)
get the iic bus timeout
uint8_t max30205_start_continuous_read(max30205_handle_t *handle)
start reading data
struct max30205_info_s max30205_info_t
max30205 information structure definition
uint8_t max30205_get_data_format(max30205_handle_t *handle, max30205_data_format_t *format)
get the chip data format
uint8_t max30205_set_addr_pin(max30205_handle_t *handle, max30205_address_t addr_pin)
set the iic address pin
uint8_t max30205_info(max30205_info_t *info)
get chip's information
max30205_address_t
max30205 address enumeration definition
max30205_data_format_t
max30205 data format enumeration definition
uint8_t max30205_deinit(max30205_handle_t *handle)
close the chip
uint8_t max30205_set_bus_timeout(max30205_handle_t *handle, max30205_bus_timeout_t bus_timeout)
set the iic bus timeout
uint8_t max30205_continuous_read(max30205_handle_t *handle, int16_t *raw, float *s)
read data continuously
uint8_t max30205_power_down(max30205_handle_t *handle)
chip powers down
uint8_t max30205_single_read(max30205_handle_t *handle, int16_t *raw, float *s)
read data once
uint8_t max30205_init(max30205_handle_t *handle)
initialize the chip
uint8_t max30205_stop_continuous_read(max30205_handle_t *handle)
stop reading data
@ MAX30205_BUS_TIMEOUT_DISABLE
@ MAX30205_BUS_TIMEOUT_ENABLE
@ MAX30205_DATA_FORMAT_NORMAL
@ MAX30205_DATA_FORMAT_EXTENDED
uint8_t max30205_get_reg(max30205_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t max30205_set_reg(max30205_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
max30205_interrupt_mode_t
max30205 interrupt mode enumeration definition
uint8_t max30205_set_fault_queue(max30205_handle_t *handle, max30205_fault_queue_t fault_queue)
set the chip fault queue
uint8_t max30205_get_interrupt_mode(max30205_handle_t *handle, max30205_interrupt_mode_t *mode)
get the chip interrupt mode
uint8_t max30205_set_interrupt_mode(max30205_handle_t *handle, max30205_interrupt_mode_t mode)
set the chip interrupt mode
uint8_t max30205_get_pin_polarity(max30205_handle_t *handle, max30205_pin_polarity_t *polarity)
get the interrupt pin polarity
uint8_t max30205_get_interrupt_low_threshold(max30205_handle_t *handle, int16_t *threshold)
get the chip interrupt low threshold
uint8_t max30205_set_interrupt_low_threshold(max30205_handle_t *handle, int16_t threshold)
set the chip interrupt low threshold
uint8_t max30205_convert_to_data(max30205_handle_t *handle, int16_t reg, float *s)
convert a register raw data to a converted temperature data
max30205_fault_queue_t
max30205 fault queue enumeration definition
uint8_t max30205_set_pin_polarity(max30205_handle_t *handle, max30205_pin_polarity_t polarity)
set the interrupt pin polarity
uint8_t max30205_convert_to_register(max30205_handle_t *handle, float s, int16_t *reg)
convert a temperature value to a register raw data
max30205_pin_polarity_t
max30205 pin enumeration definition
uint8_t max30205_set_interrupt_high_threshold(max30205_handle_t *handle, int16_t threshold)
set the chip interrupt high threshold
uint8_t max30205_get_interrupt_high_threshold(max30205_handle_t *handle, int16_t *threshold)
get the chip interrupt high threshold
uint8_t max30205_get_fault_queue(max30205_handle_t *handle, max30205_fault_queue_t *fault_queue)
get the chip fault queue
@ MAX30205_INTERRUPT_MODE_INTERRUPT
@ MAX30205_INTERRUPT_MODE_COMPARATOR
@ MAX30205_PIN_POLARITY_LOW
@ MAX30205_PIN_POLARITY_HIGH
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v