no-OS
Loading...
Searching...
No Matches
admt4000.h File Reference

Header Implementation of ADMT4000 Driver. More...

#include "no_os_spi.h"
#include "no_os_gpio.h"
#include "no_os_util.h"
#include "no_os_units.h"
Include dependency graph for admt4000.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  admt4000_harmonic_coeff
 Harmonic calibration coefficient. More...
 
struct  admt4000_harmonics_calib
 Harmonic calibration data for all harmonics. More...
 
struct  admt4000_gpio
 GPIO state and configuration. More...
 
struct  admt4000_gpio_init_param
 GPIO initialization parameters. More...
 
struct  admt4000_init_param
 ADMT4000 initialization parameters. More...
 
struct  admt4000_dev
 ADMT4000 device descriptor. More...
 

Macros

#define ADMT4000_REG_RST   0x00
 
#define ADMT4000_AGP_REG_CNVPAGE   0x01
 
#define ADMT4000_AGP_REG_ABSANGLE   0x03
 
#define ADMT4000_AGP_REG_DGIO   0x04
 
#define ADMT4000_AGP_REG_ANGLE   0x05
 
#define ADMT4000_AGP_REG_FAULT   0x06
 
#define ADMT4000_00_REG_SINE   0x10
 
#define ADMT4000_00_REG_COSINE   0x11
 
#define ADMT4000_00_REG_RADIUS   0x18
 
#define ADMT4000_00_REG_TMP   0x20
 
#define ADMT4000_02_REG_GENERAL   0x10 /* ECC0 */
 
#define ADMT4000_02_REG_DIGIOEN   0x12 /* ECC0 */
 
#define ADMT4000_02_REG_ANGLECK   0x13 /* ECC0 */
 
#define ADMT4000_02_REG_CNVCNT   0x14
 
#define ADMT4000_02_REG_H1MAG   0x15 /* ECC0 */
 
#define ADMT4000_02_REG_H1PH   0x16 /* ECC0 */
 
#define ADMT4000_02_REG_H2MAG   0x17 /* ECC0 */
 
#define ADMT4000_02_REG_H2PH   0x18 /* ECC0 */
 
#define ADMT4000_02_REG_H3MAG   0x19 /* ECC1/0 */
 
#define ADMT4000_02_REG_H3PH   0x1A /* ECC1 */
 
#define ADMT4000_02_REG_H8MAG   0x1B /* ECC1 */
 
#define ADMT4000_02_REG_H8PH   0x1C /* ECC1 */
 
#define ADMT4000_02_REG_ECCEDC   0x1D
 
#define ADMT4000_02_REG_UNIQD0   0x1E
 
#define ADMT4000_02_REG_UNIQD1   0x1F
 
#define ADMT4000_02_REG_UNIQD2   0x20
 
#define ADMT4000_02_REG_UNIQD3   0x21
 
#define ADMT4000_02_REG_ECCDIS   0x23
 
#define ADMT4000_RW_MASK   NO_OS_GENMASK(5, 0)
 
#define ADMT4000_WR_EN   NO_OS_BIT(6)
 
#define ADMT4000_FAULT_MASK   NO_OS_BIT(7)
 
#define ADMT4000_LIFE_CTR   NO_OS_GENMASK(6, 5)
 
#define ADMT4000_RCV_CRC   NO_OS_GENMASK(4, 0)
 
#define ADMT4000_MIN_PAGE   0x00
 
#define ADMT4000_MAX_PAGE   0x02
 
#define ADMT4000_DIGIO3FNC_MASK   NO_OS_BIT(3)
 
#define ADMT4000_DIGIO0FNC_MASK   NO_OS_BIT(0)
 
#define ADMT4000_LOW_BYTE   NO_OS_GENMASK(7, 0)
 
#define ADMT4000_HI_BYTE   NO_OS_GENMASK(15, 8)
 
#define ADMT4000_CNV_EDGE_MASK   NO_OS_GENMASK(15, 14)
 
#define ADMT4000_PAGE_MASK   NO_OS_GENMASK(4, 0)
 
#define ADMT4000_FALLING_EDGE   0x00
 
#define ADMT4000_RISING_EDGE   0x3
 
#define ADMT4000_ABS_ANGLE_MASK   NO_OS_GENMASK(15, 0)
 
#define ADMT4000_TURN_CNT_MASK   NO_OS_GENMASK(15, 10)
 
#define ADMT4000_QUARTER_TURN_CNT_MASK   NO_OS_GENMASK(15, 8)
 
#define ADMT4000_ABS_ANGLE_ANGLE_MASK   NO_OS_GENMASK(9, 0)
 
#define ADMT4000_INVALID_TURN   0x53
 
#define ADMT4000_MAX_GPIO_INDEX   5
 
#define ADMT4000_GPIO_LOGIC(x)
 
#define ADMT4000_ANGLE_MASK   NO_OS_GENMASK(15, 4)
 
#define ADMT4000_ALL_FAULTS   NO_OS_GENMASK(15, 0)
 
#define ADMT4000_AGP_INDIV_FAULT(x)
 
#define ADMT4000_ANGLE_STAT_MASK   NO_OS_BIT(0)
 
#define ADMT4000_RAW_ANGLE_MASK   NO_OS_GENMASK(15, 2)
 
#define ADMT4000_RAW_COSINE_MASK   NO_OS_GENMASK(15, 2)
 
#define ADMT4000_RAW_SINE_MASK   NO_OS_GENMASK(15, 2)
 
#define ADMT4000_NEW_DATA_MASK   NO_OS_BIT(0)
 
#define ADMT4000_RADIUS_MASK   NO_OS_GENMASK(15, 1)
 
#define ADMT4000_TEMP_MASK   NO_OS_GENMASK(15, 4)
 
#define ADMT4000_STORAGE_BIT7   NO_OS_BIT(7)
 
#define ADMT4000_STORAGE_BIT6   NO_OS_BIT(6)
 
#define ADMT4000_STORAGE_BIT5_3   NO_OS_GENMASK(5, 3)
 
#define ADMT4000_STORAGE_BIT2_0   NO_OS_GENMASK(2, 0)
 
#define ADMT4000_STORAGE_MASK_BIT7   NO_OS_BIT(15)
 
#define ADMT4000_STORAGE_MASK_BIT6   NO_OS_BIT(11)
 
#define ADMT4000_STORAGE_MASK_BIT5_3   NO_OS_GENMASK(8, 6)
 
#define ADMT4000_STORAGE_MASK_BIT2_0   NO_OS_GENMASK(3, 1)
 
#define ADMT4000_STORAGE_MASK_FULL
 
#define ADMT4000_CONV_SYNC_MODE_MASK   NO_OS_GENMASK(14, 13)
 
#define ADMT4000_ANGL_FILT_MASK   NO_OS_BIT(12)
 
#define ADMT4000_H8_CTRL_MASK   NO_OS_BIT(10)
 
#define ADMT4000_CNV_MODE_MASK   NO_OS_BIT(0)
 
#define ADMT4000_DIG_IO_EN(x)
 
#define ADMT4000_GPIO_FUNC(x)
 
#define ADMT4000_CNV_CTR_MASK   NO_OS_GENMASK(7, 0)
 
#define ADMT4000_H_11BIT_MAG_MASK   NO_OS_GENMASK(10, 0)
 
#define ADMT4000_11BIT_MAX   2047
 
#define ADMT4000_H_12BIT_PHA_MASK   NO_OS_GENMASK(11, 0)
 
#define ADMT4000_12BIT_MAX   4095
 
#define ADMT4000_H_8BIT_MAG_MASK   NO_OS_GENMASK(7, 0)
 
#define ADMT4000_8BIT_MAX   127
 
#define ADMT4000_ECC_CFG1   NO_OS_GENMASK(15, 8)
 
#define ADMT4000_ECC_CFG0   NO_OS_GENMASK(7, 0)
 
#define ADMT4000_ID0_MASK   NO_OS_GENMASK(14, 0)
 
#define ADMT4000_ID_PROD_MASK   NO_OS_GENMASK(10, 8)
 
#define ADMT4000_ID_SUPPLY_MASK   NO_OS_GENMASK(7, 6)
 
#define ADMT4000_ID_ASIL_MASK   NO_OS_GENMASK(5, 3)
 
#define ADMT4000_ID_SIL_REV_MASK   NO_OS_GENMASK(2, 0)
 
#define ADMT4000_ECC_EN_COMM   0x0000
 
#define ADMT4000_ECC_DIS_COMM   0x4D54
 
#define ADMT4000_FULL_TURN_DEGREES   360
 
#define ADMT4000_ABS_ANGLE_RES   1024
 
#define ADMT4000_ANGLE_RES   4096
 
#define ADMT4000_TURN_CNT_THRES   0x35
 
#define ADMT4000_TURN_CNT_TWOS   64
 
#define ADMT4000_QUARTER_TURNS_MAX   215
 
#define ADMT4000_QUARTER_TURNS_RES   256
 
#define ADMT4000_TEMP_OFFSET   -1168
 
#define ADMT4000_TEMP_SCALE_MILLIS   15660
 
#define ADMT4000_RADIUS_RES   924
 
#define ADMT4000_HMAG_SCALER   0.009046f
 
#define ADMT4000_HPHA_SCALER   0.087891f
 
#define ADMT4000_GPIO_SETTLE_DELAY_MS   10
 
#define ADMT4000_CNV_PULSE_WIDTH_US   1
 
#define ADMT4000_CONVERSION_DELAY_MS   20
 
#define ADMT4000_STARTUP_TIME_MS   10
 
#define ADMT4000_RESET_HOLD_TIME_MS   1
 
#define ADMT4000_MAX_CRC_BIT_LEN   25
 

Enumerations

enum  admt4000_faults {
  ADMT4000_FAULT_VDD_UV = 0 ,
  ADMT4000_FAULT_VDD_OV ,
  ADMT4000_FAULT_VDRIVE_UV ,
  ADMT4000_FAULT_VDRIVE_OV ,
  ADMT4000_FAULT_NVM_CRC = 5 ,
  ADMT4000_FAULT_ECC_DOUBLE = 7 ,
  ADMT4000_FAULT_GMR_REF_RES = 9 ,
  ADMT4000_FAULT_TURN_CTRS = 13 ,
  ADMT4000_FAULT_AMR_RAD_AMP
}
 
enum  admt4000_vdd {
  ADMT4000_3P3V ,
  ADMT4000_5V
}
 
enum  admt4000_conv_sync_mode {
  ADMT4000_SEQ_CTRL = 0 ,
  ADMT4000_START_EDGE = 3
}
 
enum  admt4000_harmonic_corr_src {
  ADMT4000_FACTORY = 0 ,
  ADMT4000_USER = 1
}
 
enum  admt4000_conversion_mode {
  ADMT4000_CONTINUOUS = 0 ,
  ADMT4000_ONE_SHOT = 1
}
 

Functions

int admt4000_angle_raw_to_scaled (uint16_t raw_angle, float *scaled_angle)
 Convert raw angle value to scaled degrees.
 
int admt4000_harmonic_raw_to_scaled (const struct admt4000_harmonic_coeff *raw_coeff, float *scaled_mag, float *scaled_phase)
 Convert raw harmonic coefficients to scaled format.
 
int admt4000_harmonic_scaled_to_raw (uint32_t scaled_mag, uint32_t scaled_phase, struct admt4000_harmonic_coeff *raw_coeff)
 Convert scaled harmonic values to raw coefficients.
 
int admt4000_reinitialize (struct admt4000_dev *device)
 Reinitialize device using stored configuration.
 
int admt4000_hard_reset (struct admt4000_dev *device)
 Perform hardware reset via reset pin.
 
int admt4000_init (struct admt4000_dev **device, struct admt4000_init_param *init_param)
 Initializes the admt4000.
 
int admt4000_remove (struct admt4000_dev *device)
 Free the resources allocated by admt4000_init().
 
int admt4000_reg_read (struct admt4000_dev *device, uint8_t reg_addr, uint16_t *reg_data, uint8_t *verif)
 Reads data from a certain ADMT400x Register.
 
int admt4000_reg_write (struct admt4000_dev *device, uint8_t reg_addr, uint16_t reg_data)
 Writes data to a certain ADMT400x Register.
 
int admt4000_reg_update (struct admt4000_dev *device, uint8_t reg_addr, uint16_t update_mask, uint16_t update_val)
 Updates the contents of selected register.
 
int admt4000_toggle_cnv (struct admt4000_dev *device)
 Toggle the CNV to stop/start conversion.
 
int admt4000_raw_angle_read (struct admt4000_dev *device, uint16_t *angle_data)
 Reads ANGLE and ABSANGLE register contents in 1 CS frame.
 
int admt4000_get_raw_turns_and_angle (struct admt4000_dev *device, uint8_t *turns, uint16_t *angle)
 Get the number of turns and angle information (Raw).
 
int admt4000_quarter_turns_cnt (uint8_t raw_turns, int16_t *quarter_turns)
 Convert raw quarter turn count to equivalent signed value.
 
int admt4000_get_gpio (struct admt4000_dev *device, uint8_t gpio, bool *logic)
 Get status of selected GPIO.
 
int admt4000_set_gpio (struct admt4000_dev *device, uint8_t gpio, bool logic)
 Configure selected GPIO.
 
int admt4000_clear_all_faults (struct admt4000_dev *device)
 Clear all faults from fault registers.
 
int admt4000_get_faults (struct admt4000_dev *device, uint16_t *faults)
 Get all fault flags from the fault register.
 
int admt4000_get_radius (struct admt4000_dev *device, uint16_t *radius, bool *is_new_data)
 Get RADIUS vector value.
 
int admt4000_radius_raw_to_scaled (uint16_t raw_radius, float *radius)
 Convert raw RADIUS value to scaled mV/V.
 
int admt4000_get_temp (struct admt4000_dev *device, uint16_t *temp)
 Get raw temperature reading.
 
int admt4000_temp_raw_to_scaled (uint16_t temp_raw, float *temp)
 Convert raw temperature value to scaled temperature (degrees Celsius).
 
int admt4000_get_storage_config (struct admt4000_dev *device, uint8_t *storage)
 Gets storage general config.
 
int admt4000_set_storage_config (struct admt4000_dev *device, uint8_t storage)
 Sets storage general config.
 
int admt4000_get_conv_sync_mode (struct admt4000_dev *device, enum admt4000_conv_sync_mode *mode)
 Obtains conversion synchronization mode.
 
int admt4000_set_conv_sync_mode (struct admt4000_dev *device, enum admt4000_conv_sync_mode mode)
 Configures conversion synchronization mode.
 
int admt4000_get_angle_filt (struct admt4000_dev *device, bool *is_filtered)
 Gets current filter setting.
 
int admt4000_set_angle_filt (struct admt4000_dev *device, bool is_filtered)
 Sets the filter setting.
 
int admt4000_get_h8_ctrl (struct admt4000_dev *device, enum admt4000_harmonic_corr_src *source)
 Gets 8th harmonic correction source.
 
int admt4000_set_h8_ctrl (struct admt4000_dev *device, enum admt4000_harmonic_corr_src source)
 Sets 8th harmonic correction source.
 
int admt4000_get_conv_mode (struct admt4000_dev *device, bool *is_one_shot)
 Obtains the conversion mode.
 
int admt4000_set_conv_mode (struct admt4000_dev *device, bool is_one_shot)
 Configures the conversion mode: one shot or continuous.
 
int admt4000_gpio_config (struct admt4000_dev *device, uint8_t gpio, bool alt_mode, bool output_en, bool init_state)
 Configure GPIO mode, direction, and initial state.
 
int admt4000_get_gpio_func (struct admt4000_dev *device, uint8_t gpio, bool *alt_mode)
 Get current GPIO function configuration.
 
int admt4000_get_cnv_cnt (struct admt4000_dev *device, uint8_t *cnt)
 Get current conversion count.
 
int admt4000_get_id (struct admt4000_dev *device, uint8_t id_num, uint16_t *id)
 Read Unique ID from register/s.
 
int admt4000_get_cos (struct admt4000_dev *device, int16_t *val, bool *is_new_data)
 Get the cosine value from the ADMT4000 device. This function reads the cosine portion of the AMR angle sensor without post- processing.
 
int admt4000_get_sin (struct admt4000_dev *device, int16_t *val, bool *is_new_data)
 Retrieve the sine value from the ADMT4000 device. This function reads the sine portion of the AMR angle sensor without post- processing.
 
int admt4000_get_harmonic (struct admt4000_dev *device, uint8_t harmonic, struct admt4000_harmonic_coeff *config)
 Get harmonic configuration (magnitude and phase together).
 
int admt4000_set_harmonic (struct admt4000_dev *device, uint8_t harmonic, const struct admt4000_harmonic_coeff *config)
 Set harmonic configuration (magnitude and phase together).
 
int admt4000_get_harmonics_calib (struct admt4000_dev *device, struct admt4000_harmonics_calib *calib)
 Get all harmonic configurations in a single operation.
 
int admt4000_set_harmonics_calib (struct admt4000_dev *device, const struct admt4000_harmonics_calib *calib)
 Set all harmonic configurations in a single operation.
 

Detailed Description

Header Implementation of ADMT4000 Driver.

Author
Marc Sosa (marcp.nosp@m.aolo.nosp@m..sosa.nosp@m.@ana.nosp@m.log.c.nosp@m.om)
Jose Ramon San Buenaventura (jose..nosp@m.sanb.nosp@m.uenav.nosp@m.entu.nosp@m.ra@an.nosp@m.alog.nosp@m..com)
Louijie Compo (louij.nosp@m.ie.c.nosp@m.ompo@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Macro Definition Documentation

◆ ADMT4000_00_REG_COSINE

#define ADMT4000_00_REG_COSINE   0x11

◆ ADMT4000_00_REG_RADIUS

#define ADMT4000_00_REG_RADIUS   0x18

◆ ADMT4000_00_REG_SINE

#define ADMT4000_00_REG_SINE   0x10

◆ ADMT4000_00_REG_TMP

#define ADMT4000_00_REG_TMP   0x20

◆ ADMT4000_02_REG_ANGLECK

#define ADMT4000_02_REG_ANGLECK   0x13 /* ECC0 */

◆ ADMT4000_02_REG_CNVCNT

#define ADMT4000_02_REG_CNVCNT   0x14

◆ ADMT4000_02_REG_DIGIOEN

#define ADMT4000_02_REG_DIGIOEN   0x12 /* ECC0 */

◆ ADMT4000_02_REG_ECCDIS

#define ADMT4000_02_REG_ECCDIS   0x23

◆ ADMT4000_02_REG_ECCEDC

#define ADMT4000_02_REG_ECCEDC   0x1D

◆ ADMT4000_02_REG_GENERAL

#define ADMT4000_02_REG_GENERAL   0x10 /* ECC0 */

◆ ADMT4000_02_REG_H1MAG

#define ADMT4000_02_REG_H1MAG   0x15 /* ECC0 */

◆ ADMT4000_02_REG_H1PH

#define ADMT4000_02_REG_H1PH   0x16 /* ECC0 */

◆ ADMT4000_02_REG_H2MAG

#define ADMT4000_02_REG_H2MAG   0x17 /* ECC0 */

◆ ADMT4000_02_REG_H2PH

#define ADMT4000_02_REG_H2PH   0x18 /* ECC0 */

◆ ADMT4000_02_REG_H3MAG

#define ADMT4000_02_REG_H3MAG   0x19 /* ECC1/0 */

◆ ADMT4000_02_REG_H3PH

#define ADMT4000_02_REG_H3PH   0x1A /* ECC1 */

◆ ADMT4000_02_REG_H8MAG

#define ADMT4000_02_REG_H8MAG   0x1B /* ECC1 */

◆ ADMT4000_02_REG_H8PH

#define ADMT4000_02_REG_H8PH   0x1C /* ECC1 */

◆ ADMT4000_02_REG_UNIQD0

#define ADMT4000_02_REG_UNIQD0   0x1E

◆ ADMT4000_02_REG_UNIQD1

#define ADMT4000_02_REG_UNIQD1   0x1F

◆ ADMT4000_02_REG_UNIQD2

#define ADMT4000_02_REG_UNIQD2   0x20

◆ ADMT4000_02_REG_UNIQD3

#define ADMT4000_02_REG_UNIQD3   0x21

◆ ADMT4000_11BIT_MAX

#define ADMT4000_11BIT_MAX   2047

◆ ADMT4000_12BIT_MAX

#define ADMT4000_12BIT_MAX   4095

◆ ADMT4000_8BIT_MAX

#define ADMT4000_8BIT_MAX   127

◆ ADMT4000_ABS_ANGLE_ANGLE_MASK

#define ADMT4000_ABS_ANGLE_ANGLE_MASK   NO_OS_GENMASK(9, 0)

◆ ADMT4000_ABS_ANGLE_MASK

#define ADMT4000_ABS_ANGLE_MASK   NO_OS_GENMASK(15, 0)

◆ ADMT4000_ABS_ANGLE_RES

#define ADMT4000_ABS_ANGLE_RES   1024

◆ ADMT4000_AGP_INDIV_FAULT

#define ADMT4000_AGP_INDIV_FAULT ( x)
Value:
#define NO_OS_BIT(x)
Definition no_os_util.h:46

◆ ADMT4000_AGP_REG_ABSANGLE

#define ADMT4000_AGP_REG_ABSANGLE   0x03

◆ ADMT4000_AGP_REG_ANGLE

#define ADMT4000_AGP_REG_ANGLE   0x05

◆ ADMT4000_AGP_REG_CNVPAGE

#define ADMT4000_AGP_REG_CNVPAGE   0x01

◆ ADMT4000_AGP_REG_DGIO

#define ADMT4000_AGP_REG_DGIO   0x04

◆ ADMT4000_AGP_REG_FAULT

#define ADMT4000_AGP_REG_FAULT   0x06

◆ ADMT4000_ALL_FAULTS

#define ADMT4000_ALL_FAULTS   NO_OS_GENMASK(15, 0)

◆ ADMT4000_ANGL_FILT_MASK

#define ADMT4000_ANGL_FILT_MASK   NO_OS_BIT(12)

◆ ADMT4000_ANGLE_MASK

#define ADMT4000_ANGLE_MASK   NO_OS_GENMASK(15, 4)

◆ ADMT4000_ANGLE_RES

#define ADMT4000_ANGLE_RES   4096

◆ ADMT4000_ANGLE_STAT_MASK

#define ADMT4000_ANGLE_STAT_MASK   NO_OS_BIT(0)

◆ ADMT4000_CNV_CTR_MASK

#define ADMT4000_CNV_CTR_MASK   NO_OS_GENMASK(7, 0)

◆ ADMT4000_CNV_EDGE_MASK

#define ADMT4000_CNV_EDGE_MASK   NO_OS_GENMASK(15, 14)

◆ ADMT4000_CNV_MODE_MASK

#define ADMT4000_CNV_MODE_MASK   NO_OS_BIT(0)

◆ ADMT4000_CNV_PULSE_WIDTH_US

#define ADMT4000_CNV_PULSE_WIDTH_US   1

◆ ADMT4000_CONV_SYNC_MODE_MASK

#define ADMT4000_CONV_SYNC_MODE_MASK   NO_OS_GENMASK(14, 13)

◆ ADMT4000_CONVERSION_DELAY_MS

#define ADMT4000_CONVERSION_DELAY_MS   20

◆ ADMT4000_DIG_IO_EN

#define ADMT4000_DIG_IO_EN ( x)
Value:
NO_OS_BIT(8 + (x))

◆ ADMT4000_DIGIO0FNC_MASK

#define ADMT4000_DIGIO0FNC_MASK   NO_OS_BIT(0)

◆ ADMT4000_DIGIO3FNC_MASK

#define ADMT4000_DIGIO3FNC_MASK   NO_OS_BIT(3)

◆ ADMT4000_ECC_CFG0

#define ADMT4000_ECC_CFG0   NO_OS_GENMASK(7, 0)

◆ ADMT4000_ECC_CFG1

#define ADMT4000_ECC_CFG1   NO_OS_GENMASK(15, 8)

◆ ADMT4000_ECC_DIS_COMM

#define ADMT4000_ECC_DIS_COMM   0x4D54

◆ ADMT4000_ECC_EN_COMM

#define ADMT4000_ECC_EN_COMM   0x0000

◆ ADMT4000_FALLING_EDGE

#define ADMT4000_FALLING_EDGE   0x00

◆ ADMT4000_FAULT_MASK

#define ADMT4000_FAULT_MASK   NO_OS_BIT(7)

◆ ADMT4000_FULL_TURN_DEGREES

#define ADMT4000_FULL_TURN_DEGREES   360

◆ ADMT4000_GPIO_FUNC

#define ADMT4000_GPIO_FUNC ( x)
Value:

◆ ADMT4000_GPIO_LOGIC

#define ADMT4000_GPIO_LOGIC ( x)
Value:

◆ ADMT4000_GPIO_SETTLE_DELAY_MS

#define ADMT4000_GPIO_SETTLE_DELAY_MS   10

◆ ADMT4000_H8_CTRL_MASK

#define ADMT4000_H8_CTRL_MASK   NO_OS_BIT(10)

◆ ADMT4000_H_11BIT_MAG_MASK

#define ADMT4000_H_11BIT_MAG_MASK   NO_OS_GENMASK(10, 0)

◆ ADMT4000_H_12BIT_PHA_MASK

#define ADMT4000_H_12BIT_PHA_MASK   NO_OS_GENMASK(11, 0)

◆ ADMT4000_H_8BIT_MAG_MASK

#define ADMT4000_H_8BIT_MAG_MASK   NO_OS_GENMASK(7, 0)

◆ ADMT4000_HI_BYTE

#define ADMT4000_HI_BYTE   NO_OS_GENMASK(15, 8)

◆ ADMT4000_HMAG_SCALER

#define ADMT4000_HMAG_SCALER   0.009046f

◆ ADMT4000_HPHA_SCALER

#define ADMT4000_HPHA_SCALER   0.087891f

◆ ADMT4000_ID0_MASK

#define ADMT4000_ID0_MASK   NO_OS_GENMASK(14, 0)

◆ ADMT4000_ID_ASIL_MASK

#define ADMT4000_ID_ASIL_MASK   NO_OS_GENMASK(5, 3)

◆ ADMT4000_ID_PROD_MASK

#define ADMT4000_ID_PROD_MASK   NO_OS_GENMASK(10, 8)

◆ ADMT4000_ID_SIL_REV_MASK

#define ADMT4000_ID_SIL_REV_MASK   NO_OS_GENMASK(2, 0)

◆ ADMT4000_ID_SUPPLY_MASK

#define ADMT4000_ID_SUPPLY_MASK   NO_OS_GENMASK(7, 6)

◆ ADMT4000_INVALID_TURN

#define ADMT4000_INVALID_TURN   0x53

◆ ADMT4000_LIFE_CTR

#define ADMT4000_LIFE_CTR   NO_OS_GENMASK(6, 5)

◆ ADMT4000_LOW_BYTE

#define ADMT4000_LOW_BYTE   NO_OS_GENMASK(7, 0)

◆ ADMT4000_MAX_CRC_BIT_LEN

#define ADMT4000_MAX_CRC_BIT_LEN   25

◆ ADMT4000_MAX_GPIO_INDEX

#define ADMT4000_MAX_GPIO_INDEX   5

◆ ADMT4000_MAX_PAGE

#define ADMT4000_MAX_PAGE   0x02

◆ ADMT4000_MIN_PAGE

#define ADMT4000_MIN_PAGE   0x00

◆ ADMT4000_NEW_DATA_MASK

#define ADMT4000_NEW_DATA_MASK   NO_OS_BIT(0)

◆ ADMT4000_PAGE_MASK

#define ADMT4000_PAGE_MASK   NO_OS_GENMASK(4, 0)

◆ ADMT4000_QUARTER_TURN_CNT_MASK

#define ADMT4000_QUARTER_TURN_CNT_MASK   NO_OS_GENMASK(15, 8)

◆ ADMT4000_QUARTER_TURNS_MAX

#define ADMT4000_QUARTER_TURNS_MAX   215

◆ ADMT4000_QUARTER_TURNS_RES

#define ADMT4000_QUARTER_TURNS_RES   256

◆ ADMT4000_RADIUS_MASK

#define ADMT4000_RADIUS_MASK   NO_OS_GENMASK(15, 1)

◆ ADMT4000_RADIUS_RES

#define ADMT4000_RADIUS_RES   924

◆ ADMT4000_RAW_ANGLE_MASK

#define ADMT4000_RAW_ANGLE_MASK   NO_OS_GENMASK(15, 2)

◆ ADMT4000_RAW_COSINE_MASK

#define ADMT4000_RAW_COSINE_MASK   NO_OS_GENMASK(15, 2)

◆ ADMT4000_RAW_SINE_MASK

#define ADMT4000_RAW_SINE_MASK   NO_OS_GENMASK(15, 2)

◆ ADMT4000_RCV_CRC

#define ADMT4000_RCV_CRC   NO_OS_GENMASK(4, 0)

◆ ADMT4000_REG_RST

#define ADMT4000_REG_RST   0x00

◆ ADMT4000_RESET_HOLD_TIME_MS

#define ADMT4000_RESET_HOLD_TIME_MS   1

◆ ADMT4000_RISING_EDGE

#define ADMT4000_RISING_EDGE   0x3

◆ ADMT4000_RW_MASK

#define ADMT4000_RW_MASK   NO_OS_GENMASK(5, 0)

◆ ADMT4000_STARTUP_TIME_MS

#define ADMT4000_STARTUP_TIME_MS   10

◆ ADMT4000_STORAGE_BIT2_0

#define ADMT4000_STORAGE_BIT2_0   NO_OS_GENMASK(2, 0)

◆ ADMT4000_STORAGE_BIT5_3

#define ADMT4000_STORAGE_BIT5_3   NO_OS_GENMASK(5, 3)

◆ ADMT4000_STORAGE_BIT6

#define ADMT4000_STORAGE_BIT6   NO_OS_BIT(6)

◆ ADMT4000_STORAGE_BIT7

#define ADMT4000_STORAGE_BIT7   NO_OS_BIT(7)

◆ ADMT4000_STORAGE_MASK_BIT2_0

#define ADMT4000_STORAGE_MASK_BIT2_0   NO_OS_GENMASK(3, 1)

◆ ADMT4000_STORAGE_MASK_BIT5_3

#define ADMT4000_STORAGE_MASK_BIT5_3   NO_OS_GENMASK(8, 6)

◆ ADMT4000_STORAGE_MASK_BIT6

#define ADMT4000_STORAGE_MASK_BIT6   NO_OS_BIT(11)

◆ ADMT4000_STORAGE_MASK_BIT7

#define ADMT4000_STORAGE_MASK_BIT7   NO_OS_BIT(15)

◆ ADMT4000_STORAGE_MASK_FULL

#define ADMT4000_STORAGE_MASK_FULL
Value:
#define ADMT4000_STORAGE_MASK_BIT6
Definition admt4000.h:149
#define ADMT4000_STORAGE_MASK_BIT5_3
Definition admt4000.h:150
#define ADMT4000_STORAGE_MASK_BIT7
Definition admt4000.h:148
#define ADMT4000_STORAGE_MASK_BIT2_0
Definition admt4000.h:151

◆ ADMT4000_TEMP_MASK

#define ADMT4000_TEMP_MASK   NO_OS_GENMASK(15, 4)

◆ ADMT4000_TEMP_OFFSET

#define ADMT4000_TEMP_OFFSET   -1168

◆ ADMT4000_TEMP_SCALE_MILLIS

#define ADMT4000_TEMP_SCALE_MILLIS   15660

◆ ADMT4000_TURN_CNT_MASK

#define ADMT4000_TURN_CNT_MASK   NO_OS_GENMASK(15, 10)

◆ ADMT4000_TURN_CNT_THRES

#define ADMT4000_TURN_CNT_THRES   0x35

◆ ADMT4000_TURN_CNT_TWOS

#define ADMT4000_TURN_CNT_TWOS   64

◆ ADMT4000_WR_EN

#define ADMT4000_WR_EN   NO_OS_BIT(6)

Enumeration Type Documentation

◆ admt4000_conv_sync_mode

Enumerator
ADMT4000_SEQ_CTRL 
ADMT4000_START_EDGE 

◆ admt4000_conversion_mode

Enumerator
ADMT4000_CONTINUOUS 
ADMT4000_ONE_SHOT 

◆ admt4000_faults

Enumerator
ADMT4000_FAULT_VDD_UV 
ADMT4000_FAULT_VDD_OV 
ADMT4000_FAULT_VDRIVE_UV 
ADMT4000_FAULT_VDRIVE_OV 
ADMT4000_FAULT_NVM_CRC 
ADMT4000_FAULT_ECC_DOUBLE 
ADMT4000_FAULT_GMR_REF_RES 
ADMT4000_FAULT_TURN_CTRS 
ADMT4000_FAULT_AMR_RAD_AMP 

◆ admt4000_harmonic_corr_src

Enumerator
ADMT4000_FACTORY 
ADMT4000_USER 

◆ admt4000_vdd

Enumerator
ADMT4000_3P3V 
ADMT4000_5V 

Function Documentation

◆ admt4000_angle_raw_to_scaled()

int admt4000_angle_raw_to_scaled ( uint16_t raw_angle,
float * scaled_angle )

Convert raw angle value to scaled degrees.

Convert raw angle value to scaled degrees

Parameters
raw_angle- Input raw angle value
scaled_angle- Output scaled angle in degrees
Returns
0 in case of success, negative error code otherwise.

Scales raw angle register value to physical units using device-specific resolution factors. Angle: raw * 360 / 4096 (for 12-bit angle resolution)

Here is the caller graph for this function:

◆ admt4000_clear_all_faults()

int admt4000_clear_all_faults ( struct admt4000_dev * device)

Clear all faults from fault registers.

Clear all fault flags

Parameters
device- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_angle_filt()

int admt4000_get_angle_filt ( struct admt4000_dev * device,
bool * is_filtered )

Gets current filter setting.

Get angle filter status

Parameters
device- The device structure.
is_filtered- Stores the logic level of the filter enable bit.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_cnv_cnt()

int admt4000_get_cnv_cnt ( struct admt4000_dev * device,
uint8_t * cnt )

Get current conversion count.

Get conversion count value

Parameters
device- The device structure.
cnt- Stores the count data.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_conv_mode()

int admt4000_get_conv_mode ( struct admt4000_dev * device,
bool * is_one_shot )

Obtains the conversion mode.

Get conversion mode

Parameters
device- The device structure.
is_one_shot- Stores the conversion mode bit value.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_conv_sync_mode()

int admt4000_get_conv_sync_mode ( struct admt4000_dev * device,
enum admt4000_conv_sync_mode * mode )

Obtains conversion synchronization mode.

Get conversion synchronization mode

Parameters
device- The device structure.
mode- The conversion synchronization mode configured.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_cos()

int admt4000_get_cos ( struct admt4000_dev * device,
int16_t * val,
bool * is_new_data )

Get the cosine value from the ADMT4000 device. This function reads the cosine portion of the AMR angle sensor without post- processing.

Get cosine value

Parameters
device- The device structure.
val- Pointer to a variable where cosine value will be stored.
is_new_data- Optional pointer to store new data flag (can be NULL).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_faults()

int admt4000_get_faults ( struct admt4000_dev * device,
uint16_t * faults )

Get all fault flags from the fault register.

Get fault register value

Parameters
device- The device structure.
faults- Pointer to store the fault register value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_gpio()

int admt4000_get_gpio ( struct admt4000_dev * device,
uint8_t gpio,
bool * logic )

Get status of selected GPIO.

Get GPIO logic level

Parameters
device- The device structure.
gpio- GPIO number (0 to 5).
logic- Stores the truth value of selected GPIO.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_gpio_func()

int admt4000_get_gpio_func ( struct admt4000_dev * device,
uint8_t gpio,
bool * alt_mode )

Get current GPIO function configuration.

Get GPIO function configuration

Parameters
device- The device structure.
gpio- GPIO number (0-5).
alt_mode- Pointer to store result (true = alt, false = normal).
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_h8_ctrl()

int admt4000_get_h8_ctrl ( struct admt4000_dev * device,
enum admt4000_harmonic_corr_src * source )

Gets 8th harmonic correction source.

Get H8 harmonic coefficient source

Parameters
device- The device structure.
source- The harmonic correction source.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_harmonic()

int admt4000_get_harmonic ( struct admt4000_dev * device,
uint8_t harmonic,
struct admt4000_harmonic_coeff * config )

Get harmonic configuration (magnitude and phase together).

Get harmonic calibration coefficients

Parameters
device- The device structure.
harmonic- Harmonic number (1, 2, 3, or 8).
config- Output structure for magnitude and phase.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_harmonics_calib()

int admt4000_get_harmonics_calib ( struct admt4000_dev * device,
struct admt4000_harmonics_calib * calib )

Get all harmonic configurations in a single operation.

Get all harmonic calibration data

Parameters
device- The device structure.
calib- Output structure for all 4 harmonics (1, 2, 3, 8).
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_id()

int admt4000_get_id ( struct admt4000_dev * device,
uint8_t id_num,
uint16_t * id )

Read Unique ID from register/s.

Read device ID register

Parameters
device- The device structure.
id_num- The ID register to read from.
id- Stores the ID value read.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_radius()

int admt4000_get_radius ( struct admt4000_dev * device,
uint16_t * radius,
bool * is_new_data )

Get RADIUS vector value.

Get radius raw data

Parameters
device- The device structure.
radius- Stores the radius value read.
is_new_data- Optional pointer to store new data flag (can be NULL).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_raw_turns_and_angle()

int admt4000_get_raw_turns_and_angle ( struct admt4000_dev * device,
uint8_t * turns,
uint16_t * angle )

Get the number of turns and angle information (Raw).

Get raw turns and angle data

Parameters
device- The device structure.
turns- Stores the number of turns read (Raw).
angle- Stores the angle values read (Raw, extracted).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_sin()

int admt4000_get_sin ( struct admt4000_dev * device,
int16_t * val,
bool * is_new_data )

Retrieve the sine value from the ADMT4000 device. This function reads the sine portion of the AMR angle sensor without post- processing.

Get sine value

Parameters
device- The device structure.
val- Pointer to a variable where sine value will be stored.
is_new_data- Optional pointer to store new data flag (can be NULL).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_get_storage_config()

int admt4000_get_storage_config ( struct admt4000_dev * device,
uint8_t * storage )

Gets storage general config.

Get storage configuration bits

Parameters
device- The device structure.
storage- Stores the storage bits read.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_get_temp()

int admt4000_get_temp ( struct admt4000_dev * device,
uint16_t * temp )

Get raw temperature reading.

Get raw temperature value

Parameters
device- The device structure.
temp- Raw temperature ADC value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_gpio_config()

int admt4000_gpio_config ( struct admt4000_dev * device,
uint8_t gpio,
bool alt_mode,
bool output_en,
bool init_state )

Configure GPIO mode, direction, and initial state.

Configure GPIO mode, direction, and initial state

GPIO Functions

The ADMT4000 has 6 GPIO pins (GPIO0-GPIO5) that can be configured as either:

  • Normal GPIO mode: Standard digital I/O pins
  • Alternate function mode: Device-specific functions

Alternate Functions:

  • GPIO0: BUSY (output only) - Conversion busy indicator
  • GPIO1: CNV (input only) - External conversion trigger (active low)
  • GPIO3: ACALC (output only) - Auto-calibration trigger
  • GPIO5: BOOTLOAD (output only) - Bootloader mode control

When a GPIO is in alternate function mode:

  • The device hardware controls the pin behavior
  • Normal GPIO operations (set_gpio, get_gpio) may have no effect
  • Direction is determined by the alternate function
  • Application should not attempt to control the pin manually

GPIO direction defaults to input mode at init time. If direction configured at init conflicts with the selected alternate function, alternate function's required direction takes precedence.

Parameters
device- The device structure.
gpio- GPIO number (0-5).
alt_mode- Alternate function flag (true = alt, false = normal).
output_en- Direction flag (true = output, false = input). Ignored in alt mode.
init_state- Initial output state (true = high, false = low). Only applied if output_en is true and alt_mode is false.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_hard_reset()

int admt4000_hard_reset ( struct admt4000_dev * device)

Perform hardware reset via reset pin.

Perform hardware reset via reset pin

Parameters
device- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_harmonic_raw_to_scaled()

int admt4000_harmonic_raw_to_scaled ( const struct admt4000_harmonic_coeff * raw_coeff,
float * scaled_mag,
float * scaled_phase )

Convert raw harmonic coefficients to scaled format.

Convert raw harmonic coefficients to scaled format

Parameters
raw_coeff- Input raw calibration coefficients
scaled_mag- Output scaled magnitude
scaled_phase- Output scaled phase
Returns
0 in case of success, negative error code otherwise.

Scales raw register values to physical units using device-specific resolution factors. Magnitude: raw * 0.005493/0.6072 Phase: raw * 0.087891

◆ admt4000_harmonic_scaled_to_raw()

int admt4000_harmonic_scaled_to_raw ( uint32_t scaled_mag,
uint32_t scaled_phase,
struct admt4000_harmonic_coeff * raw_coeff )

Convert scaled harmonic values to raw coefficients.

Convert scaled harmonic values to raw coefficients

Parameters
scaled_mag- Input scaled magnitude
scaled_phase- Input scaled phase
raw_coeff- Output raw calibration coefficients
Returns
0 in case of success, negative error code otherwise.

Inverse conversion for writing scaled values to hardware registers. Uses CORDIC scaler (0.6072) to compensate for hardware scaling.

◆ admt4000_init()

int admt4000_init ( struct admt4000_dev ** device,
struct admt4000_init_param * init_param )

Initializes the admt4000.

Initialize the ADMT4000 device

Parameters
device- The device structure.
init_param- The structure for the device initial parameters.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_quarter_turns_cnt()

int admt4000_quarter_turns_cnt ( uint8_t raw_turns,
int16_t * quarter_turns )

Convert raw quarter turn count to equivalent signed value.

Convert raw quarter turn count to signed value

Parameters
raw_turns- Raw quarter turn count read from device.
quarter_turns- Pointer to store the signed quarter turn count.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_radius_raw_to_scaled()

int admt4000_radius_raw_to_scaled ( uint16_t raw_radius,
float * radius )

Convert raw RADIUS value to scaled mV/V.

Convert raw radius value to scaled mV/V

Parameters
raw_radius- Raw RADIUS value.
radius- Stores Magnitude value (mV/V).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_raw_angle_read()

int admt4000_raw_angle_read ( struct admt4000_dev * device,
uint16_t * angle_data )

Reads ANGLE and ABSANGLE register contents in 1 CS frame.

Get raw angle data from ABSANGLE and ANGLE registers

Parameters
device- The device structure.
angle_data- Stores data read from the registers.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_reg_read()

int admt4000_reg_read ( struct admt4000_dev * device,
uint8_t reg_addr,
uint16_t * reg_data,
uint8_t * verif )

Reads data from a certain ADMT400x Register.

Read from an ADMT4000 register

Parameters
device- The device structure.
reg_addr- Address of the register.
reg_data- Stores data read from the register.
verif- Stores the Fault, and CRC bits returned.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_reg_update()

int admt4000_reg_update ( struct admt4000_dev * device,
uint8_t reg_addr,
uint16_t update_mask,
uint16_t update_val )

Updates the contents of selected register.

Read-modify-write an ADMT4000 register field

Parameters
device- The device structure.
reg_addr- Address of the register.
update_mask- Mask to update to selected register bit/s.
update_val- Value used to update on selected register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_reg_write()

int admt4000_reg_write ( struct admt4000_dev * device,
uint8_t reg_addr,
uint16_t reg_data )

Writes data to a certain ADMT400x Register.

Write to an ADMT4000 register

Parameters
device- The device structure.
reg_addr- Address of the register.
reg_data- Data to write to the chosen register (16 bit wide).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_reinitialize()

int admt4000_reinitialize ( struct admt4000_dev * device)

Reinitialize device using stored configuration.

Reinitialize device using stored configuration

Convenience function to restore device configuration after magnetic reset or power cycle events using the parameters from initial initialization.

Parameters
device- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_remove()

int admt4000_remove ( struct admt4000_dev * device)

Free the resources allocated by admt4000_init().

Free resources allocated by admt4000_init()

Parameters
device- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_set_angle_filt()

int admt4000_set_angle_filt ( struct admt4000_dev * device,
bool is_filtered )

Sets the filter setting.

Set angle filter enable

Parameters
device- The device structure.
is_filtered- Set true to enable filter, false otherwise.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_set_conv_mode()

int admt4000_set_conv_mode ( struct admt4000_dev * device,
bool is_one_shot )

Configures the conversion mode: one shot or continuous.

Set conversion mode

Parameters
device- The device structure.
is_one_shot- Set to true for one shot setting, false otherwise.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_set_conv_sync_mode()

int admt4000_set_conv_sync_mode ( struct admt4000_dev * device,
enum admt4000_conv_sync_mode mode )

Configures conversion synchronization mode.

Set conversion synchronization mode

Parameters
device- The device structure.
mode- The conversion synchronization mode to configure.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_set_gpio()

int admt4000_set_gpio ( struct admt4000_dev * device,
uint8_t gpio,
bool logic )

Configure selected GPIO.

Set GPIO logic level

Parameters
device- The device structure.
gpio- GPIO number (0 to 5).
logic- Logic level to set for GPIO.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_set_h8_ctrl()

int admt4000_set_h8_ctrl ( struct admt4000_dev * device,
enum admt4000_harmonic_corr_src source )

Sets 8th harmonic correction source.

Set H8 harmonic coefficient source

Parameters
device- The device structure.
source- The harmonic correction source.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_set_harmonic()

int admt4000_set_harmonic ( struct admt4000_dev * device,
uint8_t harmonic,
const struct admt4000_harmonic_coeff * config )

Set harmonic configuration (magnitude and phase together).

Set harmonic calibration coefficients

Parameters
device- The device structure.
harmonic- Harmonic number (1, 2, 3, or 8).
config- Input structure for magnitude and phase.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_set_harmonics_calib()

int admt4000_set_harmonics_calib ( struct admt4000_dev * device,
const struct admt4000_harmonics_calib * calib )

Set all harmonic configurations in a single operation.

Set all harmonic calibration data

Parameters
device- The device structure.
calib- Input structure for all 4 harmonics (1, 2, 3, 8).
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_set_storage_config()

int admt4000_set_storage_config ( struct admt4000_dev * device,
uint8_t storage )

Sets storage general config.

Set storage configuration bits

Parameters
device- The device structure.
storage- Data to write on storage bits.
Returns
0 in case of success, negative error code otherwise.

◆ admt4000_temp_raw_to_scaled()

int admt4000_temp_raw_to_scaled ( uint16_t temp_raw,
float * temp )

Convert raw temperature value to scaled temperature (degrees Celsius).

Convert raw temperature to degrees Celsius

Parameters
temp_raw- Raw temperature ADC value.
temp- Temperature data (degrees Celsius).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ admt4000_toggle_cnv()

int admt4000_toggle_cnv ( struct admt4000_dev * device)

Toggle the CNV to stop/start conversion.

Toggle the CNV pin to trigger conversion

Parameters
device- The device structure.
Returns
0 in case of success, negative error code otherwise.