precision-converters-firmware
app_config_mbed.h
Go to the documentation of this file.
1 /***************************************************************************/
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 "mbed_uart.h"
24 #include "mbed_spi.h"
25 #include "mbed_pwm.h"
26 #include "mbed_gpio_irq.h"
27 #include "mbed_gpio.h"
28 #include "mbed_pwm.h"
29 #include "mbed_i2c.h"
30 
31 /******************************************************************************/
32 /********************** Macros and Constants Definition ***********************/
33 /******************************************************************************/
34 
35 /* Pin mapping for AD469x w.r.t Arduino Headers */
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 /* Common pin mapping on SDP-K1 */
42 #define UART_TX CONSOLE_TX
43 #define UART_RX CONSOLE_RX
44 
45 #define I2C_SCL ARDUINO_UNO_D15
46 #define I2C_SDA ARDUINO_UNO_D14
47 
48 #define DIGI_GOOD_PIN ARDUINO_UNO_D6
49 
50 /* Define the max possible sampling (or output data) rate for a given platform.
51  * This is also used to find the time period to trigger a periodic conversion event.
52  * Note: Max possible ODR is 62.5KSPS per channel for continuous data capture on
53  * IIO client. This is derived by testing the firmware on SDP-K1 controller board
54  * @22Mhz SPI clock. The max possible ODR can vary from board to board and
55  * data continuity is not guaranteed above this ODR on IIO oscilloscope */
56 #define SAMPLING_RATE (62500)
57 #define CONV_TRIGGER_PERIOD_NSEC(x) (((float)(1.0 / x) * 1000000) * 1000)
58 #define CONV_TRIGGER_DUTY_CYCLE_NSEC(x) (CONV_TRIGGER_PERIOD_NSEC(x) / 10)
59 
60 /* Redefine the init params structure mapping w.r.t. Mbed platform */
61 #define gpio_ops mbed_gpio_ops
62 #define spi_ops mbed_spi_ops
63 #define i2c_ops mbed_i2c_ops
64 #define uart_ops mbed_uart_ops
65 #define vcom_ops mbed_virtual_com_ops
66 #define pwm_ops mbed_pwm_ops
67 #define gpio_ops mbed_gpio_ops
68 #define spi_ops mbed_spi_ops
69 #define trigger_gpio_irq_ops mbed_gpio_irq_ops
70 #define trigger_gpio_handle 0 // Unused macro
71 #define TRIGGER_GPIO_PORT 0 // Unused macro
72 #define TRIGGER_GPIO_PIN ARDUINO_UNO_D2
73 #define TIMER1_ID 0 // Unused macro
74 #define TIMER2_ID 0 // Unused macro
75 #define TRIGGER_INT_ID 0 // Unused macro
76 #define I2C_DEV_ID 0 // Unused macro
77 #define UART_MODULE 0 // Unused macro
78 #define UART_IRQ 0 // Unused macro
79 #define SPI_DEVICE_ID 0 // Unused macro
80 #define SPI_CS_PIN_NUM ARDUINO_UNO_D10
81 #define CNV_PIN_NUM ARDUINO_UNO_D6
82 #define CNV_PORT_NUM 0 // Unused macro
83 #define GP0_PIN_NUM 0 // Unused macro
84 #define GP0_PORT_NUM 0 // Unused macro
85 #define GP1_PIN_NUM 0 // Unused macro
86 #define GP1_PORT_NUM 0 // Unused macro
87 #define BSY_PIN_NUM ARDUINO_UNO_D9
88 #define BSY_PORT_NUM 0 // Unused macro
89 #define RESET_PIN_NUM ARDUINO_UNO_D4
90 #define RESET_PORT_NUM 0 // Unused macro
91 #define MAX_SPI_SCLK 22500000
92 
93 /******************************************************************************/
94 /********************** Public/Extern Declarations ****************************/
95 /******************************************************************************/
96 
97 extern struct mbed_gpio_init_param mbed_gpio_bsy_extra_init_params;
98 extern struct mbed_gpio_irq_init_param mbed_trigger_gpio_irq_init_params;
99 extern struct mbed_uart_init_param mbed_uart_extra_init_params;
100 extern struct mbed_uart_init_param mbed_vcom_extra_init_params;
101 extern struct mbed_spi_init_param mbed_spi_extra_init_params;
102 extern struct mbed_pwm_init_param mbed_pwm_extra_init_params;
103 extern struct mbed_i2c_init_param mbed_i2c_extra_init_params;
104 extern struct mbed_gpio_init_param mbed_gpio_reset_extra_init_params;
105 extern struct mbed_gpio_init_param mbed_gpio_cnv_extra_init_params;
106 
107 #endif /* APP_CONFIG_MBED_H_ */
struct mbed_pwm_init_param mbed_pwm_extra_init_params
Definition: app_config_mbed.c:69
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_gpio_init_param mbed_gpio_cnv_extra_init_params
Definition: app_config_mbed.c:75
struct mbed_i2c_init_param mbed_i2c_extra_init_params
Definition: app_config_mbed.c:69
struct mbed_gpio_init_param mbed_gpio_bsy_extra_init_params
Definition: app_config_mbed.c:71
struct mbed_gpio_init_param mbed_gpio_reset_extra_init_params
Definition: app_config_mbed.c:76