no-OS
max538x.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __MAX538x_H__
34 #define __MAX538x_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include <stdbool.h>
41 #include "no_os_i2c.h"
42 #include "no_os_util.h"
43 
44 /******************************************************************************/
45 /************************** max538x Definitions *******************************/
46 /******************************************************************************/
47 /* MAX5380 default resolution */
48 #define MAX538X_RESOLUTION 0xFF
49 
50 /******************************************************************************/
51 /*************************** Types Declarations *******************************/
52 /******************************************************************************/
66 };
67 
69  uint8_t vfactor;
70  uint8_t addr;
71 };
72 
73 struct max538x_dev {
74  /* I2C */
76  /* Device Settings*/
78  /* Device VDD (for MAX5382 variant) */
79  uint8_t max538x_vdd ;
80  /* Device VREF */
81  uint8_t max538x_vref ;
82 };
83 
85  /* I2C */
87  /* Device Settings*/
89  /* Device VDD (for MAX5382 variant) */
90  uint8_t max538x_vdd ;
91  /* Device VREF */
92  uint8_t max538x_vref ;
93 };
94 
95 extern const struct max538x_chip_info chip_info[];
96 
97 /******************************************************************************/
98 /************************ Functions Declarations ******************************/
99 /******************************************************************************/
100 /* Initializes the communications peripheral and checks if the device is present. */
101 int max538x_init(struct max538x_dev **device,
103 
104 /* Free the resources allocated by max538x_init(). */
105 int max538x_remove(struct max538x_dev *dev);
106 
107 /* Sets the DAC output using VOUT */
108 int max538x_set_voutput(struct max538x_dev *dev, float vout);
109 
110 #endif /* __MAX538x_H__ */
max538x_chip_info::addr
uint8_t addr
Definition: max538x.h:70
max538x_init_param::active_device
enum max538x_type active_device
Definition: max538x.h:88
no_os_alloc.h
MAX5382K
@ MAX5382K
Definition: max538x.h:65
MAX5381L
@ MAX5381L
Definition: max538x.h:58
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
max538x_dev::max538x_vref
uint8_t max538x_vref
Definition: max538x.h:81
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
MAX538X_RESOLUTION
#define MAX538X_RESOLUTION
Definition: max538x.h:48
max538x_init_param::max538x_vdd
uint8_t max538x_vdd
Definition: max538x.h:90
device
Definition: ad9361_util.h:69
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
max538x_remove
int max538x_remove(struct max538x_dev *dev)
Free the resources allocated by max538x_init().
Definition: max538x.c:152
MAX5380K
@ MAX5380K
Definition: max538x.h:57
max538x_chip_info
Definition: max538x.h:68
MAX5381N
@ MAX5381N
Definition: max538x.h:60
no_os_error.h
Error codes definition.
NO_OS_DIV_U64
#define NO_OS_DIV_U64(x, y)
Definition: no_os_util.h:115
MAX5380N
@ MAX5380N
Definition: max538x.h:56
max538x_chip_info::vfactor
uint8_t vfactor
Definition: max538x.h:69
max538x_dev::active_device
enum max538x_type active_device
Definition: max538x.h:77
MAX5382L
@ MAX5382L
Definition: max538x.h:62
MAX5382N
@ MAX5382N
Definition: max538x.h:64
MAX5382M
@ MAX5382M
Definition: max538x.h:63
max538x_dev::max538x_vdd
uint8_t max538x_vdd
Definition: max538x.h:79
MAX5380L
@ MAX5380L
Definition: max538x.h:54
MAX5381K
@ MAX5381K
Definition: max538x.h:61
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
max538x.h
Header file of max538x Family Driver.
no_os_i2c.h
Header file of I2C Interface.
max538x_init_param::max538x_vref
uint8_t max538x_vref
Definition: max538x.h:92
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
chip_info
const struct max538x_chip_info chip_info[]
Definition: max538x.c:46
max538x_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: max538x.h:75
max538x_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: max538x.h:86
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
NULL
#define NULL
Definition: wrapper.h:64
max538x_set_voutput
int max538x_set_voutput(struct max538x_dev *dev, float vout)
Sets the DAC output voltage using vout.
Definition: max538x.c:169
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
max538x_init_param
Definition: max538x.h:84
max538x_dev
Definition: max538x.h:73
chip_info
const struct max538x_chip_info chip_info[]
Definition: max538x.c:46
max538x_remove
int max538x_remove(struct max538x_dev *dev)
Free the resources allocated by max538x_init().
Definition: max538x.c:152
no_os_util.h
Header file of utility functions.
MAX5381M
@ MAX5381M
Definition: max538x.h:59
max538x_set_voutput
int max538x_set_voutput(struct max538x_dev *dev, float vout)
Sets the DAC output voltage using vout.
Definition: max538x.c:169
max538x_init
int max538x_init(struct max538x_dev **device, struct max538x_init_param init_param)
Initializes the communication peripheral and checks if the device is present.
Definition: max538x.c:111
max538x_type
max538x_type
Definition: max538x.h:53
errno.h
Error macro definition for ARM Compiler.
MAX5380M
@ MAX5380M
Definition: max538x.h:55
max538x_init
int max538x_init(struct max538x_dev **device, struct max538x_init_param init_param)
Initializes the communication peripheral and checks if the device is present.
Definition: max538x.c:111