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_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 
30 /******************************************************************************/
31 /********************** Macros and Constants Definition ***********************/
32 /******************************************************************************/
33 
34 #define HW_CARRIER_NAME STR(TARGET_NAME)
35 
36 /* Select b/w Arduino or SDP-120 pin header (default is Arduino) */
37 //#define SDP_120
38 
39 #ifdef SDP_120
40 /* Pin mapping of SDP-K1 w.r.t SDP-120 connector */
41 #define SPI_CSB SDP_SPI_CS_A
42 #define SPI_HOST_SDO SDP_SPI_MOSI
43 #define SPI_HOST_SDI SDP_SPI_MISO
44 #define SPI_SCK SDP_SPI_SCK
45 #define I2C_SCL SDP_I2C_SCL
46 #define I2C_SDA SDP_I2C_SDA
47 
48 #define SYNC_INB SDP_GPIO_1
49 #define DIG_AUX_1 SDP_GPIO_0
50 #define DIG_AUX_2 SDP_GPIO_2
51 #else
52 /* Pin mapping of SDP-K1 w.r.t Arduino connector */
53 #define SPI_CSB ARDUINO_UNO_D10
54 #define SPI_HOST_SDO ARDUINO_UNO_D11
55 #define SPI_HOST_SDI ARDUINO_UNO_D12
56 #define SPI_SCK ARDUINO_UNO_D13
57 #define I2C_SCL ARDUINO_UNO_D15
58 #define I2C_SDA ARDUINO_UNO_D14
59 
60 #define SYNC_INB ARDUINO_UNO_D4
61 #define DIG_AUX_1 ARDUINO_UNO_D2
62 #define DIG_AUX_2 ARDUINO_UNO_D7
63 #endif
64 
65 #define I2C_DEVICE_ID 0
66 
67 /* GPIO Port (Unused) */
68 #define DIG_AUX_1_PORT 0
69 #define DIG_AUX_2_PORT 0
70 #define SYNC_INB_PORT 0
71 
72 /* Common pin mapping on SDP-K1 */
73 #define UART_TX CONSOLE_TX
74 #define UART_RX CONSOLE_RX
75 #define LED_GPO LED3
76 
77 /* Time period for periodic ticker interrupt (in usec) */
78 #define TICKER_INTERRUPT_PERIOD_uSEC (50000)
79 
80 /* LVGL tick time period for Mbed platform */
81 #define LVGL_TICK_TIME_US 5000
82 #define LVGL_TICK_TIME_MS (LVGL_TICK_TIME_US / 1000)
83 
84 /* Note: The below macro and the type of digital filter chosen together
85  * decides the output data rate to be configured for the device.
86  * Filter configuration can be modified by changing the macro "AD4170_FILTER_CONFIG"
87  * in the respective user configuration header file.
88  * Please refer to the datasheet for more details on the other filter configurations.
89  * It has to be noted that this is not the maximum ODR permissible by the device, but
90  * a value specific to the SDP-K1 platform tested with a 10MHz SPI clock. The maximum
91  * ODR might vary across platforms and data continuity is not guaranteed above this ODR
92  * on the IIO Client */
93 #define FS_CONFIG_VALUE 16 // ODR = ~32KSPS (per channel) with Sinc5 average filter
94 
95 /* Max SPI Speed */
96 #define AD4170_MAX_SPI_SPEED 22500000
97 
98 /******************************************************************************/
99 /********************** Public/Extern Declarations ****************************/
100 /******************************************************************************/
101 
102 extern struct mbed_irq_init_param mbed_ticker_int_extra_init_params;
103 extern struct mbed_gpio_irq_init_param mbed_trigger_gpio_irq_init_params;
104 extern struct mbed_gpio_init_param mbed_dig_aux1_gpio_extra_init_params;
105 extern struct mbed_gpio_init_param mbed_dig_aux2_gpio_extra_init_params;
106 extern struct mbed_gpio_init_param mbed_sync_inb_gpio_extra_init_params;
107 extern struct mbed_gpio_init_param mbed_trigger_gpio_extra_init_params;
108 extern struct mbed_uart_init_param mbed_uart_extra_init_params;
109 extern struct mbed_uart_init_param mbed_vcom_extra_init_params;
110 extern struct mbed_spi_init_param mbed_spi_extra_init_params;
111 extern struct mbed_i2c_init_param mbed_i2c_extra_init_params;
112 
113 void lvgl_tick_callback(void *ctx);
114 
115 #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
void lvgl_tick_callback(void *ctx)
struct mbed_irq_init_param mbed_ticker_int_extra_init_params
Definition: app_config_mbed.c:65
struct mbed_gpio_init_param mbed_dig_aux1_gpio_extra_init_params
Definition: app_config_mbed.c:51
struct mbed_gpio_init_param mbed_dig_aux2_gpio_extra_init_params
Definition: app_config_mbed.c:55
struct mbed_gpio_init_param mbed_sync_inb_gpio_extra_init_params
Definition: app_config_mbed.c:59