no-OS
max25603.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __MAX25603_H__
34 #define __MAX25603_H__
35 
36 #include <stdbool.h>
37 #include <stdint.h>
38 #include <string.h>
39 #include "no_os_gpio.h"
40 #include "no_os_pwm.h"
41 #include "no_os_util.h"
42 #include "no_os_error.h"
43 
47 };
48 
53 };
54 
61 };
62 
66 
73 };
74 
75 struct max25603_desc {
78 
85 
89 };
90 
92 int max25603_sel_comp(struct max25603_desc *desc, enum max25603_comp comp);
93 
95 int max25603_set_enable(struct max25603_desc *desc, enum max25603_enable enable,
96  uint32_t freq_hz, uint8_t duty);
97 
99 int max25603_set_beam(struct max25603_desc *desc, enum max25603_beam beam,
100  uint32_t freq_hz, uint8_t duty);
101 
103 int max25603_init(struct max25603_desc **desc,
105 
107 int max25603_remove(struct max25603_desc *desc);
108 
109 #endif /* __MAX25603_H__ */
MAX25603_COMP1
@ MAX25603_COMP1
Definition: max25603.h:45
max25603_init_param::turn_param
struct no_os_pwm_init_param * turn_param
Definition: max25603.h:72
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
max25603_set_enable
int max25603_set_enable(struct max25603_desc *desc, enum max25603_enable enable, uint32_t freq_hz, uint8_t duty)
MAX25603 set and configure ENABLE PWM dimming.
Definition: max25603.c:65
MAX25603_EN1
@ MAX25603_EN1
Definition: max25603.h:51
MAX25603_EN2
@ MAX25603_EN2
Definition: max25603.h:52
max25603_init
int max25603_init(struct max25603_desc **desc, struct max25603_init_param *init_param)
MAX25603 descriptor initialization function.
Definition: max25603.c:235
max25603_set_beam
int max25603_set_beam(struct max25603_desc *desc, enum max25603_beam beam, uint32_t freq_hz, uint8_t duty)
MAX25603 set and configure BEAM PWM dimming.
Definition: max25603.c:136
no_os_pwm_remove
int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc)
Free the resources allocated by no_os_pwm_init().
Definition: no_os_pwm.c:79
max25603_enable
max25603_enable
Definition: max25603.h:49
no_os_units.h
Header file of Units.
no_os_delay.h
Header file of Delay functions.
max25603_init_param::flt_param
struct no_os_gpio_init_param * flt_param
Definition: max25603.h:65
max25603_desc::en2_desc
struct no_os_pwm_desc * en2_desc
Definition: max25603.h:80
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
max25603_desc::beam
enum max25603_beam beam
Definition: max25603.h:87
MAX25603_LOW_BEAM
@ MAX25603_LOW_BEAM
Definition: max25603.h:58
MAX25603_DISABLE_BEAM
@ MAX25603_DISABLE_BEAM
Definition: max25603.h:56
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:124
max25603_sel_comp
int max25603_sel_comp(struct max25603_desc *desc, enum max25603_comp comp)
MAX25603 select comparator function.
Definition: max25603.c:44
max25603_init_param::shunt_param
struct no_os_gpio_init_param * shunt_param
Definition: max25603.h:64
MAX25603_DRL_BEAM
@ MAX25603_DRL_BEAM
Definition: max25603.h:59
no_os_pwm_set_period
int32_t no_os_pwm_set_period(struct no_os_pwm_desc *desc, uint32_t period_ns)
Set the PWM period value.
Definition: no_os_pwm.c:133
max25603_remove
int max25603_remove(struct max25603_desc *desc)
Deallocates all the resources used at initialization.
Definition: max25603.c:341
no_os_pwm_desc::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:99
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
max25603_set_beam
int max25603_set_beam(struct max25603_desc *desc, enum max25603_beam beam, uint32_t freq_hz, uint8_t duty)
MAX25603 set and configure BEAM PWM dimming.
Definition: max25603.c:136
max25603_init_param
Definition: max25603.h:63
no_os_error.h
Error codes definition.
no_os_pwm_enable
int32_t no_os_pwm_enable(struct no_os_pwm_desc *desc)
Enable PWM signal generation.
Definition: no_os_pwm.c:98
MAX25603_COMP2
@ MAX25603_COMP2
Definition: max25603.h:46
max25603_desc::en1_desc
struct no_os_pwm_desc * en1_desc
Definition: max25603.h:79
max25603_desc::lb_desc
struct no_os_pwm_desc * lb_desc
Definition: max25603.h:81
max25603_desc
Definition: max25603.h:75
no_os_pwm_disable
int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc)
Disable PWM signal generation.
Definition: no_os_pwm.c:115
MAX25603_TURN_BEAM
@ MAX25603_TURN_BEAM
Definition: max25603.h:60
max25603_desc::turn_desc
struct no_os_pwm_desc * turn_desc
Definition: max25603.h:84
max25603_init_param::en2_param
struct no_os_pwm_init_param * en2_param
Definition: max25603.h:68
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
max25603_comp
max25603_comp
Definition: max25603.h:44
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
max25603_desc::shunt_desc
struct no_os_gpio_desc * shunt_desc
Definition: max25603.h:76
no_os_pwm_set_duty_cycle
int32_t no_os_pwm_set_duty_cycle(struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns)
Set the PWM duty cycle.
Definition: no_os_pwm.c:169
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
max25603_desc::hb_desc
struct no_os_pwm_desc * hb_desc
Definition: max25603.h:82
no_os_pwm_init
int32_t no_os_pwm_init(struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
Initialize the PWM peripheral.
Definition: no_os_pwm.c:51
max25603_init_param::drl_param
struct no_os_pwm_init_param * drl_param
Definition: max25603.h:71
max25603_desc::flt_desc
struct no_os_gpio_desc * flt_desc
Definition: max25603.h:77
no_os_pwm.h
Header file of PWM Interface.
max25603_init_param::hb_param
struct no_os_pwm_init_param * hb_param
Definition: max25603.h:70
max25603_desc::drl_desc
struct no_os_pwm_desc * drl_desc
Definition: max25603.h:83
no_os_gpio_values
no_os_gpio_values
Enum that holds the possible output states of a GPIO.
Definition: no_os_gpio.h:113
max25603_sel_comp
int max25603_sel_comp(struct max25603_desc *desc, enum max25603_comp comp)
MAX25603 select comparator function.
Definition: max25603.c:44
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
MAX25603_DISABLE_EN
@ MAX25603_DISABLE_EN
Definition: max25603.h:50
max25603_init_param::lb_param
struct no_os_pwm_init_param * lb_param
Definition: max25603.h:69
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
max25603_desc::comp
enum max25603_comp comp
Definition: max25603.h:88
max25603_set_enable
int max25603_set_enable(struct max25603_desc *desc, enum max25603_enable enable, uint32_t freq_hz, uint8_t duty)
MAX25603 set and configure ENABLE PWM dimming.
Definition: max25603.c:65
max25603.h
Header file of MAX25603 Driver.
no_os_gpio.h
Header file of GPIO Interface.
max25603_desc::enable
enum max25603_enable enable
Definition: max25603.h:86
NANO
#define NANO
Definition: no_os_units.h:50
max25603_init
int max25603_init(struct max25603_desc **desc, struct max25603_init_param *init_param)
MAX25603 descriptor initialization function.
Definition: max25603.c:235
max25603_beam
max25603_beam
Definition: max25603.h:55
no_os_util.h
Header file of utility functions.
max25603_remove
int max25603_remove(struct max25603_desc *desc)
Deallocates all the resources used at initialization.
Definition: max25603.c:341
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
max25603_init_param::en1_param
struct no_os_pwm_init_param * en1_param
Definition: max25603.h:67
MAX25603_HIGH_BEAM
@ MAX25603_HIGH_BEAM
Definition: max25603.h:57
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75