LibDriver MAX30105
Loading...
Searching...
No Matches
driver_max30105.c File Reference

driver max30105 source file More...

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

Go to the source code of this file.

Macros

#define CHIP_NAME   "Maxim Integrated MAX30105"
 chip information definition
#define MANUFACTURER_NAME   "Maxim Integrated"
#define SUPPLY_VOLTAGE_MIN   1.7f
#define SUPPLY_VOLTAGE_MAX   2.0f
#define MAX_CURRENT   50.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define MAX30105_ADDRESS   0xAE
 iic address definition
#define MAX30105_REG_INTERRUPT_STATUS_1   0x00
 chip register definition
#define MAX30105_REG_INTERRUPT_STATUS_2   0x01
#define MAX30105_REG_INTERRUPT_ENABLE_1   0x02
#define MAX30105_REG_INTERRUPT_ENABLE_2   0x03
#define MAX30105_REG_FIFO_WRITE_POINTER   0x04
#define MAX30105_REG_OVERFLOW_COUNTER   0x05
#define MAX30105_REG_FIFO_READ_POINTER   0x06
#define MAX30105_REG_FIFO_DATA_REGISTER   0x07
#define MAX30105_REG_FIFO_CONFIG   0x08
#define MAX30105_REG_MODE_CONFIG   0x09
#define MAX30105_REG_SPO2_CONFIG   0x0A
#define MAX30105_REG_LED_1_PA   0x0C
#define MAX30105_REG_LED_2_PA   0x0D
#define MAX30105_REG_LED_3_PA   0x0E
#define MAX30105_REG_PILOT_PA   0x10
#define MAX30105_REG_MULTI_LED_MODE_CONTROL_1   0x11
#define MAX30105_REG_MULTI_LED_MODE_CONTROL_2   0x12
#define MAX30105_REG_DIE_TEMP_INTEGER   0x1F
#define MAX30105_REG_DIE_TEMP_FRACTION   0x20
#define MAX30105_REG_DIE_TEMP_CONFIG   0x21
#define MAX30105_REG_PROX_INT_THRESH   0x30
#define MAX30105_REG_REVISION_ID   0xFE
#define MAX30105_REG_PART_ID   0xFF

Functions

uint8_t max30105_init (max30105_handle_t *handle)
 initialize the chip
uint8_t max30105_deinit (max30105_handle_t *handle)
 close the chip
uint8_t max30105_irq_handler (max30105_handle_t *handle)
 irq handler
uint8_t max30105_read (max30105_handle_t *handle, uint32_t *raw_red, uint32_t *raw_ir, uint32_t *raw_green, uint8_t *len)
 read the data
uint8_t max30105_read_temperature (max30105_handle_t *handle, uint16_t *raw, float *temp)
 read the temperature
uint8_t max30105_get_interrupt_status (max30105_handle_t *handle, max30105_interrupt_status_t status, max30105_bool_t *enable)
 get the interrupt status
uint8_t max30105_set_interrupt (max30105_handle_t *handle, max30105_interrupt_t type, max30105_bool_t enable)
 set the interrupt bool
uint8_t max30105_get_interrupt (max30105_handle_t *handle, max30105_interrupt_t type, max30105_bool_t *enable)
 get the interrupt bool
uint8_t max30105_set_fifo_write_pointer (max30105_handle_t *handle, uint8_t pointer)
 set the fifo write pointer
uint8_t max30105_get_fifo_write_pointer (max30105_handle_t *handle, uint8_t *pointer)
 get the fifo write pointer
uint8_t max30105_set_fifo_overflow_counter (max30105_handle_t *handle, uint8_t counter)
 set the fifo overflow counter
uint8_t max30105_get_fifo_overflow_counter (max30105_handle_t *handle, uint8_t *counter)
 get the fifo overflow counter
uint8_t max30105_set_fifo_read_pointer (max30105_handle_t *handle, uint8_t pointer)
 set the fifo read pointer
uint8_t max30105_get_fifo_read_pointer (max30105_handle_t *handle, uint8_t *pointer)
 get the fifo read pointer
uint8_t max30105_set_fifo_data (max30105_handle_t *handle, uint8_t data)
 set the fifo data
uint8_t max30105_get_fifo_data (max30105_handle_t *handle, uint8_t *data)
 get the fifo data
uint8_t max30105_set_fifo_sample_averaging (max30105_handle_t *handle, max30105_sample_averaging_t sample)
 set the fifo sample averaging
uint8_t max30105_get_fifo_sample_averaging (max30105_handle_t *handle, max30105_sample_averaging_t *sample)
 get the fifo sample averaging
uint8_t max30105_set_fifo_roll (max30105_handle_t *handle, max30105_bool_t enable)
 enable or disable the fifo roll
uint8_t max30105_get_fifo_roll (max30105_handle_t *handle, max30105_bool_t *enable)
 get the fifo roll status
uint8_t max30105_set_fifo_almost_full (max30105_handle_t *handle, uint8_t value)
 set the fifo almost full value
uint8_t max30105_get_fifo_almost_full (max30105_handle_t *handle, uint8_t *value)
 get the fifo almost full value
uint8_t max30105_set_shutdown (max30105_handle_t *handle, max30105_bool_t enable)
 set the shutdown
uint8_t max30105_get_shutdown (max30105_handle_t *handle, max30105_bool_t *enable)
 get the shutdown
uint8_t max30105_reset (max30105_handle_t *handle)
 reset the chip
uint8_t max30105_set_mode (max30105_handle_t *handle, max30105_mode_t mode)
 set the mode
uint8_t max30105_get_mode (max30105_handle_t *handle, max30105_mode_t *mode)
 get the mode
uint8_t max30105_set_particle_sensing_adc_range (max30105_handle_t *handle, max30105_particle_sensing_adc_range_t range)
 set the particle sensing adc range
uint8_t max30105_get_particle_sensing_adc_range (max30105_handle_t *handle, max30105_particle_sensing_adc_range_t *range)
 get the particle sensing adc range
uint8_t max30105_set_particle_sensing_sample_rate (max30105_handle_t *handle, max30105_particle_sensing_sample_rate_t rate)
 set the particle sensing sample rate
uint8_t max30105_get_particle_sensing_sample_rate (max30105_handle_t *handle, max30105_particle_sensing_sample_rate_t *rate)
 get the particle sensing sample rate
uint8_t max30105_set_adc_resolution (max30105_handle_t *handle, max30105_adc_resolution_t resolution)
 set the adc resolution
uint8_t max30105_get_adc_resolution (max30105_handle_t *handle, max30105_adc_resolution_t *resolution)
 get the adc resolution
uint8_t max30105_set_led_red_pulse_amplitude (max30105_handle_t *handle, uint8_t amp)
 set the red led pulse amplitude
uint8_t max30105_get_led_red_pulse_amplitude (max30105_handle_t *handle, uint8_t *amp)
 get the red led pulse amplitude
uint8_t max30105_set_led_ir_pulse_amplitude (max30105_handle_t *handle, uint8_t amp)
 set the ir led pulse amplitude
uint8_t max30105_get_led_ir_pulse_amplitude (max30105_handle_t *handle, uint8_t *amp)
 get the ir led pulse amplitude
uint8_t max30105_set_led_green_pulse_amplitude (max30105_handle_t *handle, uint8_t amp)
 set the green led pulse amplitude
uint8_t max30105_get_led_green_pulse_amplitude (max30105_handle_t *handle, uint8_t *amp)
 get the green led pulse amplitude
uint8_t max30105_set_led_proximity_pulse_amplitude (max30105_handle_t *handle, uint8_t amp)
 set the proximity led pulse amplitude
uint8_t max30105_get_led_proximity_pulse_amplitude (max30105_handle_t *handle, uint8_t *amp)
 get the proximity led pulse amplitude
uint8_t max30105_set_slot (max30105_handle_t *handle, max30105_slot_t slot, max30105_led_t led)
 set the led slot
uint8_t max30105_get_slot (max30105_handle_t *handle, max30105_slot_t slot, max30105_led_t *led)
 get the led slot
uint8_t max30105_set_die_temperature (max30105_handle_t *handle, max30105_bool_t enable)
 enable or disable die temperature
uint8_t max30105_get_die_temperature (max30105_handle_t *handle, max30105_bool_t *enable)
 get the die temperature status
uint8_t max30105_set_proximity_interrupt_threshold (max30105_handle_t *handle, uint8_t threshold)
 set the proximity interrupt threshold
uint8_t max30105_get_proximity_interrupt_threshold (max30105_handle_t *handle, uint8_t *threshold)
 get the proximity interrupt threshold
uint8_t max30105_proximity_threshold_convert_to_register (max30105_handle_t *handle, uint32_t adc, uint8_t *reg)
 convert the proximity threshold to the register raw data
uint8_t max30105_proximity_threshold_convert_to_data (max30105_handle_t *handle, uint8_t reg, uint32_t *adc)
 convert the register raw data to the proximity threshold
uint8_t max30105_get_id (max30105_handle_t *handle, uint8_t *revision_id, uint8_t *part_id)
 get the chip id
uint8_t max30105_set_reg (max30105_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t max30105_get_reg (max30105_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t max30105_info (max30105_info_t *info)
 get chip's information

Detailed Description

driver max30105 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
2022-01-01

history

Date Version Author Description
2022/01/01 1.0 Shifeng Li first upload

Definition in file driver_max30105.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Maxim Integrated MAX30105"

chip information definition

chip name

Definition at line 42 of file driver_max30105.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_max30105.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Maxim Integrated"

manufacturer name

Definition at line 43 of file driver_max30105.c.

◆ MAX30105_ADDRESS

#define MAX30105_ADDRESS   0xAE

iic address definition

iic address

Definition at line 54 of file driver_max30105.c.

◆ MAX30105_REG_DIE_TEMP_CONFIG

#define MAX30105_REG_DIE_TEMP_CONFIG   0x21

die temperature config register

Definition at line 78 of file driver_max30105.c.

◆ MAX30105_REG_DIE_TEMP_FRACTION

#define MAX30105_REG_DIE_TEMP_FRACTION   0x20

die temperature fraction register

Definition at line 77 of file driver_max30105.c.

◆ MAX30105_REG_DIE_TEMP_INTEGER

#define MAX30105_REG_DIE_TEMP_INTEGER   0x1F

die temperature integer register

Definition at line 76 of file driver_max30105.c.

◆ MAX30105_REG_FIFO_CONFIG

#define MAX30105_REG_FIFO_CONFIG   0x08

fifo config register

Definition at line 67 of file driver_max30105.c.

◆ MAX30105_REG_FIFO_DATA_REGISTER

#define MAX30105_REG_FIFO_DATA_REGISTER   0x07

fifo data register

Definition at line 66 of file driver_max30105.c.

◆ MAX30105_REG_FIFO_READ_POINTER

#define MAX30105_REG_FIFO_READ_POINTER   0x06

fifo read pointer register

Definition at line 65 of file driver_max30105.c.

◆ MAX30105_REG_FIFO_WRITE_POINTER

#define MAX30105_REG_FIFO_WRITE_POINTER   0x04

fifo write pointer register

Definition at line 63 of file driver_max30105.c.

◆ MAX30105_REG_INTERRUPT_ENABLE_1

#define MAX30105_REG_INTERRUPT_ENABLE_1   0x02

interrupt enable 1 register

Definition at line 61 of file driver_max30105.c.

◆ MAX30105_REG_INTERRUPT_ENABLE_2

#define MAX30105_REG_INTERRUPT_ENABLE_2   0x03

interrupt enable 2 register

Definition at line 62 of file driver_max30105.c.

◆ MAX30105_REG_INTERRUPT_STATUS_1

#define MAX30105_REG_INTERRUPT_STATUS_1   0x00

chip register definition

interrupt status 1 register

Definition at line 59 of file driver_max30105.c.

◆ MAX30105_REG_INTERRUPT_STATUS_2

#define MAX30105_REG_INTERRUPT_STATUS_2   0x01

interrupt status 2 register

Definition at line 60 of file driver_max30105.c.

◆ MAX30105_REG_LED_1_PA

#define MAX30105_REG_LED_1_PA   0x0C

led 1 pa register

Definition at line 70 of file driver_max30105.c.

◆ MAX30105_REG_LED_2_PA

#define MAX30105_REG_LED_2_PA   0x0D

led 2 pa register

Definition at line 71 of file driver_max30105.c.

◆ MAX30105_REG_LED_3_PA

#define MAX30105_REG_LED_3_PA   0x0E

led 3 pa register

Definition at line 72 of file driver_max30105.c.

◆ MAX30105_REG_MODE_CONFIG

#define MAX30105_REG_MODE_CONFIG   0x09

mode config register

Definition at line 68 of file driver_max30105.c.

◆ MAX30105_REG_MULTI_LED_MODE_CONTROL_1

#define MAX30105_REG_MULTI_LED_MODE_CONTROL_1   0x11

multi led mode control 1 register

Definition at line 74 of file driver_max30105.c.

◆ MAX30105_REG_MULTI_LED_MODE_CONTROL_2

#define MAX30105_REG_MULTI_LED_MODE_CONTROL_2   0x12

multi led mode control 2 register

Definition at line 75 of file driver_max30105.c.

◆ MAX30105_REG_OVERFLOW_COUNTER

#define MAX30105_REG_OVERFLOW_COUNTER   0x05

overflow counter register

Definition at line 64 of file driver_max30105.c.

◆ MAX30105_REG_PART_ID

#define MAX30105_REG_PART_ID   0xFF

part id register

Definition at line 81 of file driver_max30105.c.

◆ MAX30105_REG_PILOT_PA

#define MAX30105_REG_PILOT_PA   0x10

proximity mode led pulse amplitude register

Definition at line 73 of file driver_max30105.c.

◆ MAX30105_REG_PROX_INT_THRESH

#define MAX30105_REG_PROX_INT_THRESH   0x30

proximity interrupt threshold

Definition at line 79 of file driver_max30105.c.

◆ MAX30105_REG_REVISION_ID

#define MAX30105_REG_REVISION_ID   0xFE

revision id register

Definition at line 80 of file driver_max30105.c.

◆ MAX30105_REG_SPO2_CONFIG

#define MAX30105_REG_SPO2_CONFIG   0x0A

spo2 config register

Definition at line 69 of file driver_max30105.c.

◆ MAX_CURRENT

#define MAX_CURRENT   50.0f

chip max current

Definition at line 46 of file driver_max30105.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   2.0f

chip max supply voltage

Definition at line 45 of file driver_max30105.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.7f

chip min supply voltage

Definition at line 44 of file driver_max30105.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_max30105.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_max30105.c.