123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- /**
- ******************************************************************************
- * @file hk32f103x_eval.h
- * @author MCD Application Team
- * @version V4.5.0
- * @date 07-March-2011
- * @brief This file contains definitions for STM3210B_EVAL's Leds, push-buttons
- * COM ports, SD Card (on SPI), sFLASH (on SPI) and Temperature sensor
- * LM75 (on I2C) hardware resources.
- ******************************************************************************
- * @attention
- *
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
- *
- * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
- ******************************************************************************
- */
-
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __HK32F103X_EVAL_H
- #define __HK32F103X_EVAL_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include "stm32f10x_spi.h"
- #include "stm32f10x_i2c.h"
- /** @addtogroup Utilities
- * @{
- */
- /** @addtogroup STM32_EVAL
- * @{
- */
-
- /** @defgroup STM32_EVAL_Exported_Types
- * @{
- */
- typedef enum
- {
- LED0 = 0,
- LED1 = 1,
- } Led_TypeDef;
- typedef enum
- {
- BUTTON_WAKEUP = 0,
- BUTTON_KEY0 = 1,
- BUTTON_KEY1 = 2,
- } Button_TypeDef;
- typedef enum
- {
- BUTTON_MODE_GPIO = 0,
- BUTTON_MODE_EXTI = 1
- } ButtonMode_TypeDef;
- typedef enum
- {
- COM1 = 0,
- COM2 = 1
- } COM_TypeDef;
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL
- * @{
- */
-
- /** @defgroup STM3210B_EVAL_LOW_LEVEL_Exported_Types
- * @{
- */
- /**
- * @}
- */
- /** @defgroup STM3210B_EVAL_LOW_LEVEL_Exported_Constants
- * @{
- */
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL_LED
- * @{
- */
- #define LEDn 2
- #define LED0_PIN GPIO_Pin_12
- #define LED0_GPIO_PORT GPIOC
- #define LED0_GPIO_CLK RCC_APB2Periph_GPIOC
-
- #define LED1_PIN GPIO_Pin_2
- #define LED1_GPIO_PORT GPIOD
- #define LED1_GPIO_CLK RCC_APB2Periph_GPIOD
- /**
- * @}
- */
-
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL_BUTTON
- * @{
- */
- #define BUTTONn 3
- /**
- * @brief Wakeup push-button
- */
- #define WAKEUP_BUTTON_PIN GPIO_Pin_0
- #define WAKEUP_BUTTON_GPIO_PORT GPIOA
- #define WAKEUP_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOA
- #define WAKEUP_BUTTON_EXTI_LINE EXTI_Line0
- #define WAKEUP_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOA
- #define WAKEUP_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource0
- #define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn
- /**
- * @brief Key0 push-button
- */
- #define KEY0_BUTTON_PIN GPIO_Pin_5
- #define KEY0_BUTTON_GPIO_PORT GPIOC
- #define KEY0_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOC
- #define KEY0_BUTTON_EXTI_LINE EXTI_Line5
- #define KEY0_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOC
- #define KEY0_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource5
- #define KEY0_BUTTON_EXTI_IRQn EXTI9_5_IRQn
- /**
- * @brief Key1 push-button
- */
- #define KEY1_BUTTON_PIN GPIO_Pin_15
- #define KEY1_BUTTON_GPIO_PORT GPIOA
- #define KEY1_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOA
- #define KEY1_BUTTON_EXTI_LINE EXTI_Line15
- #define KEY1_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOA
- #define KEY1_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource15
- #define KEY1_BUTTON_EXTI_IRQn EXTI15_10_IRQn
- /**
- * @}
- */
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL_COM
- * @{
- */
- #define COMn 2
- /**
- * @brief Definition for COM port1, connected to USART1
- */
- #define EVAL_COM1 USART1
- #define EVAL_COM1_CLK RCC_APB2Periph_USART1
- #define EVAL_COM1_TX_PIN GPIO_Pin_9
- #define EVAL_COM1_TX_GPIO_PORT GPIOA
- #define EVAL_COM1_TX_GPIO_CLK RCC_APB2Periph_GPIOA
- #define EVAL_COM1_RX_PIN GPIO_Pin_10
- #define EVAL_COM1_RX_GPIO_PORT GPIOA
- #define EVAL_COM1_RX_GPIO_CLK RCC_APB2Periph_GPIOA
- #define EVAL_COM1_IRQn USART1_IRQn
- /**
- * @brief Definition for COM port2, connected to USART2 (USART2 pins remapped on GPIOD)
- */
- #define EVAL_COM2 USART2
- #define EVAL_COM2_CLK RCC_APB1Periph_USART2
- #define EVAL_COM2_TX_PIN GPIO_Pin_5
- #define EVAL_COM2_TX_GPIO_PORT GPIOD
- #define EVAL_COM2_TX_GPIO_CLK RCC_APB2Periph_GPIOD
- #define EVAL_COM2_RX_PIN GPIO_Pin_6
- #define EVAL_COM2_RX_GPIO_PORT GPIOD
- #define EVAL_COM2_RX_GPIO_CLK RCC_APB2Periph_GPIOD
- #define EVAL_COM2_IRQn USART2_IRQn
- /**
- * @}
- */
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL_SD_SPI
- * @{
- */
- /**
- * @brief SD SPI Interface pins
- */
- #define SD_SPI SPI1
- #define SD_SPI_CLK RCC_APB2Periph_SPI1
- #define SD_SPI_SCK_PIN GPIO_Pin_5 /* PA.05 */
- #define SD_SPI_SCK_GPIO_PORT GPIOA /* GPIOA */
- #define SD_SPI_SCK_GPIO_CLK RCC_APB2Periph_GPIOA
- #define SD_SPI_MISO_PIN GPIO_Pin_6 /* PA.06 */
- #define SD_SPI_MISO_GPIO_PORT GPIOA /* GPIOA */
- #define SD_SPI_MISO_GPIO_CLK RCC_APB2Periph_GPIOA
- #define SD_SPI_MOSI_PIN GPIO_Pin_7 /* PA.07 */
- #define SD_SPI_MOSI_GPIO_PORT GPIOA /* GPIOA */
- #define SD_SPI_MOSI_GPIO_CLK RCC_APB2Periph_GPIOA
- #define SD_CS_PIN GPIO_Pin_12 /* PC.12 */
- #define SD_CS_GPIO_PORT GPIOC /* GPIOC */
- #define SD_CS_GPIO_CLK RCC_APB2Periph_GPIOC
- #define SD_DETECT_PIN GPIO_Pin_7 /* PE.07 */
- #define SD_DETECT_GPIO_PORT GPIOE /* GPIOE */
- #define SD_DETECT_GPIO_CLK RCC_APB2Periph_GPIOE
- /**
- * @}
- */
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL_M25P_FLASH_SPI
- * @{
- */
- /**
- * @brief M25P FLASH SPI Interface pins
- */
- #define sFLASH_SPI SPI1
- #define sFLASH_SPI_CLK RCC_APB2Periph_SPI1
- #define sFLASH_SPI_SCK_PIN GPIO_Pin_5 /* PA.05 */
- #define sFLASH_SPI_SCK_GPIO_PORT GPIOA /* GPIOA */
- #define sFLASH_SPI_SCK_GPIO_CLK RCC_APB2Periph_GPIOA
- #define sFLASH_SPI_MISO_PIN GPIO_Pin_6 /* PA.06 */
- #define sFLASH_SPI_MISO_GPIO_PORT GPIOA /* GPIOA */
- #define sFLASH_SPI_MISO_GPIO_CLK RCC_APB2Periph_GPIOA
- #define sFLASH_SPI_MOSI_PIN GPIO_Pin_7 /* PA.07 */
- #define sFLASH_SPI_MOSI_GPIO_PORT GPIOA /* GPIOA */
- #define sFLASH_SPI_MOSI_GPIO_CLK RCC_APB2Periph_GPIOA
- #define sFLASH_CS_PIN GPIO_Pin_4 /* PA.04 */
- #define sFLASH_CS_GPIO_PORT GPIOA /* GPIOA */
- #define sFLASH_CS_GPIO_CLK RCC_APB2Periph_GPIOA
- /**
- * @}
- */
- /** @addtogroup STM3210B_EVAL_LOW_LEVEL_TSENSOR_I2C
- * @{
- */
- /**
- * @brief LM75 Temperature Sensor I2C Interface pins
- */
- #define LM75_I2C I2C1
- #define LM75_I2C_CLK RCC_APB1Periph_I2C1
- #define LM75_I2C_SCL_PIN GPIO_Pin_6 /* PB.06 */
- #define LM75_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */
- #define LM75_I2C_SCL_GPIO_CLK RCC_APB2Periph_GPIOB
- #define LM75_I2C_SDA_PIN GPIO_Pin_7 /* PB.07 */
- #define LM75_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */
- #define LM75_I2C_SDA_GPIO_CLK RCC_APB2Periph_GPIOB
- #define LM75_I2C_SMBUSALERT_PIN GPIO_Pin_5 /* PB.05 */
- #define LM75_I2C_SMBUSALERT_GPIO_PORT GPIOB /* GPIOB */
- #define LM75_I2C_SMBUSALERT_GPIO_CLK RCC_APB2Periph_GPIOB
- #define LM75_I2C_DR ((uint32_t)0x40005410)
- #define LM75_DMA_CLK RCC_AHBPeriph_DMA1
- #define LM75_DMA_TX_CHANNEL DMA1_Channel6
- #define LM75_DMA_RX_CHANNEL DMA1_Channel7
- #define LM75_DMA_TX_TCFLAG DMA1_FLAG_TC6
- #define LM75_DMA_RX_TCFLAG DMA1_FLAG_TC7
- /**
- * @}
- */
-
- /**
- * @}
- */
-
- /** @defgroup STM3210B_EVAL_LOW_LEVEL_Exported_Macros
- * @{
- */
- /**
- * @}
- */
- /** @defgroup STM3210B_EVAL_LOW_LEVEL_Exported_Functions
- * @{
- */
- void STM_EVAL_LEDInit(Led_TypeDef Led);
- void STM_EVAL_LEDOn(Led_TypeDef Led);
- void STM_EVAL_LEDOff(Led_TypeDef Led);
- void STM_EVAL_LEDToggle(Led_TypeDef Led);
- void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
- uint32_t STM_EVAL_PBGetState(Button_TypeDef Button);
- void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct);
- void SD_LowLevel_DeInit(void);
- void SD_LowLevel_Init(void);
- void sFLASH_LowLevel_DeInit(void);
- void sFLASH_LowLevel_Init(void);
- void LM75_LowLevel_DeInit(void);
- void LM75_LowLevel_Init(void);
-
- /**
- * @}
- */
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __STM3210B_EVAL_H */
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|