annotate Discovery/Inc/stm32f429i_discovery.h @ 208:9fc06e1e0f66 ImprovmentSPI

Update SPI error display and handling For easier identification of a communication problem the RX state of Main and RTE is displayed in the debug view. Also error reactions are now handles based on this state. E.g. RTE resets its DMA incase Main reports a data shift which can not be resolved by Main itself In addition the timeout for error detection has been decreased to have a faster reaction
author ideenmodellierer
date Sun, 24 Mar 2019 22:57:28 +0100
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Inc/stm32f429i_discovery.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief I2C EEPROM Interface pins
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 26-February-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// \par COPYRIGHT(c) 2014 STMicroelectronics
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 /// Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /// are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 /// 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 /// this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 /// 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 /// this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 /// and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 /// 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 /// may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 /// without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 /// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 /// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 /// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 /// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 /// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 #ifndef STM32F429I_DISCOVERY_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 #define STM32F429I_DISCOVERY_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 LED3 = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 LED4 = 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 } Led_TypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 BUTTON_KEY = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 } Button_TypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 BUTTON_MODE_GPIO = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 BUTTON_MODE_EXTI = 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 } ButtonMode_TypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 #if !defined (USE_STM32F429I_DISCO)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 #define USE_STM32F429I_DISCO
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 #define LEDn 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 #define LED3_PIN GPIO_PIN_13
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 #define LED3_GPIO_PORT GPIOG
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 #define LED3_GPIO_CLK_ENABLE() __GPIOG_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 #define LED3_GPIO_CLK_DISABLE() __GPIOG_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 #define LED4_PIN GPIO_PIN_14
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 #define LED4_GPIO_PORT GPIOG
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 #define LED4_GPIO_CLK_ENABLE() __GPIOG_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 #define LED4_GPIO_CLK_DISABLE() __GPIOG_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) (((__INDEX__) == 0) ? LED3_GPIO_CLK_ENABLE() : LED4_GPIO_CLK_ENABLE())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? LED3_GPIO_CLK_DISABLE() : LED4_GPIO_CLK_DISABLE())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 #define BUTTONn 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 * @brief Wakeup push-button
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 #define KEY_BUTTON_PIN GPIO_PIN_0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 #define KEY_BUTTON_GPIO_PORT GPIOA
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 #define KEY_BUTTON_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 #define KEY_BUTTON_GPIO_CLK_DISABLE() __GPIOA_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 #define KEY_BUTTON_EXTI_IRQn EXTI0_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) (KEY_BUTTON_GPIO_CLK_ENABLE())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (KEY_BUTTON_GPIO_CLK_DISABLE())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 /* Exported constanIO --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 #define IO_I2C_ADDRESS 0x82
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 #define TS_I2C_ADDRESS 0x82
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 #ifdef EE_M24LR64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 #define EEPROM_I2C_ADDRESS_A01 0xA0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 #define EEPROM_I2C_ADDRESS_A02 0xA6
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 #endif /* EE_M24LR64 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /*##################### I2Cx ###################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 /* User can use this section to tailor I2Cx instance used and associated
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 resources */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 #define DISCOVERY_I2Cx I2C3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 #define DISCOVERY_I2Cx_CLOCK_ENABLE() __I2C3_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 #define DISCOVERY_I2Cx_FORCE_RESET() __I2C3_FORCE_RESET()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 #define DISCOVERY_I2Cx_RELEASE_RESET() __I2C3_RELEASE_RESET()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 #define DISCOVERY_I2Cx_SDA_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 #define DISCOVERY_I2Cx_SCL_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 #define DISCOVERY_I2Cx_SDA_GPIO_CLK_DISABLE() __GPIOC_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 /* Definition for DISCO I2Cx Pins */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 #define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_8
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 #define DISCOVERY_I2Cx_SCL_GPIO_PORT GPIOA
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 #define DISCOVERY_I2Cx_SCL_SDA_AF GPIO_AF4_I2C3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 #define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_9
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 #define DISCOVERY_I2Cx_SDA_GPIO_PORT GPIOC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 /* Definition for IOE I2Cx's NVIC */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 #define DISCOVERY_I2Cx_EV_IRQn I2C3_EV_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 #define DISCOVERY_I2Cx_ER_IRQn I2C3_ER_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 /* I2C clock speed configuration (in Hz)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 WARNING:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 Make sure that this define is not already declared in other files (ie.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 stm324x9i_disco.h file). It can be used in parallel by other modules. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 #ifndef I2C_SPEED
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 #define I2C_SPEED 100000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 #endif /* I2C_SPEED */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 #define I2Cx_TIMEOUT_MAX 0x3000 /*<! The value of the maximal timeout for I2C waiting loops */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 /*##################### SPIx ###################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 #define DISCOVERY_SPIx SPI5
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 #define DISCOVERY_SPIx_CLK_ENABLE() __SPI5_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 #define DISCOVERY_SPIx_GPIO_PORT GPIOF /* GPIOF */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 #define DISCOVERY_SPIx_AF GPIO_AF5_SPI5
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 #define DISCOVERY_SPIx_GPIO_CLK_ENABLE() __GPIOF_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 #define DISCOVERY_SPIx_GPIO_CLK_DISABLE() __GPIOF_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 #define DISCOVERY_SPIx_SCK_PIN GPIO_PIN_7 /* PF.07 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 #define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_8 /* PF.08 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 #define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_9 /* PF.09 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 on accurate values, they just guarantee that the application will not remain
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 stuck if the SPI communication is corrupted.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 You may modify these timeout values depending on CPU frequency and application
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 conditions (interrupts routines ...). */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 #define SPIx_TIMEOUT_MAX ((uint32_t)0x1000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 /*##################### IOE ###################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 * @brief IOE Control pin
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 /* Definition for external IT for STMPE811 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 #define STMPE811_INT_PIN GPIO_PIN_15
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 #define STMPE811_INT_GPIO_PORT GPIOA
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 #define STMPE811_INT_CLK_ENABLE() __GPIOA_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 #define STMPE811_INT_CLK_DISABLE() __GPIOA_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 #define STMPE811_INT_EXTI EXTI15_10_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 #define STMPE811_INT_EXTIHandler EXTI15_10_IRQHandler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 /*##################### LCD ###################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 /* Chip Select macro definition */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 #define LCD_CS_LOW() HAL_GPIO_WritePin(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, GPIO_PIN_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 #define LCD_CS_HIGH() HAL_GPIO_WritePin(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, GPIO_PIN_SET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 /* Set WRX High to send data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 #define LCD_WRX_LOW() HAL_GPIO_WritePin(LCD_WRX_GPIO_PORT, LCD_WRX_PIN, GPIO_PIN_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 #define LCD_WRX_HIGH() HAL_GPIO_WritePin(LCD_WRX_GPIO_PORT, LCD_WRX_PIN, GPIO_PIN_SET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 /* Set WRX High to send data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 #define LCD_RDX_LOW() HAL_GPIO_WritePin(LCD_RDX_GPIO_PORT, LCD_RDX_PIN, GPIO_PIN_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 #define LCD_RDX_HIGH() HAL_GPIO_WritePin(LCD_RDX_GPIO_PORT, LCD_RDX_PIN, GPIO_PIN_SET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 * @brief LCD Control pin
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 #define LCD_NCS_PIN GPIO_PIN_2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 #define LCD_NCS_GPIO_PORT GPIOC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 #define LCD_NCS_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 #define LCD_NCS_GPIO_CLK_DISABLE() __GPIOC_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 * @brief LCD Command/data pin
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 #define LCD_WRX_PIN GPIO_PIN_13
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 #define LCD_WRX_GPIO_PORT GPIOD
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 #define LCD_WRX_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 #define LCD_WRX_GPIO_CLK_DISABLE() __GPIOD_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 #define LCD_RDX_PIN GPIO_PIN_12
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 #define LCD_RDX_GPIO_PORT GPIOD
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 #define LCD_RDX_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 #define LCD_RDX_GPIO_CLK_DISABLE() __GPIOD_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 /*##################### GYRO ##########################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 /* Read/Write command */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 #define READWRITE_CMD ((uint8_t)0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 /* Multiple byte read/write command */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 #define MULTIPLEBYTE_CMD ((uint8_t)0x40)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 /* Dummy Byte Send by the SPI Master device in order to generate the Clock to the Slave device */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 #define DUMMY_BYTE ((uint8_t)0x00)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 /* Chip Select macro definition */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 #define GYRO_CS_LOW() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 #define GYRO_CS_HIGH() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_SET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 * @brief GYRO SPI Interface pins
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 #define GYRO_CS_PIN GPIO_PIN_1 /* PC.01 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 #define GYRO_CS_GPIO_PORT GPIOC /* GPIOC */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 #define GYRO_CS_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 #define GYRO_CS_GPIO_CLK_DISABLE() __GPIOC_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 #define GYRO_INT_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 #define GYRO_INT_GPIO_CLK_DISABLE() __GPIOA_CLK_DISABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 #define GYRO_INT_GPIO_PORT GPIOA /* GPIOA */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 #define GYRO_INT1_PIN GPIO_PIN_1 /* PA.01 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 #define GYRO_INT1_EXTI_IRQn EXTI1_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 #define GYRO_INT2_PIN GPIO_PIN_2 /* PA.02 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 #define GYRO_INT2_EXTI_IRQn EXTI2_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 #ifdef EE_M24LR64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 * @brief I2C EEPROM Interface pins
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 #define EEPROM_I2C_DMA DMA1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 #define EEPROM_I2C_DMA_CHANNEL DMA_CHANNEL_3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 #define EEPROM_I2C_DMA_STREAM_TX DMA1_Stream4
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 #define EEPROM_I2C_DMA_STREAM_RX DMA1_Stream2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 #define EEPROM_I2C_DMA_CLK_ENABLE() __DMA1_CLK_ENABLE()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 #define EEPROM_I2C_DMA_TX_IRQn DMA1_Stream4_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 #define EEPROM_I2C_DMA_RX_IRQn DMA1_Stream2_IRQn
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 #define EEPROM_I2C_DMA_TX_IRQHandler DMA1_Stream4_IRQHandler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 #define EEPROM_I2C_DMA_RX_IRQHandler DMA1_Stream2_IRQHandler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 #define EEPROM_I2C_DMA_PREPRIO 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 #endif /*EE_M24LR64*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 uint32_t BSP_GetVersion(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 void BSP_LED_Init(Led_TypeDef Led);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 void BSP_LED_On(Led_TypeDef Led);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 void BSP_LED_Off(Led_TypeDef Led);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 void BSP_LED_Toggle(Led_TypeDef Led);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 uint32_t BSP_PB_GetState(Button_TypeDef Button);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 #endif /* STM32F429I_DISCOVERY_H */