no-OS
aducm3029_adc.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef ADUCM3029_ADC_H
35 #define ADUCM3029_ADC_H
36 
37 #include <stdint.h>
38 
39 
40 #define ADUCM3029_ADC_NUM_CH 6
41 #define ADUCM3029_CH(x) (1 << x)
42 
43 struct adc_desc;
44 
50  /* To add options in the future */
51  uint32_t reserved;
52 };
53 
54 /* Activate channels for reading */
56  uint32_t mask);
57 
58 /* Read adc channels */
59 int32_t aducm3029_adc_read(struct adc_desc *desc, uint16_t *buff,
60  uint32_t nb_samples);
61 
62 /* Initialize the ADC */
63 int32_t aducm3029_adc_init(struct adc_desc **desc,
64  struct adc_init_param *param);
65 
66 /* Free the resources allocated by adc_init(). */
67 int32_t aducm3029_adc_remove(struct adc_desc *desc);
68 
69 #endif
adc_init_param
This can be extended in the future, no utility for the moment.
Definition: aducm3029_adc.h:49
no_os_alloc.h
adc_desc::ch_mask
uint32_t ch_mask
Definition: aducm3029_adc.c:54
adc_desc
Adc descriptor.
Definition: aducm3029_adc.c:48
aducm3029_adc_init
int32_t aducm3029_adc_init(struct adc_desc **desc, struct adc_init_param *param)
Allocate adc_desc and initialize adc.
Definition: aducm3029_adc.c:121
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
aducm3029_adc_read
int32_t aducm3029_adc_read(struct adc_desc *desc, uint16_t *buff, uint32_t nb_samples)
Read adc data. aducm3029_adc_update_active_channels should be called in order to enable channeles.
Definition: aducm3029_adc.c:83
no_os_error.h
Error codes definition.
aducm3029_adc_update_active_channels
int32_t aducm3029_adc_update_active_channels(struct adc_desc *desc, uint32_t mask)
Activate adc channels.
Definition: aducm3029_adc.c:63
adc_desc::dev
ADI_ADC_HANDLE dev
Definition: aducm3029_adc.c:52
NO_OS_UNUSED_PARAM
#define NO_OS_UNUSED_PARAM(x)
Definition: no_os_util.h:117
aducm3029_adc_init
int32_t aducm3029_adc_init(struct adc_desc **desc, struct adc_init_param *param)
Allocate adc_desc and initialize adc.
Definition: aducm3029_adc.c:121
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: aducm3029_adc.c:186
adc_init_param::reserved
uint32_t reserved
Definition: aducm3029_adc.h:51
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
aducm3029_adc.h
Interface of aducm3029_adc.c.
NULL
#define NULL
Definition: wrapper.h:64
adc_desc::dev_mem
uint8_t dev_mem[ADI_ADC_MEMORY_SIZE]
Definition: aducm3029_adc.c:50
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: aducm3029_adc.c:186
aducm3029_adc_read
int32_t aducm3029_adc_read(struct adc_desc *desc, uint16_t *buff, uint32_t nb_samples)
Read adc data. aducm3029_adc_update_active_channels should be called in order to enable channeles.
Definition: aducm3029_adc.c:83
no_os_util.h
Header file of utility functions.
no_os_hweight32
unsigned int no_os_hweight32(uint32_t word)
ADUCM3029_DEV_ID
#define ADUCM3029_DEV_ID
Definition: aducm3029_adc.c:42
aducm3029_adc_update_active_channels
int32_t aducm3029_adc_update_active_channels(struct adc_desc *desc, uint32_t mask)
Activate adc channels.
Definition: aducm3029_adc.c:63