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_irq.h"
25 #include "mbed_gpio_irq.h"
26 #include "mbed_spi.h"
27 #include "mbed_i2c.h"
28 #include "mbed_pwm.h"
29 #include "mbed_gpio.h"
30 
31 /******************************************************************************/
32 /********************** Macros and Constants Definition ***********************/
33 /******************************************************************************/
34 
35 /* Pin mapping of SDP-K1 w.r.t Arduino connector */
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 /* Common pin mapping on SDP-K1 */
45 #define UART_TX CONSOLE_TX
46 #define UART_RX CONSOLE_RX
47 #define LED_GPO LED3
48 
49 /* Pin mapping w.r.t. target */
50 #define OSR0_PIN ARDUINO_UNO_D1
51 #define OSR1_PIN ARDUINO_UNO_D2
52 #define OSR2_PIN ARDUINO_UNO_D4
53 #define RESET_PIN ARDUINO_UNO_D5
54 #define CONVST_PIN ARDUINO_UNO_D6
55 #define BUSY_PIN ARDUINO_UNO_D7
56 #define RANGE_PIN ARDUINO_UNO_D8
57 #define STDBY_PIN ARDUINO_UNO_D9
58 
59 /* Pins used to trigger and/or read a new (periodic) conversion event */
60 #define PWM_TRIGGER ARDUINO_UNO_D3
61 #define INT_EVENT ARDUINO_UNO_D3
62 
63 /* Define the max possible sampling (or output data) rate for a given platform.
64  * This is also used to find the time period to trigger a periodic conversion event.
65  * Note: Max possible ODR is 16KSPS per channel for continuous data capture on
66  * IIO client. This is derived by testing the firmware on SDP-K1 controller board
67  * @22Mhz SPI clock. The max possible ODR can vary from board to board and
68  * data continuity is not guaranteed above this ODR on IIO oscilloscope */
69 #define SAMPLING_RATE (16000)
70 #define CONV_TRIGGER_PERIOD_NSEC (((float)(1.0 / SAMPLING_RATE) * 1000000) * 1000)
71 #define CONV_TRIGGER_DUTY_CYCLE_NSEC (CONV_TRIGGER_PERIOD_NSEC / 2)
72 
73 /******************************************************************************/
74 /********************** Public/Extern Declarations ****************************/
75 /******************************************************************************/
76 
77 extern struct mbed_gpio_irq_init_param mbed_trigger_gpio_irq_init_params;
78 extern struct mbed_gpio_init_param mbed_trigger_gpio_extra_init_params;
79 extern struct mbed_gpio_init_param mbed_reset_gpio_extra_init_params;
80 extern struct mbed_gpio_init_param mbed_convst_gpio_extra_init_params;
81 extern struct mbed_gpio_init_param mbed_busy_gpio_extra_init_params;
82 extern struct mbed_gpio_init_param mbed_osr0_gpio_extra_init_params;
83 extern struct mbed_gpio_init_param mbed_osr1_gpio_extra_init_params;
84 extern struct mbed_gpio_init_param mbed_osr2_gpio_extra_init_params;
85 extern struct mbed_gpio_init_param mbed_range_gpio_extra_init_params;
86 extern struct mbed_gpio_init_param mbed_stdby_gpio_extra_init_params;
87 extern struct mbed_pwm_init_param mbed_pwm_extra_init_params;
88 extern struct mbed_uart_init_param mbed_uart_extra_init_params;
89 extern struct mbed_uart_init_param mbed_vcom_extra_init_params;
90 extern struct mbed_spi_init_param mbed_spi_extra_init_params;
91 extern struct mbed_i2c_init_param mbed_i2c_extra_init_params;
92 
93 #endif /* APP_CONFIG_MBED_H_ */
struct mbed_gpio_init_param mbed_trigger_gpio_extra_init_params
Definition: app_config_mbed.c:61
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_i2c_init_param mbed_i2c_extra_init_params
Definition: app_config_mbed.c:69
struct mbed_gpio_init_param mbed_convst_gpio_extra_init_params
Definition: app_config_mbed.c:55
struct mbed_gpio_init_param mbed_osr2_gpio_extra_init_params
Definition: app_config_mbed.c:71
struct mbed_gpio_init_param mbed_osr1_gpio_extra_init_params
Definition: app_config_mbed.c:67
struct mbed_gpio_init_param mbed_range_gpio_extra_init_params
Definition: app_config_mbed.c:75
struct mbed_gpio_init_param mbed_busy_gpio_extra_init_params
Definition: app_config_mbed.c:59
struct mbed_gpio_init_param mbed_osr0_gpio_extra_init_params
Definition: app_config_mbed.c:63
struct mbed_gpio_init_param mbed_stdby_gpio_extra_init_params
Definition: app_config_mbed.c:79
struct mbed_gpio_init_param mbed_reset_gpio_extra_init_params
Definition: app_config_mbed.c:51