precision-converters-firmware
app_config_mbed.h
Go to the documentation of this file.
1 /***************************************************************************//*
2  * @file app_config_mbed.h
3  * @brief Header file for Mbed platform configurations
4 ******************************************************************************
5  * Copyright (c) 2021-23 Analog Devices, Inc.
6  * All rights reserved.
7  *
8  * This software is proprietary to Analog Devices, Inc. and its licensors.
9  * By using this software you agree to the terms of the associated
10  * Analog Devices Software License Agreement.
11 ******************************************************************************/
12 
13 #ifndef _APP_CONFIG_MBED_H_
14 #define _APP_CONFIG_MBED_H_
15 
16 /******************************************************************************/
17 /***************************** Include Files **********************************/
18 /******************************************************************************/
19 
20 #include <stdint.h>
21 #include <PinNames.h>
22 
23 #include "no_os_gpio.h"
24 #include "mbed_uart.h"
25 #include "mbed_irq.h"
26 #include "mbed_gpio_irq.h"
27 #include "mbed_spi.h"
28 #include "mbed_i2c.h"
29 #include "mbed_gpio.h"
30 
31 /******************************************************************************/
32 /********************** Macros and Constants Definition ***********************/
33 /******************************************************************************/
34 
35 // Pin mapping of AD7768-1 with arduino
36 #define SPI_CSB ARDUINO_UNO_D10
37 #define SPI_HOST_SDO ARDUINO_UNO_D11
38 #define SPI_HOST_SDI ARDUINO_UNO_D12
39 #define SPI_SCK ARDUINO_UNO_D13
40 
41 #define I2C_SCL ARDUINO_UNO_D15
42 #define I2C_SDA ARDUINO_UNO_D14
43 
44 // Conversion over interrupt
45 #define CONV_MON ARDUINO_UNO_D2
46 
47 /* Common pin mapping */
48 #define UART_TX CONSOLE_TX
49 #define UART_RX CONSOLE_RX
50 
51 /* Define the max possible sampling frequency (or output data) rate for AD77681 (in SPS).
52  * This is also used to find the time period to trigger a periodic conversion event.
53  * Note: Max possible ODR is 64KSPS for continuous data capture on IIO Client.
54  * This is derived by capturing data from the firmware using the SDP-K1 controller board
55  * @22.5Mhz SPI clock. The max possible ODR can vary from board to board and
56  * data continuity is not guaranteed above this ODR on IIO oscilloscope */
57 
58 /* AD77681 default internal clock frequency (MCLK = 16.384 Mhz) */
59 #define AD77681_MCLK (16384)
60 
61 /* AD77681 decimation rate */
62 #define AD77681_DECIMATION_RATE (32U)
63 
64 /* AD77681 default mclk_div value */
65 #define AD77681_DEFAULT_MCLK_DIV (8)
66 
67 /* AD77681 ODR conversion */
68 #define AD77681_ODR_CONV_SCALER (AD77681_DECIMATION_RATE * AD77681_DEFAULT_MCLK_DIV)
69 
70 /* AD77681 default sampling frequency */
71 #define AD77681_DEFAULT_SAMPLING_FREQ ((AD77681_MCLK * 1000) / AD77681_ODR_CONV_SCALER)
72 
73 /******************************************************************************/
74 /********************* Public/Extern Declarations *****************************/
75 /******************************************************************************/
76 extern struct mbed_gpio_irq_init_param mbed_trigger_gpio_irq_init_params;
77 extern struct mbed_gpio_init_param mbed_trigger_gpio_extra_init_params;
78 extern struct mbed_uart_init_param mbed_uart_extra_init_params;
79 extern struct mbed_uart_init_param mbed_vcom_extra_init_params;
80 extern struct mbed_spi_init_param mbed_spi_extra_init_params;
81 extern struct mbed_i2c_init_param mbed_i2c_extra_init_params;
82 
83 #endif /* _APP_CONFIG_MBED_H_ */
struct mbed_gpio_init_param mbed_trigger_gpio_extra_init_params
Definition: app_config_mbed.c:61
struct mbed_gpio_irq_init_param mbed_trigger_gpio_irq_init_params
Definition: app_config_mbed.c:65
struct mbed_uart_init_param mbed_vcom_extra_init_params
Definition: app_config_mbed.c:42
struct mbed_uart_init_param mbed_uart_extra_init_params
Definition: app_config_mbed.c:31
struct mbed_spi_init_param mbed_spi_extra_init_params
Definition: app_config_mbed.c:54
struct mbed_i2c_init_param mbed_i2c_extra_init_params
Definition: app_config_mbed.c:69