Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
max2221x.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Analog Devices Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_DRIVERS_MISC_MAX2221X_MAX2221X_H_
14#define ZEPHYR_INCLUDE_DRIVERS_MISC_MAX2221X_MAX2221X_H_
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
25
44
54
67
75
97
107
117
127
137
146
152#define MAX2221X_RAMP_DOWN_MASK BIT(2)
154#define MAX2221X_RAMP_MID_MASK BIT(1)
156#define MAX2221X_RAMP_UP_MASK BIT(0)
158
181
190
199int max2221x_get_channel_freq(const struct device *dev, uint8_t channel);
200
209int max2221x_set_part_state(const struct device *dev, bool enable);
210
220int max2221x_set_channel_state(const struct device *dev, uint8_t channel, bool enable);
221
244
267
289int max2221x_set_vdr_mode(const struct device *dev, enum max2221x_vdr_mode mode);
290
298int max2221x_get_vdr_mode(const struct device *dev);
299
308int max2221x_read_status(const struct device *dev, uint16_t *status);
309
323int max2221x_read_vm_monitor(const struct device *dev, uint16_t *vm_monitor);
324
339int max2221x_set_dc_h2l(const struct device *dev, uint16_t dc_hdl);
340
349int max2221x_get_dc_h2l(const struct device *dev, uint16_t *dc_hdl);
350
372int max2221x_set_vm_upper_threshold(const struct device *dev, enum max2221x_vm_threshold threshold);
373
382
404int max2221x_set_vm_lower_threshold(const struct device *dev, enum max2221x_vm_threshold threshold);
405
414
424int max2221x_read_dc_l2h(const struct device *dev, uint16_t *dc_l2h, uint8_t channel);
425
441int max2221x_write_dc_l2h(const struct device *dev, uint16_t dc_l2h, uint8_t channel);
442
452int max2221x_read_dc_h(const struct device *dev, uint16_t *dc_h, uint8_t channel);
453
469int max2221x_write_dc_h(const struct device *dev, uint16_t dc_h, uint8_t channel);
470
480int max2221x_read_dc_l(const struct device *dev, uint16_t *dc_l, uint8_t channel);
481
497int max2221x_write_dc_l(const struct device *dev, uint16_t dc_l, uint8_t channel);
498
508int max2221x_read_time_l2h(const struct device *dev, uint16_t *time_l2h, uint8_t channel);
509
522int max2221x_write_time_l2h(const struct device *dev, uint16_t time_l2h, uint8_t channel);
523
546int max2221x_set_ctrl_mode(const struct device *dev, enum max2221x_ctrl_mode mode, uint8_t channel);
547
556int max2221x_get_ctrl_mode(const struct device *dev, uint8_t channel);
557
571int max2221x_set_ramps(const struct device *dev, uint8_t channel, uint8_t ramp_mask, bool enable);
572
593int max2221x_set_ramp_slew_rate(const struct device *dev, uint8_t channel, uint8_t ramp_slew_rate);
594
603int max2221x_get_ramp_slew_rate(const struct device *dev, uint8_t channel);
604
627int max2221x_set_channel_chop_freq_div(const struct device *dev, uint8_t channel,
628 enum max2221x_ch_freq_div freq_div);
629
638int max2221x_get_channel_chop_freq_div(const struct device *dev, uint8_t channel);
639
662int max2221x_set_slew_rate(const struct device *dev, uint8_t channel,
663 enum max2221x_slew_rate slew_rate);
664
673int max2221x_get_slew_rate(const struct device *dev, uint8_t channel);
674
697int max2221x_set_gain(const struct device *dev, uint8_t channel, enum max2221x_gain gain);
698
707int max2221x_get_gain(const struct device *dev, uint8_t channel);
708
731int max2221x_set_snsf(const struct device *dev, uint8_t channel, enum max2221x_snsf snsf);
732
741int max2221x_get_snsf(const struct device *dev, uint8_t channel);
742
752int max2221x_read_pwm_dutycycle(const struct device *dev, uint8_t channel, uint16_t *duty_cycle);
753
761int max2221x_read_fault0(const struct device *dev);
762
770int max2221x_read_fault1(const struct device *dev);
771
781int max2221x_set_on_time(const struct device *dev, uint8_t channel, uint16_t on_time_us);
782
791int max2221x_get_on_time(const struct device *dev, uint8_t channel);
792
802int max2221x_set_off_time(const struct device *dev, uint8_t channel, uint16_t off_time_us);
803
812int max2221x_get_off_time(const struct device *dev, uint8_t channel);
813
823int max2221x_set_stop_state(const struct device *dev, uint8_t channel, bool stop_state);
824
833int max2221x_get_stop_state(const struct device *dev, uint8_t channel);
834
844int max2221x_set_repetitions(const struct device *dev, uint8_t channel, uint16_t repetitions);
845
854int max2221x_get_repetitions(const struct device *dev, uint8_t channel);
855
905int max2221x_start_rapid_fire(const struct device *dev, uint8_t channel);
906
915int max2221x_stop_rapid_fire(const struct device *dev, uint8_t channel);
916
918
919#ifdef __cplusplus
920}
921#endif
922
923#endif /* ZEPHYR_INCLUDE_DRIVERS_MISC_MAX2221X_MAX2221X_H_ */
max2221x_gain
Gain scale options.
Definition max2221x.h:129
int max2221x_read_vm_monitor(const struct device *dev, uint16_t *vm_monitor)
Read the voltage monitor of the MAX2221X device.
int max2221x_set_ramps(const struct device *dev, uint8_t channel, uint8_t ramp_mask, bool enable)
Set ramps on channel of the MAX2221X device.
int max2221x_set_vdr_mode(const struct device *dev, enum max2221x_vdr_mode mode)
Set the VDR mode of the MAX2221X device.
int max2221x_read_fault1(const struct device *dev)
Read the fault status from FAULT1 register of the MAX2221X device.
int max2221x_read_status(const struct device *dev, uint16_t *status)
Read the status of the MAX2221X device.
int max2221x_set_gain(const struct device *dev, uint8_t channel, enum max2221x_gain gain)
Set the digital gain for the CDR of channel on the MAX2221X device.
int max2221x_read_dc_l2h(const struct device *dev, uint16_t *dc_l2h, uint8_t channel)
Read the DC_L2H value of channel on the MAX2221X device.
max2221x_ch_freq_div
Channel frequency divisor options.
Definition max2221x.h:109
max2221x_vm_threshold
VM threshold voltage levels.
Definition max2221x.h:77
max2221x_fault_pin_masks
Fault pin mask definitions.
Definition max2221x.h:56
max2221x_individual_chop_freq
Individual channel chopping frequency divisor options.
Definition max2221x.h:46
int max2221x_set_dc_h2l(const struct device *dev, uint16_t dc_hdl)
Set the demagnetization voltage of the MAX2221X device.
int max2221x_get_snsf(const struct device *dev, uint8_t channel)
Get the sense scaling factor of channel on the MAX2221X device.
int max2221x_unmask_fault_pin(const struct device *dev, enum max2221x_fault_pin_masks mask)
Unmask detection of a fault condition on the MAX2221X device.
int max2221x_get_ramp_slew_rate(const struct device *dev, uint8_t channel)
Get the ramp slew rate of channel on the MAX2221X device.
int max2221x_set_snsf(const struct device *dev, uint8_t channel, enum max2221x_snsf snsf)
Set the sense scaling factor of channel on the MAX2221X device.
int max2221x_set_channel_state(const struct device *dev, uint8_t channel, bool enable)
Set the channel state (enable/disable) of a channel on the MAX2221X device.
int max2221x_write_dc_l(const struct device *dev, uint16_t dc_l, uint8_t channel)
Write the DC_L value of channel on the MAX2221X device.
int max2221x_get_vdr_mode(const struct device *dev)
Get the VDR mode of the MAX2221X device.
int max2221x_write_time_l2h(const struct device *dev, uint16_t time_l2h, uint8_t channel)
Write the time L2H value of channel on the MAX2221X device.
int max2221x_get_slew_rate(const struct device *dev, uint8_t channel)
Get the slew rate of channel on the MAX2221X device.
int max2221x_set_master_chop_freq(const struct device *dev, enum max2221x_master_chop_freq freq)
Set the master chopping frequency for the MAX2221X device.
max2221x_snsf
Sense filter options.
Definition max2221x.h:139
int max2221x_read_dc_l(const struct device *dev, uint16_t *dc_l, uint8_t channel)
Read the DC_L value of channel on the MAX2221X device.
int max2221x_set_ctrl_mode(const struct device *dev, enum max2221x_ctrl_mode mode, uint8_t channel)
Set the control mode of channel on the MAX2221X device.
int max2221x_get_ctrl_mode(const struct device *dev, uint8_t channel)
Get the control mode of channel on the MAX2221X device.
int max2221x_read_fault0(const struct device *dev)
Read the fault status from FAULT0 register of the MAX2221X device.
int max2221x_set_on_time(const struct device *dev, uint8_t channel, uint16_t on_time_us)
Set the on time of channel on the MAX2221X device.
int max2221x_read_time_l2h(const struct device *dev, uint16_t *time_l2h, uint8_t channel)
Read the time L2H value of channel on the MAX2221X device.
int max2221x_get_on_time(const struct device *dev, uint8_t channel)
Get the on time of channel on the MAX2221X device.
int max2221x_read_pwm_dutycycle(const struct device *dev, uint8_t channel, uint16_t *duty_cycle)
Read the PWM duty cycle of channel on the MAX2221X device.
int max2221x_stop_rapid_fire(const struct device *dev, uint8_t channel)
Stop the rapid fire mode of channel on the MAX2221X device.
int max2221x_set_vm_upper_threshold(const struct device *dev, enum max2221x_vm_threshold threshold)
Set the upper threshold of the supply voltage monitor of the MAX2221X device.
int max2221x_get_off_time(const struct device *dev, uint8_t channel)
Get the off time of channel on the MAX2221X device.
int max2221x_set_part_state(const struct device *dev, bool enable)
Set the part state (enable/disable) of the MAX2221X device.
int max2221x_write_dc_l2h(const struct device *dev, uint16_t dc_l2h, uint8_t channel)
Write the DC_L2H value of channel on the MAX2221X device.
int max2221x_set_vm_lower_threshold(const struct device *dev, enum max2221x_vm_threshold threshold)
Set the lower threshold of the supply voltage monitor of the MAX2221X device.
int max2221x_set_off_time(const struct device *dev, uint8_t channel, uint16_t off_time_us)
Set the off time of channel on the MAX2221X device.
max2221x_master_chop_freq
Master chopping frequency options.
Definition max2221x.h:27
int max2221x_get_repetitions(const struct device *dev, uint8_t channel)
Get the repetitions of channel on the MAX2221X device.
int max2221x_set_ramp_slew_rate(const struct device *dev, uint8_t channel, uint8_t ramp_slew_rate)
Set the ramp slew rate of channel on the MAX2221X device.
int max2221x_mask_fault_pin(const struct device *dev, enum max2221x_fault_pin_masks mask)
Mask detection of a fault condition on the MAX2221X device.
int max2221x_get_gain(const struct device *dev, uint8_t channel)
Get the digital gain for the CDR of channel on the MAX2221X device.
int max2221x_start_rapid_fire(const struct device *dev, uint8_t channel)
Start the rapid fire mode of channel on the MAX2221X device.
int max2221x_set_stop_state(const struct device *dev, uint8_t channel, bool stop_state)
Set the stop state of channel on the MAX2221X device.
int max2221x_get_stop_state(const struct device *dev, uint8_t channel)
Get the stop state of channel on the MAX2221X device.
int max2221x_set_slew_rate(const struct device *dev, uint8_t channel, enum max2221x_slew_rate slew_rate)
Set the slew rate of channel on the MAX2221X device.
int max2221x_get_dc_h2l(const struct device *dev, uint16_t *dc_hdl)
Get the demagnetization voltage of the MAX2221X device.
int max2221x_read_dc_h(const struct device *dev, uint16_t *dc_h, uint8_t channel)
Read the DC_H value of channel on the MAX2221X device.
int max2221x_get_channel_chop_freq_div(const struct device *dev, uint8_t channel)
Get the chopping frequency divider of channel on the MAX2221X device.
max2221x_slew_rate
Slew rate options.
Definition max2221x.h:119
int max2221x_get_vm_upper_threshold(const struct device *dev)
Get the upper threshold of the supply voltage monitor of the MAX2221X device.
int max2221x_get_vm_lower_threshold(const struct device *dev)
Get the lower threshold of the supply voltage monitor of the MAX2221X device.
int max2221x_set_repetitions(const struct device *dev, uint8_t channel, uint16_t repetitions)
Set the repetitions of channel on the MAX2221X device.
max2221x_ctrl_mode
Control mode options.
Definition max2221x.h:99
int max2221x_set_channel_chop_freq_div(const struct device *dev, uint8_t channel, enum max2221x_ch_freq_div freq_div)
Set the chopping frequency divider of channel on the MAX2221X device.
int max2221x_write_dc_h(const struct device *dev, uint16_t dc_h, uint8_t channel)
Write the DC_H value of channel on the MAX2221X device.
max2221x_vdr_mode
VDR mode options.
Definition max2221x.h:69
@ MAX2221X_SCALE_4
Gain scale factor 4.
Definition max2221x.h:133
@ MAX2221X_SCALE_1
Gain scale factor 1.
Definition max2221x.h:130
@ MAX2221X_SCALE_3
Gain scale factor 3.
Definition max2221x.h:132
@ MAX2221X_SCALE_2
Gain scale factor 2.
Definition max2221x.h:131
@ MAX2221X_GAIN_INVALID
Invalid gain sentinel.
Definition max2221x.h:135
@ MAX2221X_CH_FREQ_DIV_8
Frequency divided by 8.
Definition max2221x.h:113
@ MAX2221X_CH_FREQ_DIV_1
No frequency division.
Definition max2221x.h:110
@ MAX2221X_CH_FREQ_DIV_2
Frequency divided by 2.
Definition max2221x.h:111
@ MAX2221X_CH_FREQ_DIV_4
Frequency divided by 4.
Definition max2221x.h:112
@ MAX2221X_CH_FREQ_DIV_INVALID
Invalid frequency divisor sentinel.
Definition max2221x.h:115
@ MAX2221X_VM_THRESHOLD_18500MV
18500 mV threshold
Definition max2221x.h:86
@ MAX2221X_VM_THRESHOLD_28500MV
28500 mV threshold
Definition max2221x.h:91
@ MAX2221X_VM_THRESHOLD_8500MV
8500 mV threshold
Definition max2221x.h:81
@ MAX2221X_VM_THRESHOLD_16500MV
16500 mV threshold
Definition max2221x.h:85
@ MAX2221X_VM_THRESHOLD_30500MV
30500 mV threshold
Definition max2221x.h:92
@ MAX2221X_VM_THRESHOLD_10500MV
10500 mV threshold
Definition max2221x.h:82
@ MAX2221X_VM_THRESHOLD_INVALID
Invalid threshold sentinel.
Definition max2221x.h:95
@ MAX2221X_VM_THRESHOLD_6500MV
6500 mV threshold
Definition max2221x.h:80
@ MAX2221X_VM_THRESHOLD_12500MV
12500 mV threshold
Definition max2221x.h:83
@ MAX2221X_VM_THRESHOLD_DISABLED
Threshold disabled.
Definition max2221x.h:78
@ MAX2221X_VM_THRESHOLD_14500MV
14500 mV threshold
Definition max2221x.h:84
@ MAX2221X_VM_THRESHOLD_20500MV
20500 mV threshold
Definition max2221x.h:87
@ MAX2221X_VM_THRESHOLD_22500MV
22500 mV threshold
Definition max2221x.h:88
@ MAX2221X_VM_THRESHOLD_4500MV
4500 mV threshold
Definition max2221x.h:79
@ MAX2221X_VM_THRESHOLD_26500MV
26500 mV threshold
Definition max2221x.h:90
@ MAX2221X_VM_THRESHOLD_32500MV
32500 mV threshold
Definition max2221x.h:93
@ MAX2221X_VM_THRESHOLD_24500MV
24500 mV threshold
Definition max2221x.h:89
@ MAX2221X_FAULT_PIN_DPM
DPM Error fault.
Definition max2221x.h:59
@ MAX2221X_FAULT_PIN_OVT
Over-Temperature Protection fault.
Definition max2221x.h:63
@ MAX2221X_FAULT_PIN_HHF
Hit current not reached error fault.
Definition max2221x.h:60
@ MAX2221X_FAULT_PIN_INVALID
Invalid fault pin sentinel.
Definition max2221x.h:65
@ MAX2221X_FAULT_PIN_OLF
Open-Load Fault.
Definition max2221x.h:61
@ MAX2221X_FAULT_PIN_COMF
Communication Error fault.
Definition max2221x.h:58
@ MAX2221X_FAULT_PIN_UVM
Under Voltage Monitor fault.
Definition max2221x.h:57
@ MAX2221X_FAULT_PIN_OCP
Over-Current Protection fault.
Definition max2221x.h:62
@ MAX2221X_FREQ_M_2
Master frequency divided by 2.
Definition max2221x.h:48
@ MAX2221X_FREQ_M
Master frequency (no division).
Definition max2221x.h:47
@ MAX2221X_FREQ_M_4
Master frequency divided by 4.
Definition max2221x.h:49
@ MAX2221X_FREQ_M_8
Master frequency divided by 8.
Definition max2221x.h:50
@ MAX2221X_FREQ_M_INVALID
Invalid frequency divisor sentinel.
Definition max2221x.h:52
@ MAX2221X_SNSF_2_3
2/3 sense filter
Definition max2221x.h:141
@ MAX2221X_SNSF_FULL_SCALE
Full scale sense filter.
Definition max2221x.h:140
@ MAX2221X_SNSF_INVALID
Invalid sense filter sentinel.
Definition max2221x.h:144
@ MAX2221X_SNSF_1_3
1/3 sense filter
Definition max2221x.h:142
@ MAX2221X_FREQ_5000HZ
5 kHz
Definition max2221x.h:39
@ MAX2221X_FREQ_50KHZ
50 kHz
Definition max2221x.h:31
@ MAX2221X_FREQ_80KHZ
80 kHz
Definition max2221x.h:29
@ MAX2221X_FREQ_7500HZ
7.5 kHz
Definition max2221x.h:38
@ MAX2221X_FREQ_INVALID
Invalid frequency sentinel.
Definition max2221x.h:42
@ MAX2221X_FREQ_2500HZ
2.5 kHz
Definition max2221x.h:40
@ MAX2221X_FREQ_40KHZ
40 kHz
Definition max2221x.h:32
@ MAX2221X_FREQ_20KHZ
20 kHz
Definition max2221x.h:35
@ MAX2221X_FREQ_25KHZ
25 kHz
Definition max2221x.h:34
@ MAX2221X_FREQ_60KHZ
60 kHz
Definition max2221x.h:30
@ MAX2221X_FREQ_15KHZ
15 kHz
Definition max2221x.h:36
@ MAX2221X_FREQ_30KHZ
30 kHz
Definition max2221x.h:33
@ MAX2221X_FREQ_100KHZ
100 kHz
Definition max2221x.h:28
@ MAX2221X_FREQ_10KHZ
10 kHz
Definition max2221x.h:37
@ MAX2221X_SLEW_RATE_FAST
Fast slew rate.
Definition max2221x.h:120
@ MAX2221X_SLEW_RATE_400V_PER_US
400 V/us slew rate
Definition max2221x.h:121
@ MAX2221X_SLEW_RATE_100V_PER_US
100 V/us slew rate
Definition max2221x.h:123
@ MAX2221X_SLEW_RATE_200V_PER_US
200 V/us slew rate
Definition max2221x.h:122
@ MAX2221X_SLEW_RATE_INVALID
Invalid slew rate sentinel.
Definition max2221x.h:125
@ MAX2221X_CTRL_MODE_VOLT
Voltage drive mode.
Definition max2221x.h:100
@ MAX2221X_CTRL_MODE_LIMITER_VOLT
Voltage drive with current limiter mode.
Definition max2221x.h:102
@ MAX2221X_CTRL_MODE_INVALID
Invalid control mode sentinel.
Definition max2221x.h:105
@ MAX2221X_CTRL_MODE_VOLT_CDR
Voltage and current drive mode.
Definition max2221x.h:103
@ MAX2221X_CTRL_MODE_CDR
Current drive mode.
Definition max2221x.h:101
@ MAX2221X_VDR_MODE_DUTY
Duty Cycle mode.
Definition max2221x.h:71
@ MAX2221X_VDR_MODE_INVALID
Invalid VDR mode sentinel.
Definition max2221x.h:73
@ MAX2221X_VDR_MODE_NORMAL
Normal Voltage mode.
Definition max2221x.h:70
int max2221x_get_channel_freq(const struct device *dev, uint32_t channel, uint32_t *channel_freq)
Get the individual channel frequency of the MAX2221X device.
int max2221x_get_master_chop_freq(const struct device *dev)
Get the master chop frequency of the MAX2221X device.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:513