Platform drivers for Mbed.
Dependents: EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more
adc_data_capture.h@20:4951ea6abee5, 2021-11-29 (annotated)
- Committer:
- Kjansen
- Date:
- Mon Nov 29 12:39:54 2021 +0000
- Revision:
- 20:4951ea6abee5
- Parent:
- 18:5ae03a197e59
The following changes were made:
1.) Modified udelay() function for generating more accurate smaller usec delays
2.) Implemented the irq_enable and irq_disable functions
3.) Removed the confusion b/w application created peripheral object and interrupt specific object
4.) Created PWM extra init structure and added PWM pin
5.) Added a module for timer and its related header file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
17:af1f2416dd26 | 1 | /***************************************************************************//** |
mahphalke |
17:af1f2416dd26 | 2 | * @file adc_data_capture.h |
mahphalke |
17:af1f2416dd26 | 3 | * @brief Header for ADC data capture interfaces |
mahphalke |
17:af1f2416dd26 | 4 | ******************************************************************************** |
mahphalke |
17:af1f2416dd26 | 5 | * Copyright (c) 2021 Analog Devices, Inc. |
mahphalke |
17:af1f2416dd26 | 6 | * All rights reserved. |
mahphalke |
17:af1f2416dd26 | 7 | * |
mahphalke |
17:af1f2416dd26 | 8 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke |
17:af1f2416dd26 | 9 | * By using this software you agree to the terms of the associated |
mahphalke |
17:af1f2416dd26 | 10 | * Analog Devices Software License Agreement. |
mahphalke |
17:af1f2416dd26 | 11 | *******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 12 | |
mahphalke |
17:af1f2416dd26 | 13 | #ifndef _ADC_DATA_CAPTURE_H_ |
mahphalke |
17:af1f2416dd26 | 14 | #define _ADC_DATA_CAPTURE_H_ |
mahphalke |
17:af1f2416dd26 | 15 | |
mahphalke |
17:af1f2416dd26 | 16 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 17 | /***************************** Include Files **********************************/ |
mahphalke |
17:af1f2416dd26 | 18 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 19 | |
mahphalke |
17:af1f2416dd26 | 20 | #include <stdint.h> |
mahphalke |
17:af1f2416dd26 | 21 | #include <stdbool.h> |
mahphalke |
17:af1f2416dd26 | 22 | #include <stddef.h> |
mahphalke |
17:af1f2416dd26 | 23 | |
mahphalke |
17:af1f2416dd26 | 24 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 25 | /********************** Macros and Constants Definition ***********************/ |
mahphalke |
17:af1f2416dd26 | 26 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 27 | |
mahphalke |
17:af1f2416dd26 | 28 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 29 | /********************** Variables and User Defined Data Types *****************/ |
mahphalke |
17:af1f2416dd26 | 30 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 31 | |
mahphalke |
17:af1f2416dd26 | 32 | /** |
mahphalke |
17:af1f2416dd26 | 33 | * @struct data_capture_ops |
mahphalke |
17:af1f2416dd26 | 34 | * @brief Structure holding function pointers that points to device specific |
mahphalke |
17:af1f2416dd26 | 35 | * data capture functions |
mahphalke |
17:af1f2416dd26 | 36 | */ |
mahphalke |
17:af1f2416dd26 | 37 | struct data_capture_ops { |
mahphalke |
18:5ae03a197e59 | 38 | /* Perform operations required before single sample read */ |
mahphalke |
18:5ae03a197e59 | 39 | int32_t(*single_sample_read_start_ops)(uint8_t input_chn); |
mahphalke |
18:5ae03a197e59 | 40 | |
mahphalke |
17:af1f2416dd26 | 41 | /* Wait for conversion to finish on enabled channels and read conversion data */ |
mahphalke |
18:5ae03a197e59 | 42 | int32_t(*perform_conv_and_read_sample)(uint32_t *read_data, uint8_t chn); |
mahphalke |
18:5ae03a197e59 | 43 | |
mahphalke |
18:5ae03a197e59 | 44 | /* Enable operations required post single sample read */ |
mahphalke |
18:5ae03a197e59 | 45 | int32_t(*single_sample_read_stop_ops)(uint8_t input_chn); |
mahphalke |
18:5ae03a197e59 | 46 | |
mahphalke |
18:5ae03a197e59 | 47 | /* Perform operations required before continuous sample read */ |
mahphalke |
18:5ae03a197e59 | 48 | int32_t(*continuous_sample_read_start_ops)(uint32_t chn_mask); |
mahphalke |
18:5ae03a197e59 | 49 | |
mahphalke |
17:af1f2416dd26 | 50 | /* Read ADC raw sample/data */ |
mahphalke |
18:5ae03a197e59 | 51 | int32_t(*read_converted_sample)(uint32_t *read_data, uint8_t input_chn); |
mahphalke |
18:5ae03a197e59 | 52 | |
mahphalke |
18:5ae03a197e59 | 53 | /* Perform operations required post continuous sample read */ |
mahphalke |
18:5ae03a197e59 | 54 | int32_t(*continuous_sample_read_stop_ops)(void); |
mahphalke |
18:5ae03a197e59 | 55 | |
mahphalke |
18:5ae03a197e59 | 56 | /* Trigger next data conversion */ |
mahphalke |
18:5ae03a197e59 | 57 | int32_t(*trigger_next_conversion)(void); |
mahphalke |
17:af1f2416dd26 | 58 | }; |
mahphalke |
17:af1f2416dd26 | 59 | |
mahphalke |
17:af1f2416dd26 | 60 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 61 | /************************ Public Declarations *********************************/ |
mahphalke |
17:af1f2416dd26 | 62 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 63 | |
mahphalke |
18:5ae03a197e59 | 64 | int32_t read_single_sample(uint8_t input_chn, uint32_t *raw_data); |
mahphalke |
18:5ae03a197e59 | 65 | size_t read_buffered_data(char *pbuf, |
mahphalke |
18:5ae03a197e59 | 66 | size_t bytes, |
mahphalke |
18:5ae03a197e59 | 67 | size_t offset, |
mahphalke |
18:5ae03a197e59 | 68 | uint32_t active_chns_mask, |
mahphalke |
18:5ae03a197e59 | 69 | uint8_t sample_size_in_bytes); |
mahphalke |
18:5ae03a197e59 | 70 | void store_requested_samples_count(size_t bytes, uint8_t sample_size_in_bytes); |
mahphalke |
17:af1f2416dd26 | 71 | void start_data_capture(uint32_t ch_mask, uint8_t num_of_chns); |
mahphalke |
17:af1f2416dd26 | 72 | void stop_data_capture(void); |
mahphalke |
18:5ae03a197e59 | 73 | void data_capture_callback(void *ctx, uint32_t event, void *extra); |
mahphalke |
17:af1f2416dd26 | 74 | |
mahphalke |
17:af1f2416dd26 | 75 | #endif /* _ADC_DATA_CAPTURE_H_ */ |