precision-converters-firmware
Loading...
Searching...
No Matches
app_config_stm32.h
Go to the documentation of this file.
1/***************************************************************************/
13#ifndef APP_CONFIG_STM32_H_
14#define APP_CONFIG_STM32_H_
15
16/******************************************************************************/
17/***************************** Include Files **********************************/
18/******************************************************************************/
19#include <stdint.h>
20
21#include "stm32_i2c.h"
22#include "stm32_irq.h"
23#include "stm32_gpio_irq.h"
24#include "stm32_spi.h"
25#include "stm32_gpio.h"
26#include "stm32_uart.h"
27#ifdef STM32F469xx
28#include "stm32_usb_uart.h"
29#include "stm32_uart_stdio.h"
30#endif
31
32/******************************************************************************/
33/********************** Macros and Constants Definition ***********************/
34/******************************************************************************/
35/* Select FS scaler value for the default user config mode.
36 * This is not a max FS value that can be set into device but rather a value to
37 * achieve max approximate ODR in the firmware for a given platform/setup.
38 * Max ODR is derived by testing the firmware on SDP-K1 and DISCO-F769 controller board
39 * @10Mhz SPI clock. The max possible ODR can vary from board to board and
40 * data continuity is not guaranteed above this ODR on IIO client */
41#define FS_CONFIG_VALUE 1 // ODR = 2.4KSPS
42
43#ifdef STM32F469xx
44/* Note: The SDP-K1 board with the STM32F469NI MCU has been used
45* for developing the firmware. The below parameters will change depending
46* on the controller used. */
47#define TARGET_NAME SDP_K1
48
49/* Pin mapping for AD4052 w.r.t Arduino Headers */
50/* STM32 I2C specific parameters */
51#define I2C_DEVICE_ID 1 // I2C1
52
53/* STM32 UART Specific parameters */
54#define UART_MODULE 5 // UART5
55#define UART_IRQ UART5_IRQn
56#define APP_UART_HANDLE huart5
57#define APP_UART_USB_HANDLE hUsbDeviceHS
58
59/* STM32 SPI Specific parameters */
60#define SPI_DEVICE_ID 1 // SPI1
61#define SPI_CSB 15 // PA_15
62#define SPI_CS_PORT_NUM 0 // PORTA
63
64/* STM32 GPIO Specific parameter */
65#define CNV_PIN_NUM 7 // PG_7
66#define CNV_PORT_NUM 6 // PORTG
67#define LED_GPIO_PORT 10 // PK_7
68#define LED_GPIO 7 // PORTK
69
70/* Priority of the RDY Interrupt */
71#define RDY_GPIO_PRIORITY 1
72
73#else
74/* The below configurations are specific to STM32769NI MCU on Disco-F769NI Board. */
75#define HW_CARRIER_NAME DISCO-F769NI
76
77/* STM32 SPI Specific parameters */
78#define SPI_DEVICE_ID 2 // SPI1
79#define SPI_CS_PORT_NUM 0 // GPIO Port D
80#define SPI_CSB 11 // PA_11
81
82/* STM32 UART specific parameters */
83#define APP_UART_HANDLE huart6
84
85/* UART Device ID */
86#define UART_IRQ USART6_IRQn
87#define UART_MODULE 6 // UART5
88
89/* RDY specific Port and Pin */
90#define CNV_PORT_NUM 9
91#define CNV_PIN_NUM 1 // PJ_1
92
93#define I2C_DEVICE_ID 1 // I2C1
94
95/* I2C timing register value for standard mode of operation
96 * Check here for more understanding on I2C timing register
97 * configuration: TODO*/
98#define I2C_TIMING 0x40912732
99
100/* Ticker for Pocket Lab */
101#define LVGL_TICK_TIME_US 5000
102#define LVGL_TICK_TIME_MS (LVGL_TICK_TIME_US / 1000)
103
104#endif
105
106/******************************************************************************/
107/********************** Public/Extern Declarations ****************************/
108/******************************************************************************/
109
110extern UART_HandleTypeDef APP_UART_HANDLE;
111#ifdef STM32F469xx
112extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
113#endif
114
116extern struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params;
117extern struct stm32_gpio_init_param stm32_trigger_gpio_extra_init_params;
118extern struct stm32_uart_init_param stm32_uart_extra_init_params;
119extern struct stm32_spi_init_param stm32_spi_extra_init_params;
120
121void stm32_system_init(void);
122
123#endif /* APP_CONFIG_STM32_H_ */
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:176
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:38
#define APP_UART_USB_HANDLE
Definition app_config_stm32.h:44
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Definition app_config_stm32.c:43
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:102
#define APP_UART_HANDLE
Definition app_config_stm32.h:131
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition app_config_stm32.c:43
struct stm32_gpio_init_param stm32_trigger_gpio_extra_init_params
Definition app_config_stm32.c:49
VCOM driver for stm32 as a no_os_uart implementation.
Specific initialization parameters for stm32 UART over USB.
Definition stm32_usb_uart.h:27