![]() |
no-OS
|
Implementation of MAX30009 driver. More...
#include <stdlib.h>#include <string.h>#include <errno.h>#include "max30009.h"#include "no_os_alloc.h"#include "no_os_delay.h"#include "no_os_error.h"#include "no_os_print_log.h"Macros | |
| #define | MAX30009_SPI_READ 0x80 |
| #define | MAX30009_SPI_WRITE 0x00 |
Functions | |
| int | max30009_reg_read_multiple (struct max30009_dev *device, uint8_t reg_addr, uint8_t *data, uint32_t len) |
| Read multiple bytes from register. | |
| int | max30009_reg_read (struct max30009_dev *device, uint8_t reg_addr, uint8_t *data) |
| Read a single byte from register. | |
| int | max30009_reg_write_multiple (struct max30009_dev *device, uint8_t reg_addr, uint8_t *data, uint32_t len) |
| Write multiple bytes to register. | |
| int | max30009_reg_write (struct max30009_dev *device, uint8_t reg_addr, uint8_t data) |
| Write a single byte to register. | |
| int | max30009_reg_update (struct max30009_dev *device, uint8_t reg_addr, uint8_t mask, uint8_t value) |
| Update specific bits in a register. | |
| int | max30009_soft_reset (struct max30009_dev *device) |
| Perform software reset. | |
| int | max30009_verify_part_id (struct max30009_dev *device) |
| Read device part ID. | |
| int | max30009_set_power_mode (struct max30009_dev *device, bool shutdown) |
| Set power mode (shutdown or active) | |
| int | max30009_init (struct max30009_dev **device, struct max30009_init_param *init_param) |
| Initialize the MAX30009 device. | |
| int | max30009_remove (struct max30009_dev *device) |
| Remove the MAX30009 device and free resources. | |
| int | max30009_get_status (struct max30009_dev *device, struct max30009_status *status) |
| Get device status. | |
| int | max30009_check_lead_off (struct max30009_dev *device, bool *leads_on) |
| Check lead-off detection status. | |
| int | max30009_fifo_flush (struct max30009_dev *device) |
| Flush FIFO contents. | |
| int | max30009_fifo_get_count (struct max30009_dev *device, uint16_t *count) |
| Get FIFO data count. | |
| int | max30009_fifo_get_ovf_count (struct max30009_dev *device, uint16_t *count) |
| Get FIFO overflow data count. | |
| int | max30009_read_fifo_data (struct max30009_dev *device, uint8_t *data, uint32_t len) |
| Read data from FIFO. | |
| int | max30009_fifo_decode_sample (uint8_t *raw_data, struct max30009_fifo_sample *sample) |
| Decode a 3-byte FIFO sample into type and data. | |
| int | max30009_get_fifo_pointers (struct max30009_dev *device, uint8_t *write_ptr, uint8_t *read_ptr) |
| Get FIFO read and write pointers. | |
| int | max30009_set_fifo_watermark (struct max30009_dev *device, uint8_t watermark) |
| Set FIFO watermark level. | |
| int | max30009_get_fifo_watermark (struct max30009_dev *device, uint8_t *watermark) |
| Gets the FIFO watermark level of the device. | |
| int | max30009_set_fifo_rollover (struct max30009_dev *device, bool rollover) |
| Set FIFO rollover mode. | |
| int | max30009_set_a_full_type (struct max30009_dev *device, bool type) |
| Set almost-full interrupt type. | |
| int | max30009_insert_fifo_marker (struct max30009_dev *device) |
| Insert marker into FIFO data stream. | |
| int | max30009_clear_fifo_status (struct max30009_dev *device) |
| Clear FIFO status flags. | |
| int | max30009_timing_system_reset (struct max30009_dev *device) |
| Trigger timing system reset for PLL synchronization. | |
| int | max30009_set_master_mode (struct max30009_dev *device, bool is_master) |
| Set master/slave mode for PLL synchronization. | |
| int | max30009_configure_int_pin (struct max30009_dev *device, uint8_t func_cfg, uint8_t out_cfg) |
| Configure INT pin function and output. | |
| int | max30009_configure_trig_pin (struct max30009_dev *device, uint8_t input_cfg, uint8_t output_cfg) |
| Configure TRIG pin input and output. | |
| int | max30009_configure_i2c_broadcast (struct max30009_dev *device, bool enable, uint8_t broadcast_addr) |
| Configure I2C broadcast address. | |
| int | max30009_disable_i2c (struct max30009_dev *device) |
| Disable I2C interface (SPI only mode) | |
| int | max30009_pll_set_dividers (struct max30009_dev *device, uint16_t mdiv, enum max30009_pll_ndiv ndiv, enum max30009_pll_kdiv kdiv) |
| Configure PLL dividers. | |
| int | max30009_pll_enable (struct max30009_dev *device, bool enable) |
| Enable or disable PLL. | |
| int | max30009_pll_set_lock_window (struct max30009_dev *device, bool lock_window) |
| Set PLL lock window. | |
| int | max30009_set_clock_source (struct max30009_dev *device, bool use_external, bool use_32768_hz) |
| Configure clock source. | |
| int | max30009_clock_fine_tune (struct max30009_dev *device, uint8_t tune_val) |
| Fine tune internal clock frequency. | |
| int | max30009_bioz_enable (struct max30009_dev *device, bool enable) |
| Enable or disable BioZ measurement. | |
| int | max30009_bioz_i_enable (struct max30009_dev *device, bool enable) |
| Enable or disable BioZ I channel. | |
| int | max30009_bioz_q_enable (struct max30009_dev *device, bool enable) |
| Enable or disable BioZ Q channel. | |
| int | max30009_bioz_bg_enable (struct max30009_dev *device, bool enable) |
| Enable or disable BioZ bandgap. | |
| int | max30009_set_dac_osr (struct max30009_dev *device, enum max30009_dac_osr osr) |
| Set DAC oversampling ratio. | |
| int | max30009_set_adc_osr (struct max30009_dev *device, enum max30009_adc_osr osr) |
| Set ADC oversampling ratio. | |
| int | max30009_set_digital_hpf (struct max30009_dev *device, enum max30009_dhpf dhpf) |
| Set digital high-pass filter. | |
| int | max30009_set_digital_lpf (struct max30009_dev *device, enum max30009_dlpf dlpf) |
| Set digital low-pass filter. | |
| int | max30009_set_analog_hpf (struct max30009_dev *device, enum max30009_ahpf ahpf) |
| Set analog high-pass filter. | |
| int | max30009_set_drive_mode (struct max30009_dev *device, enum max30009_drive_mode mode) |
| Set drive mode (current, voltage, H-bridge, or standby) | |
| int | max30009_set_drive_current_detailed (struct max30009_dev *device, uint8_t idrv_range, uint8_t vdrv_mag) |
| Set drive current with detailed control. | |
| int | max30009_enable_external_resistor (struct max30009_dev *device, bool enable) |
| Enable or disable external resistor for current drive. | |
| int | max30009_enable_rapid_lead_off (struct max30009_dev *device, bool enable) |
| Enable or disable rapid lead-off detection. | |
| int | max30009_enable_fast_start (struct max30009_dev *device, bool enable, bool manual) |
| Enable or disable fast start mode. | |
| int | max30009_set_ina_mode (struct max30009_dev *device, bool low_power) |
| Set INA (Instrumentation Amplifier) mode. | |
| int | max30009_disable_differential_mode (struct max30009_dev *device, bool disable) |
| Disable differential mode (enable single-ended) | |
| int | max30009_set_amp_range (struct max30009_dev *device, uint8_t amp_range) |
| Set amplifier range. | |
| int | max30009_set_amp_bandwidth (struct max30009_dev *device, uint8_t amp_bw) |
| Set amplifier bandwidth. | |
| int | max30009_enable_external_cap (struct max30009_dev *device, bool enable) |
| Enable or disable external capacitor. | |
| int | max30009_enable_dc_restore (struct max30009_dev *device, bool enable) |
| Enable or disable DC restore circuit. | |
| int | max30009_enable_drive_reset (struct max30009_dev *device, bool enable) |
| Enable or disable drive reset. | |
| int | max30009_enable_dac_reset (struct max30009_dev *device, bool enable) |
| Enable or disable DAC reset. | |
| int | max30009_set_comparison_mode (struct max30009_dev *device, uint8_t cmp_mode) |
| Set comparison mode for threshold detection. | |
| int | max30009_enable_bioz_threshold (struct max30009_dev *device, bool enable) |
| Enable or disable BioZ threshold detection. | |
| int | max30009_set_bioz_thresholds (struct max30009_dev *device, uint8_t low_thresh, uint8_t high_thresh) |
| Set BioZ threshold values. | |
| int | max30009_set_demod_clk_phases (struct max30009_dev *device, bool i_clk_phase, bool q_clk_phase) |
| Set demodulation clock phases. | |
| int | max30009_enable_ina_chopping (struct max30009_dev *device, bool enable) |
| Enable or disable INA chopping. | |
| int | max30009_set_channel_freq_select (struct max30009_dev *device, bool fsel) |
| Set channel frequency select. | |
| int | max30009_enable_standby_mode (struct max30009_dev *device, bool keep_rx_on) |
| Enable or disable standby mode. | |
| int | max30009_enable_calibration (struct max30009_dev *device, bool enable) |
| Enable or disable calibration mode. | |
| int | max30009_enable_calibration_mux (struct max30009_dev *device, bool enable) |
| Enable or disable calibration MUX. | |
| int | max30009_calibration_connect_only (struct max30009_dev *device, bool cal_only) |
| Set calibration connect-only mode. | |
| int | max30009_set_bia_load_resistor (struct max30009_dev *device, enum max30009_bia_rsel rsel) |
| Set BIA (Body Impedance Analysis) load resistor. | |
| int | max30009_enable_bia_bist (struct max30009_dev *device, bool enable) |
| Enable or disable BIA BIST (Built-In Self Test) | |
| int | max30009_set_gsr_load_resistor (struct max30009_dev *device, enum max30009_gsr_rsel rsel) |
| Set GSR (Galvanic Skin Response) load resistor. | |
| int | max30009_enable_gsr_load (struct max30009_dev *device, bool enable) |
| Enable or disable GSR load resistor. | |
| int | max30009_enable_internal_load (struct max30009_dev *device, bool enable) |
| Enable or disable internal load resistor. | |
| int | max30009_enable_external_load (struct max30009_dev *device, bool enable) |
| Enable or disable external load connection. | |
| int | max30009_assign_electrodes (struct max30009_dev *device, uint8_t bip_assign, uint8_t bin_assign, uint8_t drvp_assign, uint8_t drvn_assign) |
| Assign electrodes to measurement channels. | |
| int | max30009_read_bist_error (struct max30009_dev *device, uint8_t *error) |
| Read BIST error value. | |
| int | max30009_lead_off_config (struct max30009_dev *device, bool enable, uint8_t threshold) |
| Configure lead-off detection. | |
| int | max30009_set_lead_off_current (struct max30009_dev *device, enum max30009_loff_current current) |
| Set lead-off detection current magnitude. | |
| int | max30009_set_lead_off_polarity (struct max30009_dev *device, bool positive) |
| Set lead-off detection current polarity. | |
| int | max30009_enable_external_lead_off (struct max30009_dev *device, bool enable) |
| Enable or disable external lead-off detection. | |
| int | max30009_enable_drive_oor_detect (struct max30009_dev *device, bool enable) |
| Enable or disable drive out-of-range detection. | |
| int | max30009_enable_ultra_low_power_lead_on (struct max30009_dev *device, bool enable) |
| Enable or disable ultra-low-power lead-on detection. | |
| int | max30009_get_detailed_lead_status (struct max30009_dev *device, struct max30009_lead_status *status) |
| Get detailed lead detection status. | |
| int | max30009_set_lead_bias (struct max30009_dev *device, enum max30009_rbias_val rbias_value, bool enable_bip, bool enable_bin) |
| Configure lead bias resistor and enable for receive electrodes. | |
| int | max30009_set_pll_config (struct max30009_dev *device, struct max30009_pll_config *pll_config) |
| Set complete PLL configuration. | |
| int | max30009_get_pll_config (struct max30009_dev *device, struct max30009_pll_config *pll_config) |
| Get complete PLL configuration. | |
| int | max30009_set_fifo_config (struct max30009_dev *device, struct max30009_fifo_config *fifo_config) |
| Set complete FIFO configuration. | |
| int | max30009_get_fifo_config (struct max30009_dev *device, struct max30009_fifo_config *fifo_config) |
| Get complete FIFO configuration. | |
| int | max30009_set_bioz_config (struct max30009_dev *device, struct max30009_bioz_config *bioz_config) |
| Set complete BioZ configuration. | |
| int | max30009_get_bioz_config (struct max30009_dev *device, struct max30009_bioz_config *bioz_config) |
| Get complete BioZ configuration. | |
| int | max30009_set_bioz_mux_config (struct max30009_dev *device, struct max30009_bioz_mux_config *mux_config) |
| Set complete BioZ MUX configuration. | |
| int | max30009_get_bioz_mux_config (struct max30009_dev *device, struct max30009_bioz_mux_config *mux_config) |
| Get complete BioZ MUX configuration. | |
| int | max30009_set_lead_detect_config (struct max30009_dev *device, struct max30009_lead_detect_config *lead_config) |
| Set complete lead detection configuration. | |
| int | max30009_get_lead_detect_config (struct max30009_dev *device, struct max30009_lead_detect_config *lead_config) |
| Get complete lead detection configuration. | |
| int | max30009_interrupt_config (struct max30009_dev *device, uint8_t int1_mask, uint8_t int2_mask) |
| Configure interrupt enables. | |
| int | max30009_enable_interrupt (struct max30009_dev *device, enum max30009_interrupt interrupt, bool enable) |
| Enable or disable a specific interrupt. | |
| int | max30009_clear_status (struct max30009_dev *device) |
| Clear interrupt status registers. | |
Implementation of MAX30009 driver.
Copyright 2026(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define MAX30009_SPI_READ 0x80 |
| #define MAX30009_SPI_WRITE 0x00 |
| int max30009_assign_electrodes | ( | struct max30009_dev * | device, |
| uint8_t | bip_assign, | ||
| uint8_t | bin_assign, | ||
| uint8_t | drvp_assign, | ||
| uint8_t | drvn_assign ) |
Assign electrodes to measurement channels.
| device | - Device descriptor |
| bip_assign | - BIP (positive receive) electrode assignment |
| bin_assign | - BIN (negative receive) electrode assignment |
| drvp_assign | - DRVP (positive drive) electrode assignment |
| drvn_assign | - DRVN (negative drive) electrode assignment |
| int max30009_bioz_bg_enable | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable BioZ bandgap.
| device | - MAX30009 device descriptor |
| enable | - True to enable bandgap, false to disable |
| int max30009_bioz_enable | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable BioZ measurement.
| device | - MAX30009 device descriptor |
| enable | - True to enable BioZ, false to disable |
| int max30009_bioz_i_enable | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable BioZ I channel.
| device | - MAX30009 device descriptor |
| enable | - True to enable I channel, false to disable |
| int max30009_bioz_q_enable | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable BioZ Q channel.
| device | - MAX30009 device descriptor |
| enable | - True to enable Q channel, false to disable |
| int max30009_calibration_connect_only | ( | struct max30009_dev * | device, |
| bool | cal_only ) |
Set calibration connect-only mode.
| device | - Device descriptor |
| cal_only | - True for connect-only mode, false for normal |
| int max30009_check_lead_off | ( | struct max30009_dev * | device, |
| bool * | leads_on ) |
Check lead-off detection status.
| device | - MAX30009 device descriptor |
| leads_on | - True if leads connected |
| int max30009_clear_fifo_status | ( | struct max30009_dev * | device | ) |
Clear FIFO status flags.
| device | - Device descriptor |
| int max30009_clear_status | ( | struct max30009_dev * | device | ) |
Clear interrupt status registers.
| device | - MAX30009 device descriptor |
| int max30009_clock_fine_tune | ( | struct max30009_dev * | device, |
| uint8_t | tune_val ) |
Fine tune internal clock frequency.
| device | - Device descriptor |
| tune_val | - Fine tune value (0-31, ±0.78% adjustment range) |
| int max30009_configure_i2c_broadcast | ( | struct max30009_dev * | device, |
| bool | enable, | ||
| uint8_t | broadcast_addr ) |
Configure I2C broadcast address.
| device | - Device descriptor |
| enable | - True to enable broadcast, false to disable |
| broadcast_addr | - Broadcast address (7-bit, shifted left by 1) |
| int max30009_configure_int_pin | ( | struct max30009_dev * | device, |
| uint8_t | func_cfg, | ||
| uint8_t | out_cfg ) |
Configure INT pin function and output.
| device | - Device descriptor |
| func_cfg | - Function configuration (0-3) |
| out_cfg | - Output configuration (0-3) |
| int max30009_configure_trig_pin | ( | struct max30009_dev * | device, |
| uint8_t | input_cfg, | ||
| uint8_t | output_cfg ) |
Configure TRIG pin input and output.
| device | - Device descriptor |
| input_cfg | - Input configuration (0 or 1) |
| output_cfg | - Output configuration (0-3) |
| int max30009_disable_differential_mode | ( | struct max30009_dev * | device, |
| bool | disable ) |
Disable differential mode (enable single-ended)
| device | - Device descriptor |
| disable | - True to disable differential mode, false for differential |
| int max30009_disable_i2c | ( | struct max30009_dev * | device | ) |
Disable I2C interface (SPI only mode)
| device | - Device descriptor |
| int max30009_enable_bia_bist | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable BIA BIST (Built-In Self Test)
| device | - Device descriptor |
| enable | - True to enable BIST, false to disable |
| int max30009_enable_bioz_threshold | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable BioZ threshold detection.
| device | - Device descriptor |
| enable | - True to enable threshold detection, false to disable |
| int max30009_enable_calibration | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable calibration mode.
| device | - Device descriptor |
| enable | - True to enable calibration, false to disable |
| int max30009_enable_calibration_mux | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable calibration MUX.
| device | - Device descriptor |
| enable | - True to enable calibration MUX, false to disable |
| int max30009_enable_dac_reset | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable DAC reset.
| device | - Device descriptor |
| enable | - True to enable DAC reset, false to disable |
| int max30009_enable_dc_restore | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable DC restore circuit.
| device | - Device descriptor |
| enable | - True to enable DC restore, false to disable |
| int max30009_enable_drive_oor_detect | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable drive out-of-range detection.
| device | - Device descriptor |
| enable | - True to enable drive OOR detection, false to disable |
| int max30009_enable_drive_reset | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable drive reset.
| device | - Device descriptor |
| enable | - True to enable drive reset, false to disable |
| int max30009_enable_external_cap | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable external capacitor.
| device | - Device descriptor |
| enable | - True to enable external capacitor, false to disable |
| int max30009_enable_external_lead_off | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable external lead-off detection.
| device | - Device descriptor |
| enable | - True to enable external lead-off detection, false to disable |
| int max30009_enable_external_load | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable external load connection.
| device | - Device descriptor |
| enable | - True to enable external load connection, false to disable |
| int max30009_enable_external_resistor | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable external resistor for current drive.
| device | - Device descriptor |
| enable | - True to enable external resistor, false to disable |
| int max30009_enable_fast_start | ( | struct max30009_dev * | device, |
| bool | enable, | ||
| bool | manual ) |
Enable or disable fast start mode.
| device | - Device descriptor |
| enable | - True to enable fast start, false to disable |
| manual | - True for manual trigger, false for automatic |
| int max30009_enable_gsr_load | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable GSR load resistor.
| device | - Device descriptor |
| enable | - True to enable GSR load, false to disable |
| int max30009_enable_ina_chopping | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable INA chopping.
| device | - Device descriptor |
| enable | - True to enable chopping (improves CMRR), false to disable |
| int max30009_enable_internal_load | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable internal load resistor.
| device | - Device descriptor |
| enable | - True to enable internal load, false to disable |
| int max30009_enable_interrupt | ( | struct max30009_dev * | device, |
| enum max30009_interrupt | interrupt, | ||
| bool | enable ) |
Enable or disable a specific interrupt.
| device | - MAX30009 device descriptor |
| interrupt | - Interrupt type from max30009_interrupt enum |
| enable | - True to enable, false to disable |
| int max30009_enable_rapid_lead_off | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable rapid lead-off detection.
| device | - Device descriptor |
| enable | - True to enable rapid mode, false for normal |
| int max30009_enable_standby_mode | ( | struct max30009_dev * | device, |
| bool | keep_rx_on ) |
Enable or disable standby mode.
| device | - Device descriptor |
| keep_rx_on | - True to keep receive path on in standby, false to power down completely |
| int max30009_enable_ultra_low_power_lead_on | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable ultra-low-power lead-on detection.
| device | - Device descriptor |
| enable | - True to enable ULP lead-on detection, false to disable |
| int max30009_fifo_decode_sample | ( | uint8_t * | raw_data, |
| struct max30009_fifo_sample * | sample ) |
Decode a 3-byte FIFO sample into type and data.
| raw_data | - 3-byte raw FIFO data |
| sample | - Pointer to store decoded sample (type and data) |
FIFO Data Format (24 bits total):
TAG Values:
| int max30009_fifo_flush | ( | struct max30009_dev * | device | ) |
Flush FIFO contents.
| device | - MAX30009 device descriptor |
| int max30009_fifo_get_count | ( | struct max30009_dev * | device, |
| uint16_t * | count ) |
Get FIFO data count.
| device | - MAX30009 device descriptor |
| count | - Pointer to store FIFO data count (0-256) |
| int max30009_fifo_get_ovf_count | ( | struct max30009_dev * | device, |
| uint16_t * | count ) |
Get FIFO overflow data count.
| device | - MAX30009 device descriptor |
| count | - Pointer to store FIFO overflow data count (0-128) |
| int max30009_get_bioz_config | ( | struct max30009_dev * | device, |
| struct max30009_bioz_config * | bioz_config ) |
Get complete BioZ configuration.
| device | - Device descriptor |
| bioz_config | - Pointer to store BioZ configuration |
| int max30009_get_bioz_mux_config | ( | struct max30009_dev * | device, |
| struct max30009_bioz_mux_config * | mux_config ) |
Get complete BioZ MUX configuration.
| device | - Device descriptor |
| mux_config | - Pointer to store BioZ MUX configuration |
| int max30009_get_detailed_lead_status | ( | struct max30009_dev * | device, |
| struct max30009_lead_status * | status ) |
Get detailed lead detection status.
| device | - Device descriptor |
| status | - Pointer to store detailed lead status information |
| int max30009_get_fifo_config | ( | struct max30009_dev * | device, |
| struct max30009_fifo_config * | fifo_config ) |
Get complete FIFO configuration.
| device | - Device descriptor |
| fifo_config | - Pointer to store FIFO configuration |
| int max30009_get_fifo_pointers | ( | struct max30009_dev * | device, |
| uint8_t * | write_ptr, | ||
| uint8_t * | read_ptr ) |
Get FIFO read and write pointers.
| device | - Device descriptor |
| write_ptr | - Pointer to store write pointer value (0-255) |
| read_ptr | - Pointer to store read pointer value (0-255) |
| int max30009_get_fifo_watermark | ( | struct max30009_dev * | device, |
| uint8_t * | watermark ) |
Gets the FIFO watermark level of the device.
| device | - Device descriptor. |
| watermark | - Pointer to a variable where the current FIFO watermark level |
| int max30009_get_lead_detect_config | ( | struct max30009_dev * | device, |
| struct max30009_lead_detect_config * | lead_config ) |
Get complete lead detection configuration.
| device | - Device descriptor |
| lead_config | - Pointer to store lead detection configuration |
| int max30009_get_pll_config | ( | struct max30009_dev * | device, |
| struct max30009_pll_config * | pll_config ) |
Get complete PLL configuration.
| device | - Device descriptor |
| pll_config | - Pointer to store PLL configuration |
| int max30009_get_status | ( | struct max30009_dev * | device, |
| struct max30009_status * | status ) |
Get device status.
| device | - MAX30009 device descriptor |
| status | - Pointer to store device status information |
| int max30009_init | ( | struct max30009_dev ** | device, |
| struct max30009_init_param * | init_param ) |
Initialize the MAX30009 device.
| device | - Pointer to the device descriptor pointer |
| init_param | - Initialization parameters |
| int max30009_insert_fifo_marker | ( | struct max30009_dev * | device | ) |
Insert marker into FIFO data stream.
| device | - Device descriptor |
| int max30009_interrupt_config | ( | struct max30009_dev * | device, |
| uint8_t | int1_mask, | ||
| uint8_t | int2_mask ) |
Configure interrupt enables.
| device | - MAX30009 device descriptor |
| int1_mask | - Interrupt enable mask for INTERRUPT_ENABLE1 register |
| int2_mask | - Interrupt enable mask for INTERRUPT_ENABLE2 register |
| int max30009_lead_off_config | ( | struct max30009_dev * | device, |
| bool | enable, | ||
| uint8_t | threshold ) |
Configure lead-off detection.
| device | - MAX30009 device descriptor |
| enable | - True to enable lead-off detection, false to disable |
| threshold | - Lead-off detection threshold (0-15) |
| int max30009_pll_enable | ( | struct max30009_dev * | device, |
| bool | enable ) |
Enable or disable PLL.
| device | - Device descriptor |
| enable | - True to enable PLL, false to disable |
| int max30009_pll_set_dividers | ( | struct max30009_dev * | device, |
| uint16_t | mdiv, | ||
| enum max30009_pll_ndiv | ndiv, | ||
| enum max30009_pll_kdiv | kdiv ) |
Configure PLL dividers.
| device | - Device descriptor |
| mdiv | - M divider value (0-1023, PLL_CLK = (MDIV+1) × REF_CLK) |
| ndiv | - N divider value (MAX30009_NDIV_512 or MAX30009_NDIV_1024) |
| kdiv | - K divider value (MAX30009_KDIV_1 to MAX30009_KDIV_8192) |
| int max30009_pll_set_lock_window | ( | struct max30009_dev * | device, |
| bool | lock_window ) |
Set PLL lock window.
| device | - Device descriptor |
| lock_window | - True to enable extended lock window, false for normal |
| int max30009_read_bist_error | ( | struct max30009_dev * | device, |
| uint8_t * | error ) |
Read BIST error value.
| device | - Device descriptor |
| error | - Pointer to store BIST error value |
| int max30009_read_fifo_data | ( | struct max30009_dev * | device, |
| uint8_t * | data, | ||
| uint32_t | len ) |
Read data from FIFO.
| device | - MAX30009 device descriptor |
| data | - Buffer to store FIFO data |
| len | Number of bytes to read from the FIFO. |
| int max30009_reg_read | ( | struct max30009_dev * | device, |
| uint8_t | reg_addr, | ||
| uint8_t * | data ) |
Read a single byte from register.
| device | - MAX30009 device descriptor |
| reg_addr | - Register address to read from |
| data | - Pointer to variable where read byte will be stored |
| int max30009_reg_read_multiple | ( | struct max30009_dev * | device, |
| uint8_t | reg_addr, | ||
| uint8_t * | data, | ||
| uint32_t | len ) |
Read multiple bytes from register.
| device | - MAX30009 device descriptor |
| reg_addr | - Register address to read from |
| data | - Pointer to buffer where read data will be stored |
| len | - Number of bytes to read |
| int max30009_reg_update | ( | struct max30009_dev * | device, |
| uint8_t | reg_addr, | ||
| uint8_t | mask, | ||
| uint8_t | value ) |
Update specific bits in a register.
| device | - MAX30009 device descriptor |
| reg_addr | - Register address to update |
| mask | - Bit mask indicating which bits to update |
| value | - New value for the field, given in raw (unshifted) form. It is shifted into the mask position internally via no_os_field_prep, so callers must NOT pre-shift with no_os_field_prep. |
| int max30009_reg_write | ( | struct max30009_dev * | device, |
| uint8_t | reg_addr, | ||
| uint8_t | data ) |
Write a single byte to register.
| device | - MAX30009 device descriptor |
| reg_addr | - Register address to write to |
| data | - Byte value to be written |
| int max30009_reg_write_multiple | ( | struct max30009_dev * | device, |
| uint8_t | reg_addr, | ||
| uint8_t * | data, | ||
| uint32_t | len ) |
Write multiple bytes to register.
| device | - MAX30009 device descriptor |
| reg_addr | - Register address to write to |
| data | - Pointer to buffer containing data to be written |
| len | - Number of bytes to write |
| int max30009_remove | ( | struct max30009_dev * | device | ) |
Remove the MAX30009 device and free resources.
| device | - MAX30009 device descriptor |
| int max30009_set_a_full_type | ( | struct max30009_dev * | device, |
| bool | type ) |
Set almost-full interrupt type.
| device | - Device descriptor |
| type | - True for asserted when count >= threshold, False for count > threshold |
| int max30009_set_adc_osr | ( | struct max30009_dev * | device, |
| enum max30009_adc_osr | osr ) |
Set ADC oversampling ratio.
| device | - Device descriptor |
| osr | - ADC OSR value (MAX30009_ADC_OSR_8 through _1024) |
| int max30009_set_amp_bandwidth | ( | struct max30009_dev * | device, |
| uint8_t | amp_bw ) |
Set amplifier bandwidth.
| device | - Device descriptor |
| amp_bw | - Amplifier bandwidth setting (0-3) |
| int max30009_set_amp_range | ( | struct max30009_dev * | device, |
| uint8_t | amp_range ) |
Set amplifier range.
| device | - Device descriptor |
| amp_range | - Amplifier range setting (0-3) |
| int max30009_set_analog_hpf | ( | struct max30009_dev * | device, |
| enum max30009_ahpf | ahpf ) |
Set analog high-pass filter.
| device | - Device descriptor |
| ahpf | - Analog HPF setting (BYPASS, or 100Hz-10kHz) |
| int max30009_set_bia_load_resistor | ( | struct max30009_dev * | device, |
| enum max30009_bia_rsel | rsel ) |
Set BIA (Body Impedance Analysis) load resistor.
| device | - Device descriptor |
| rsel | - Resistor selection (280, 600, 900, or 5100 ohms) |
| int max30009_set_bioz_config | ( | struct max30009_dev * | device, |
| struct max30009_bioz_config * | bioz_config ) |
Set complete BioZ configuration.
| device | - Device descriptor |
| bioz_config | - BioZ configuration structure |
| int max30009_set_bioz_mux_config | ( | struct max30009_dev * | device, |
| struct max30009_bioz_mux_config * | mux_config ) |
Set complete BioZ MUX configuration.
| device | - Device descriptor |
| mux_config | - BioZ MUX configuration structure |
| int max30009_set_bioz_thresholds | ( | struct max30009_dev * | device, |
| uint8_t | low_thresh, | ||
| uint8_t | high_thresh ) |
Set BioZ threshold values.
| device | - Device descriptor |
| low_thresh | - Low threshold value (0-255) |
| high_thresh | - High threshold value (0-255) |
| int max30009_set_channel_freq_select | ( | struct max30009_dev * | device, |
| bool | fsel ) |
Set channel frequency select.
| device | - Device descriptor |
| fsel | - Frequency select bit |
| int max30009_set_clock_source | ( | struct max30009_dev * | device, |
| bool | use_external, | ||
| bool | use_32768_hz ) |
Configure clock source.
| device | - Device descriptor |
| use_external | - True for external clock, false for internal oscillator |
| use_32768_hz | - True for 32.768 kHz, false for 32.0 kHz |
| int max30009_set_comparison_mode | ( | struct max30009_dev * | device, |
| uint8_t | cmp_mode ) |
Set comparison mode for threshold detection.
| device | - Device descriptor |
| cmp_mode | - Comparison mode (0-3) |
| int max30009_set_dac_osr | ( | struct max30009_dev * | device, |
| enum max30009_dac_osr | osr ) |
Set DAC oversampling ratio.
| device | - Device descriptor |
| osr | - DAC OSR value (MAX30009_DAC_OSR_32, _64, _128, or _256) |
| int max30009_set_demod_clk_phases | ( | struct max30009_dev * | device, |
| bool | i_clk_phase, | ||
| bool | q_clk_phase ) |
Set demodulation clock phases.
| device | - Device descriptor |
| i_clk_phase | - I channel clock phase (true for inverted) |
| q_clk_phase | - Q channel clock phase (true for inverted) |
| int max30009_set_digital_hpf | ( | struct max30009_dev * | device, |
| enum max30009_dhpf | dhpf ) |
Set digital high-pass filter.
| device | - Device descriptor |
| dhpf | - Digital HPF setting |
| int max30009_set_digital_lpf | ( | struct max30009_dev * | device, |
| enum max30009_dlpf | dlpf ) |
Set digital low-pass filter.
| device | - Device descriptor |
| dlpf | - Digital LPF setting |
| int max30009_set_drive_current_detailed | ( | struct max30009_dev * | device, |
| uint8_t | idrv_range, | ||
| uint8_t | vdrv_mag ) |
Set drive current with detailed control.
| device | - Device descriptor |
| idrv_range | - Current range setting (0-3) |
| vdrv_mag | - Voltage magnitude setting (0-3) |
| int max30009_set_drive_mode | ( | struct max30009_dev * | device, |
| enum max30009_drive_mode | mode ) |
Set drive mode (current, voltage, H-bridge, or standby)
| device | - Device descriptor |
| mode | - Drive mode (SINE_CURRENT, SINE_VOLTAGE, H_BRIDGE, or STANDBY) |
| int max30009_set_fifo_config | ( | struct max30009_dev * | device, |
| struct max30009_fifo_config * | fifo_config ) |
Set complete FIFO configuration.
| device | - Device descriptor |
| fifo_config | - FIFO configuration structure |
| int max30009_set_fifo_rollover | ( | struct max30009_dev * | device, |
| bool | rollover ) |
Set FIFO rollover mode.
| device | - Device descriptor |
| rollover | - True to enable rollover mode, false to stop when full |
| int max30009_set_fifo_watermark | ( | struct max30009_dev * | device, |
| uint8_t | watermark ) |
Set FIFO watermark level.
| device | - Device descriptor |
| watermark | - Watermark level (number of samples before FIFO generates an interrupt). |
| int max30009_set_gsr_load_resistor | ( | struct max30009_dev * | device, |
| enum max30009_gsr_rsel | rsel ) |
Set GSR (Galvanic Skin Response) load resistor.
| device | - Device descriptor |
| rsel | - Resistor selection (25.7k, 101k, 505k, or 1M ohms) |
| int max30009_set_ina_mode | ( | struct max30009_dev * | device, |
| bool | low_power ) |
Set INA (Instrumentation Amplifier) mode.
| device | - Device descriptor |
| low_power | - True for low-power mode, false for low-noise mode |
| int max30009_set_lead_bias | ( | struct max30009_dev * | device, |
| enum max30009_rbias_val | rbias_value, | ||
| bool | enable_bip, | ||
| bool | enable_bin ) |
Configure lead bias resistor and enable for receive electrodes.
| device | - Device descriptor |
| rbias_value | - Bias resistor value (50M, 100M, 200M ohms) |
| enable_bip | - True to enable bias on BIP (positive receive) electrode |
| enable_bin | - True to enable bias on BIN (negative receive) electrode |
| int max30009_set_lead_detect_config | ( | struct max30009_dev * | device, |
| struct max30009_lead_detect_config * | lead_config ) |
Set complete lead detection configuration.
| device | - Device descriptor |
| lead_config | - Lead detection configuration structure |
| int max30009_set_lead_off_current | ( | struct max30009_dev * | device, |
| enum max30009_loff_current | current ) |
Set lead-off detection current magnitude.
| device | - Device descriptor |
| current | - Lead-off current setting (5nA, 11nA, 22nA, 55nA, or 110nA) |
| int max30009_set_lead_off_polarity | ( | struct max30009_dev * | device, |
| bool | positive ) |
Set lead-off detection current polarity.
| device | - Device descriptor |
| positive | - True for positive polarity, false for negative polarity |
| int max30009_set_master_mode | ( | struct max30009_dev * | device, |
| bool | is_master ) |
Set master/slave mode for PLL synchronization.
| device | - Device descriptor |
| is_master | - True for master mode (generates FCLK_SYS), False for slave mode (uses external FCLK_SYS) |
| int max30009_set_pll_config | ( | struct max30009_dev * | device, |
| struct max30009_pll_config * | pll_config ) |
Set complete PLL configuration.
| device | - Device descriptor |
| pll_config | - PLL configuration structure |
| int max30009_set_power_mode | ( | struct max30009_dev * | device, |
| bool | shutdown ) |
Set power mode (shutdown or active)
| device | - MAX30009 device descriptor |
| shutdown | - True to enter shutdown mode, false for active mode |
| int max30009_soft_reset | ( | struct max30009_dev * | device | ) |
Perform software reset.
| device | - MAX30009 device descriptor |
| int max30009_timing_system_reset | ( | struct max30009_dev * | device | ) |
Trigger timing system reset for PLL synchronization.
| device | - Device descriptor |
| int max30009_verify_part_id | ( | struct max30009_dev * | device | ) |
Read device part ID.
| device | - MAX30009 device descriptor |