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_PWM_MAX2221X_H_
14#define ZEPHYR_INCLUDE_DRIVERS_PWM_MAX2221X_H_
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#include <zephyr/device.h>
21#include <zephyr/sys/util.h>
22
28
47
57
66
75int max2221x_get_channel_freq(const struct device *dev, uint32_t channel, uint32_t *channel_freq);
76
86
97 int *freq_divisor);
98
108int max2221x_get_cycles_per_sec(const struct device *dev, uint32_t channel, uint64_t *cycles);
109
121int max2221x_set_cycles(const struct device *dev, uint32_t channel, uint32_t period, uint32_t pulse,
123
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* ZEPHYR_INCLUDE_DRIVERS_PWM_MAX2221X_H_ */
max2221x_individual_chop_freq
Individual channel chopping frequency divisor options.
Definition max2221x.h:46
max2221x_master_chop_freq
Master chopping frequency options.
Definition max2221x.h:27
@ 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_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
uint16_t pwm_flags_t
Provides a type to hold PWM configuration flags.
Definition pwm.h:117
int max2221x_calculate_master_freq_divisor(uint32_t master_freq, uint32_t period, int *freq_divisor)
Calculate the master frequency divisor used for calculating individual frequency.
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_set_cycles(const struct device *dev, uint32_t channel, uint32_t period, uint32_t pulse, pwm_flags_t flags)
Set the duty cycle for the pwm channel.
int max2221x_get_cycles_per_sec(const struct device *dev, uint32_t channel, uint64_t *cycles)
Get the cycles per second for the pwm channel.
int max2221x_get_master_chop_freq(const struct device *dev)
Get the master chop frequency of the MAX2221X device.
int max2221x_calculate_duty_cycle(uint32_t pulse, uint32_t period, uint16_t *duty_cycle)
Calculate the duty cycle.
flags
Definition parser.h:97
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
Misc utilities.