precision-converters-firmware
app_config_mbed.h
Go to the documentation of this file.
1 /***************************************************************************/
14 #ifndef APP_CONFIG_MBED_H_
15 #define APP_CONFIG_MBED_H_
16 
17 /******************************************************************************/
18 /***************************** Include Files **********************************/
19 /******************************************************************************/
20 
21 #include <stdint.h>
22 #include <PinNames.h>
23 
24 #include "mbed_uart.h"
25 #include "mbed_gpio_irq.h"
26 #include "mbed_spi.h"
27 #include "mbed_pwm.h"
28 #include "mbed_gpio.h"
29 
30 /******************************************************************************/
31 /********************** Macros and Constants Definition ***********************/
32 /******************************************************************************/
33 #define SPI_CSB ARDUINO_UNO_D10
34 #define SPI_HOST_SDO ARDUINO_UNO_D11
35 #define SPI_HOST_SDI ARDUINO_UNO_D12
36 #define SPI_SCK ARDUINO_UNO_D13
37 #define PWM_TRIGGER ARDUINO_UNO_D3
38 
39 #define GPIO_A0 ARDUINO_UNO_D0
40 #define GPIO_A1 ARDUINO_UNO_D1
41 #define GPIO_RES0 ARDUINO_UNO_D5
42 #define GPIO_RES1 ARDUINO_UNO_D6
43 #define GPIO_SAMPLE ARDUINO_UNO_D4
44 
45 /* UART Common Pin Mapping on SDP-K1 */
46 #define UART_TX CONSOLE_TX
47 #define UART_RX CONSOLE_RX
48 
49 /* Define a sampling rate for a given setup.
50  * This is used to find the time period to trigger a periodic conversion event.
51  * Currently the value was experimentally found by testing the firmware on SDP-K1
52  * controller board @20Mhz SPI clock, with fly wires to breakout board.
53  * This can vary from board to board, the exact maximum value was not determined
54  * as 16k seems reasonable for this setup.
55  * */
56 #define SAMPLING_RATE (16000)
57 #define CONV_TRIGGER_PERIOD_NSEC (((float)(1.0 / SAMPLING_RATE) * 1000000) * 1000)
58 #define CONV_TRIGGER_DUTY_CYCLE_NSEC (CONV_TRIGGER_PERIOD_NSEC / 2)
59 
60 /******************************************************************************/
61 /********************** Public/Extern Declarations ****************************/
62 /******************************************************************************/
63 
64 extern struct mbed_uart_init_param mbed_uart_extra_init_params;
65 extern struct mbed_uart_init_param mbed_vcom_extra_init_params;
66 extern struct mbed_spi_init_param mbed_spi_extra_init_params;
67 extern struct mbed_gpio_init_param mbed_trigger_gpio_extra_init_params;
68 extern struct mbed_gpio_irq_init_param mbed_trigger_gpio_irq_init_params;
69 extern struct mbed_pwm_init_param mbed_pwm_extra_init_params;
70 
71 #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