no-OS
aducm3029_adc.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef ADUCM3029_ADC_H
41 #define ADUCM3029_ADC_H
42 
43 #include <stdint.h>
44 
45 
46 #define ADUCM3029_ADC_NUM_CH 6
47 #define ADUCM3029_CH(x) (1 << x)
48 
49 struct adc_desc;
50 
56  /* To add options in the future */
57  uint32_t reserved;
58 };
59 
60 /* Activate channels for reading */
62  uint32_t mask);
63 
64 /* Read adc channels */
65 int32_t aducm3029_adc_read(struct adc_desc *desc, uint16_t *buff,
66  uint32_t nb_samples);
67 
68 /* Initialize the ADC */
69 int32_t aducm3029_adc_init(struct adc_desc **desc,
70  struct adc_init_param *param);
71 
72 /* Free the resources allocated by adc_init(). */
73 int32_t aducm3029_adc_remove(struct adc_desc *desc);
74 
75 #endif
adc_init_param
This can be extended in the future, no utility for the moment.
Definition: aducm3029_adc.h:55
no_os_alloc.h
adc_desc::ch_mask
uint32_t ch_mask
Definition: aducm3029_adc.c:60
adc_desc
Adc descriptor.
Definition: aducm3029_adc.c:54
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:127
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:60
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:89
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:69
adc_desc::dev
ADI_ADC_HANDLE dev
Definition: aducm3029_adc.c:58
NO_OS_UNUSED_PARAM
#define NO_OS_UNUSED_PARAM(x)
Definition: no_os_util.h:115
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:127
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: aducm3029_adc.c:192
adc_init_param::reserved
uint32_t reserved
Definition: aducm3029_adc.h:57
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:75
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:56
aducm3029_adc_remove
int32_t aducm3029_adc_remove(struct adc_desc *desc)
Dealocate resources allocated by aducm3029_adc_init.
Definition: aducm3029_adc.c:192
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:89
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:48
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:69