EVAL-AD7124 Mbed Example Program.
Dependencies: adi_console_menu platform_drivers
app/ad7124_console_app.h@7:3e1005bd4d41, 2021-08-03 (annotated)
- Committer:
- Kjansen
- Date:
- Tue Aug 03 12:05:42 2021 +0100
- Revision:
- 7:3e1005bd4d41
- Parent:
- 3:779bb1e55f1a
No-OS Adoption Changes:
* Updated the .lib files for adoption of no-OS repository as-is.
* Replaced platform_drivers.h with required header files.
* Added designated initializers for nanodac_init_params as the latest
spi_init_param in no-OS repository include a new field member platform_ops.
* Added Support Macros.
* Updated the copyright year of the nanodac_console_app.c file
Mbed OS update changes:
1) Added the mbed_app.json file with custom parameters
2) Updated the mbed-os version to 6.8.0
Updated the readme file.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke | 3:779bb1e55f1a | 1 | /*! |
mahphalke | 3:779bb1e55f1a | 2 | ***************************************************************************** |
mahphalke | 3:779bb1e55f1a | 3 | @file: ad7124_console_app.h |
mahphalke | 3:779bb1e55f1a | 4 | |
mahphalke | 3:779bb1e55f1a | 5 | @brief: defines the console menu structure for the AD7124 example code |
mahphalke | 3:779bb1e55f1a | 6 | |
mahphalke | 3:779bb1e55f1a | 7 | @details: |
mahphalke | 3:779bb1e55f1a | 8 | ----------------------------------------------------------------------------- |
mahphalke | 3:779bb1e55f1a | 9 | Copyright (c) 2019, 2020 Analog Devices, Inc. |
mahphalke | 3:779bb1e55f1a | 10 | All rights reserved. |
mahphalke | 3:779bb1e55f1a | 11 | |
mahphalke | 3:779bb1e55f1a | 12 | This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke | 3:779bb1e55f1a | 13 | By using this software you agree to the terms of the associated |
mahphalke | 3:779bb1e55f1a | 14 | Analog Devices Software License Agreement. |
mahphalke | 3:779bb1e55f1a | 15 | *****************************************************************************/ |
mahphalke | 3:779bb1e55f1a | 16 | |
mahphalke | 3:779bb1e55f1a | 17 | #ifndef AD7124_CONSOLE_APP_H_ |
mahphalke | 3:779bb1e55f1a | 18 | #define AD7124_CONSOLE_APP_H_ |
mahphalke | 3:779bb1e55f1a | 19 | |
mahphalke | 3:779bb1e55f1a | 20 | #include "adi_console_menu.h" |
mahphalke | 3:779bb1e55f1a | 21 | |
mahphalke | 3:779bb1e55f1a | 22 | /* #defines */ |
mahphalke | 3:779bb1e55f1a | 23 | #define AD7124_CONFIG_A 0 |
mahphalke | 3:779bb1e55f1a | 24 | #define AD7124_CONFIG_B 1 |
mahphalke | 3:779bb1e55f1a | 25 | |
mahphalke | 3:779bb1e55f1a | 26 | /* Public Declarations */ |
mahphalke | 3:779bb1e55f1a | 27 | int32_t ad7124_app_initialize(uint8_t configID); |
mahphalke | 3:779bb1e55f1a | 28 | |
mahphalke | 3:779bb1e55f1a | 29 | extern console_menu ad7124_main_menu; |
mahphalke | 3:779bb1e55f1a | 30 | |
mahphalke | 3:779bb1e55f1a | 31 | |
mahphalke | 3:779bb1e55f1a | 32 | /* AD7124 Filter types */ |
mahphalke | 3:779bb1e55f1a | 33 | typedef enum { |
mahphalke | 3:779bb1e55f1a | 34 | SINC4_FILTER = 0, |
mahphalke | 3:779bb1e55f1a | 35 | SINC3_FILTER = 2, |
mahphalke | 3:779bb1e55f1a | 36 | FAST_SETTLING_SINC4_FILTER = 4, |
mahphalke | 3:779bb1e55f1a | 37 | FAST_SETTLING_SINC3_FILTER = 5 |
mahphalke | 3:779bb1e55f1a | 38 | } filter_type; |
mahphalke | 3:779bb1e55f1a | 39 | |
mahphalke | 3:779bb1e55f1a | 40 | /* AD7124 Reference Source */ |
mahphalke | 3:779bb1e55f1a | 41 | typedef enum { |
mahphalke | 3:779bb1e55f1a | 42 | REFIN1, |
mahphalke | 3:779bb1e55f1a | 43 | REFIN2, |
mahphalke | 3:779bb1e55f1a | 44 | INT, |
mahphalke | 3:779bb1e55f1a | 45 | AVDD |
mahphalke | 3:779bb1e55f1a | 46 | } reference_type; |
mahphalke | 3:779bb1e55f1a | 47 | |
mahphalke | 3:779bb1e55f1a | 48 | /* AD7124 power mode */ |
mahphalke | 3:779bb1e55f1a | 49 | typedef enum { |
mahphalke | 3:779bb1e55f1a | 50 | LOW_POWER_MODE, |
mahphalke | 3:779bb1e55f1a | 51 | MED_POWER_MODE, |
mahphalke | 3:779bb1e55f1a | 52 | FULL_POWER_MODE |
mahphalke | 3:779bb1e55f1a | 53 | } power_mode_t; |
mahphalke | 3:779bb1e55f1a | 54 | |
mahphalke | 3:779bb1e55f1a | 55 | // Available adc master clock for particular power mode |
mahphalke | 3:779bb1e55f1a | 56 | #define LOW_POWER_MODE_FREQUENCY 76800 // 76.8Khz |
mahphalke | 3:779bb1e55f1a | 57 | #define MED_POWER_MODE_FREQUENCY 153600 // 153.6Khz |
mahphalke | 3:779bb1e55f1a | 58 | #define FUL_POWER_MODE_FREQUENCY 614400 // 614.4Khz |
mahphalke | 3:779bb1e55f1a | 59 | |
mahphalke | 3:779bb1e55f1a | 60 | #define DEVICE_REG_READ_ID 1 |
mahphalke | 3:779bb1e55f1a | 61 | #define DEVICE_REG_WRITE_ID 2 |
mahphalke | 3:779bb1e55f1a | 62 | |
mahphalke | 3:779bb1e55f1a | 63 | /* AD7124 Setup Configuration Structure */ |
mahphalke | 3:779bb1e55f1a | 64 | typedef struct { |
mahphalke | 3:779bb1e55f1a | 65 | filter_type filter; // Filter type |
mahphalke | 3:779bb1e55f1a | 66 | uint16_t data_rate_fs_val; // Output data rate value |
mahphalke | 3:779bb1e55f1a | 67 | uint8_t programmable_gain_bits; // PGA bits value |
mahphalke | 3:779bb1e55f1a | 68 | uint8_t polarity; // Bipolar or Unipolar analog input |
mahphalke | 3:779bb1e55f1a | 69 | reference_type reference; // Reference source for ADC |
mahphalke | 3:779bb1e55f1a | 70 | uint8_t input_buffers; // Buffers on analog inputs |
mahphalke | 3:779bb1e55f1a | 71 | uint8_t reference_buffers; // Buffers on reference source |
mahphalke | 3:779bb1e55f1a | 72 | uint8_t channel_enabled; // Channel Enable/Disable flag |
mahphalke | 3:779bb1e55f1a | 73 | uint8_t setup_assigned; // Assigned setup to channel |
mahphalke | 3:779bb1e55f1a | 74 | uint8_t pos_analog_input; // Positive analog input |
mahphalke | 3:779bb1e55f1a | 75 | uint8_t neg_analog_input; // Negative analog input |
mahphalke | 3:779bb1e55f1a | 76 | } ad7124_setup_config; |
mahphalke | 3:779bb1e55f1a | 77 | |
mahphalke | 3:779bb1e55f1a | 78 | |
mahphalke | 3:779bb1e55f1a | 79 | #endif /* AD7124_CONSOLE_APP_H_ */ |