Statistics
| Branch: | Tag: | Revision:

mongoose / examples / STM32F4_CC3100 / stm32f4xx_hal_msp.h @ eaef5bd1

History | View | Annotate | Download (2.35 KB)

1
/*
2
 * Copyright (c) 2014-2016 Cesanta Software Limited
3
 * All rights reserved
4
 */
5

    
6
#ifndef CS_MONGOOSE_EXAMPLES_STM32F4_CC3100_STM32F4XX_HAL_MSP_H_
7
#define CS_MONGOOSE_EXAMPLES_STM32F4_CC3100_STM32F4XX_HAL_MSP_H_
8

    
9
/*
10
 * Definitions for SPI used to communicate with CC3100
11
 * All samples in STMCubeF4 use SPI4 for examples
12
 * We do the same. See README.MD for details.
13
 */
14
#define SPIx_NUMBER 4
15
#define SPIx SPI4
16
#define SPIx_CLK_ENABLE() __HAL_RCC_SPI4_CLK_ENABLE()
17
#define SPIx_SCK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
18
#define SPIx_MISO_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
19
#define SPIx_MOSI_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
20
#define SPIx_NSS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
21

    
22
#define SPIx_FORCE_RESET() __HAL_RCC_SPI4_FORCE_RESET()
23
#define SPIx_RELEASE_RESET() __HAL_RCC_SPI4_RELEASE_RESET()
24

    
25
#define SPIx_SCK_PIN GPIO_PIN_2
26
#define SPIx_SCK_GPIO_PORT GPIOE
27
#define SPIx_SCK_AF GPIO_AF5_SPI4
28
#define SPIx_MISO_PIN GPIO_PIN_5
29
#define SPIx_MISO_GPIO_PORT GPIOE
30
#define SPIx_MISO_AF GPIO_AF5_SPI4
31
#define SPIx_MOSI_PIN GPIO_PIN_6
32
#define SPIx_MOSI_GPIO_PORT GPIOE
33
#define SPIx_MOSI_AF GPIO_AF5_SPI4
34

    
35
#define SPIx_IRQn SPI4_IRQn
36
#define SPIx_IRQHandler SPI4_IRQHandler
37

    
38
#define SPI_CS_PIN GPIO_PIN_12
39
#define SPI_CS_PORT GPIOB
40

    
41
/*
42
 * CC3100 requires 2 additional pins for communication
43
 * See http://processors.wiki.ti.com/index.php/CC31xx_SPI_Host_Interface
44
 * for details
45
 */
46

    
47
#define MCU_IRQ_PIN GPIO_PIN_0
48
#define MCU_IRQ_PORT GPIOA
49
#define MCU_nHIB_PORT GPIOB
50
#define MCU_nHIB_PIN GPIO_PIN_0
51

    
52
/*
53
 * Definitions used for debug uart.
54
 * By default we use USART1, and this allows to connect serial port monitor
55
 * to dedicated pin (PA9) and to ST-LINK port (/dev/ttyACM0 in Linux)
56
 * See README.MD for details.
57
 */
58
#define USARTx USART1
59
#define USART_SPEED 115200
60
#define USARTx_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE();
61
#define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
62
#define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
63

    
64
#define USARTx_FORCE_RESET() __HAL_RCC_USART1_FORCE_RESET()
65
#define USARTx_RELEASE_RESET() __HAL_RCC_USART1_RELEASE_RESET()
66

    
67
#define USARTx_TX_PIN GPIO_PIN_9
68
#define USARTx_TX_GPIO_PORT GPIOA
69
#define USARTx_TX_AF GPIO_AF7_USART1
70
#define USARTx_RX_PIN GPIO_PIN_10
71
#define USARTx_RX_GPIO_PORT GPIOA
72
#define USARTx_RX_AF GPIO_AF7_USART1
73

    
74
#endif /* CS_MONGOOSE_EXAMPLES_STM32F4_CC3100_STM32F4XX_HAL_MSP_H_ */