-//modified by micha\r
-\r
/**\r
- ******************************************************************************\r
- * @file stm32100e_eval.c\r
- * @author MCD Application Team\r
- * @version V4.5.0\r
- * @date 07-March-2011\r
- * @brief This file provides\r
- * - set of firmware functions to manage Leds, push-button and COM ports\r
- * - low level initialization functions for SD card (on SDIO), SPI serial\r
- * flash (sFLASH) and temperature sensor (LM75)\r
- * available on STM32100E-EVAL evaluation board from STMicroelectronics. \r
- ******************************************************************************\r
- * @attention\r
- *\r
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
- *\r
- * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>\r
- ****************************************************************************** \r
- */ \r
+ ********************************************************\r
+ * \r
+ * uC periphery configuration\r
+ * \r
+ ********************************************************\r
+ */\r
\r
/* Includes ------------------------------------------------------------------*/\r
#include "periph_conf.h"\r
};\r
\r
\r
-\r
-GPIO_TypeDef* GPIO_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT, LED3_GPIO_PORT,\r
- LED4_GPIO_PORT};\r
-const uint16_t GPIO_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN,\r
- LED4_PIN};\r
-const uint32_t GPIO_CLK[LEDn] = {LED1_GPIO_CLK, LED2_GPIO_CLK, LED3_GPIO_CLK,\r
- LED4_GPIO_CLK};\r
-\r
-GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {WAKEUP_BUTTON_GPIO_PORT, TAMPER_BUTTON_GPIO_PORT, \r
- KEY_BUTTON_GPIO_PORT, RIGHT_BUTTON_GPIO_PORT,\r
- LEFT_BUTTON_GPIO_PORT, UP_BUTTON_GPIO_PORT,\r
- DOWN_BUTTON_GPIO_PORT, SEL_BUTTON_GPIO_PORT}; \r
-\r
-const uint16_t BUTTON_PIN[BUTTONn] = {WAKEUP_BUTTON_PIN, TAMPER_BUTTON_PIN, \r
- KEY_BUTTON_PIN, RIGHT_BUTTON_PIN,\r
- LEFT_BUTTON_PIN, UP_BUTTON_PIN,\r
- DOWN_BUTTON_PIN, SEL_BUTTON_PIN}; \r
-\r
-const uint32_t BUTTON_CLK[BUTTONn] = {WAKEUP_BUTTON_GPIO_CLK, TAMPER_BUTTON_GPIO_CLK,\r
- KEY_BUTTON_GPIO_CLK, RIGHT_BUTTON_GPIO_CLK,\r
- LEFT_BUTTON_GPIO_CLK, UP_BUTTON_GPIO_CLK,\r
- DOWN_BUTTON_GPIO_CLK, SEL_BUTTON_GPIO_CLK};\r
-\r
-const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {WAKEUP_BUTTON_EXTI_LINE,\r
- TAMPER_BUTTON_EXTI_LINE, \r
- KEY_BUTTON_EXTI_LINE,\r
- RIGHT_BUTTON_EXTI_LINE,\r
- LEFT_BUTTON_EXTI_LINE,\r
- UP_BUTTON_EXTI_LINE,\r
- DOWN_BUTTON_EXTI_LINE,\r
- SEL_BUTTON_EXTI_LINE};\r
-\r
-const uint16_t BUTTON_PORT_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PORT_SOURCE,\r
- TAMPER_BUTTON_EXTI_PORT_SOURCE, \r
- KEY_BUTTON_EXTI_PORT_SOURCE,\r
- RIGHT_BUTTON_EXTI_PORT_SOURCE,\r
- LEFT_BUTTON_EXTI_PORT_SOURCE,\r
- UP_BUTTON_EXTI_PORT_SOURCE,\r
- DOWN_BUTTON_EXTI_PORT_SOURCE,\r
- SEL_BUTTON_EXTI_PORT_SOURCE};\r
- \r
-const uint16_t BUTTON_PIN_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PIN_SOURCE,\r
- TAMPER_BUTTON_EXTI_PIN_SOURCE, \r
- KEY_BUTTON_EXTI_PIN_SOURCE,\r
- RIGHT_BUTTON_EXTI_PIN_SOURCE,\r
- LEFT_BUTTON_EXTI_PIN_SOURCE,\r
- UP_BUTTON_EXTI_PIN_SOURCE,\r
- DOWN_BUTTON_EXTI_PIN_SOURCE,\r
- SEL_BUTTON_EXTI_PIN_SOURCE}; \r
-\r
-const uint16_t BUTTON_IRQn[BUTTONn] = {WAKEUP_BUTTON_EXTI_IRQn, TAMPER_BUTTON_EXTI_IRQn, \r
- KEY_BUTTON_EXTI_IRQn, RIGHT_BUTTON_EXTI_IRQn,\r
- LEFT_BUTTON_EXTI_IRQn, UP_BUTTON_EXTI_IRQn,\r
- DOWN_BUTTON_EXTI_IRQn, SEL_BUTTON_EXTI_IRQn};\r
-\r
-USART_TypeDef* COM_USART[COMn] = {EVAL_COM1, EVAL_COM2}; \r
-\r
-GPIO_TypeDef* COM_TX_PORT[COMn] = {EVAL_COM1_TX_GPIO_PORT, EVAL_COM2_TX_GPIO_PORT};\r
- \r
-GPIO_TypeDef* COM_RX_PORT[COMn] = {EVAL_COM1_RX_GPIO_PORT, EVAL_COM2_RX_GPIO_PORT};\r
- \r
-const uint32_t COM_USART_CLK[COMn] = {EVAL_COM1_CLK, EVAL_COM2_CLK};\r
-\r
-const uint32_t COM_TX_PORT_CLK[COMn] = {EVAL_COM1_TX_GPIO_CLK, EVAL_COM2_TX_GPIO_CLK};\r
- \r
-const uint32_t COM_RX_PORT_CLK[COMn] = {EVAL_COM1_RX_GPIO_CLK, EVAL_COM2_RX_GPIO_CLK};\r
-\r
-const uint16_t COM_TX_PIN[COMn] = {EVAL_COM1_TX_PIN, EVAL_COM2_TX_PIN};\r
-\r
-const uint16_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN, EVAL_COM2_RX_PIN};\r
-\r
-DMA_InitTypeDef sEEDMA_InitStructure;\r
-\r
-\r
-\r
-\r
void CB_GPIO_Out_Init(CB_GPIO_Pin_TypeDef Pin)\r
{\r
GPIO_InitTypeDef GPIO_InitStructure;\r
}\r
\r
\r
-\r
-void STM_EVAL_LEDInit(Led_TypeDef Led)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- \r
- /* Enable the GPIO_LED Clock */\r
- RCC_APB2PeriphClockCmd(GPIO_CLK[Led], ENABLE);\r
-\r
- /* Configure the GPIO_LED pin */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led];\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
-\r
- GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure);\r
-}\r
-\r
-/**\r
- * @brief Turns selected LED On.\r
- * @param Led: Specifies the Led to be set on. \r
- * This parameter can be one of following parameters:\r
- * @arg LED1\r
- * @arg LED2\r
- * @arg LED3\r
- * @arg LED4 \r
- * @retval None\r
- */\r
-void STM_EVAL_LEDOn(Led_TypeDef Led)\r
-{\r
- GPIO_PORT[Led]->BSRR = GPIO_PIN[Led]; \r
-}\r
-\r
void CB_GPIO_Out_Hi(CB_GPIO_Pin_TypeDef Pin)\r
{\r
CB_GPIO_PORT[Pin]->BSRR = CB_GPIO_PIN[Pin]; \r
}\r
\r
-/**\r
- * @brief Turns selected LED Off.\r
- * @param Led: Specifies the Led to be set off. \r
- * This parameter can be one of following parameters:\r
- * @arg LED1\r
- * @arg LED2\r
- * @arg LED3\r
- * @arg LED4 \r
- * @retval None\r
- */\r
-void STM_EVAL_LEDOff(Led_TypeDef Led)\r
-{\r
- GPIO_PORT[Led]->BRR = GPIO_PIN[Led]; \r
-}\r
\r
void CB_GPIO_Out_Lo(CB_GPIO_Pin_TypeDef Pin)\r
{\r
CB_GPIO_PORT[Pin]->BRR = CB_GPIO_PIN[Pin]; \r
}\r
\r
+\r
void CB_GPIO_Out(CB_GPIO_Pin_TypeDef Pin,uint16_t state){\r
if(state){\r
CB_GPIO_Out_Hi(Pin);\r
}\r
}\r
\r
-/**\r
- * @brief Toggles the selected LED.\r
- * @param Led: Specifies the Led to be toggled. \r
- * This parameter can be one of following parameters:\r
- * @arg LED1\r
- * @arg LED2\r
- * @arg LED3\r
- * @arg LED4 \r
- * @retval None\r
- */\r
-void STM_EVAL_LEDToggle(Led_TypeDef Led)\r
-{\r
- GPIO_PORT[Led]->ODR ^= GPIO_PIN[Led];\r
-}\r
\r
void CB_GPIO_Out_Toggle(CB_GPIO_Pin_TypeDef Pin)\r
{\r
CB_GPIO_PORT[Pin]->ODR ^= CB_GPIO_PIN[Pin];\r
}\r
-/**\r
- * @brief Configures Button GPIO and EXTI Line.\r
- * @param Button: Specifies the Button to be configured.\r
- * This parameter can be one of following parameters: \r
- * @arg BUTTON_WAKEUP: Wakeup Push Button\r
- * @arg BUTTON_TAMPER: Tamper Push Button \r
- * @arg BUTTON_KEY: Key Push Button \r
- * @arg BUTTON_RIGHT: Joystick Right Push Button \r
- * @arg BUTTON_LEFT: Joystick Left Push Button \r
- * @arg BUTTON_UP: Joystick Up Push Button \r
- * @arg BUTTON_DOWN: Joystick Down Push Button\r
- * @arg BUTTON_SEL: Joystick Sel Push Button\r
- * @param Button_Mode: Specifies Button mode.\r
- * This parameter can be one of following parameters: \r
- * @arg BUTTON_MODE_GPIO: Button will be used as simple IO \r
- * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line with interrupt\r
- * generation capability \r
- * @retval None\r
- */\r
-void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- EXTI_InitTypeDef EXTI_InitStructure;\r
- NVIC_InitTypeDef NVIC_InitStructure;\r
-\r
- /* Enable the BUTTON Clock */\r
- RCC_APB2PeriphClockCmd(BUTTON_CLK[Button] | RCC_APB2Periph_AFIO, ENABLE);\r
-\r
- /* Configure Button pin as input floating */\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
- GPIO_InitStructure.GPIO_Pin = BUTTON_PIN[Button];\r
- GPIO_Init(BUTTON_PORT[Button], &GPIO_InitStructure);\r
-\r
-\r
- if (Button_Mode == BUTTON_MODE_EXTI)\r
- {\r
- /* Connect Button EXTI Line to Button GPIO Pin */\r
- GPIO_EXTILineConfig(BUTTON_PORT_SOURCE[Button], BUTTON_PIN_SOURCE[Button]);\r
-\r
- /* Configure Button EXTI line */\r
- EXTI_InitStructure.EXTI_Line = BUTTON_EXTI_LINE[Button];\r
- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\r
-\r
- if(Button != BUTTON_WAKEUP)\r
- {\r
- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; \r
- }\r
- else\r
- {\r
- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; \r
- }\r
- EXTI_InitStructure.EXTI_LineCmd = ENABLE;\r
- EXTI_Init(&EXTI_InitStructure);\r
-\r
- /* Enable and set Button EXTI Interrupt to the lowest priority */\r
- NVIC_InitStructure.NVIC_IRQChannel = BUTTON_IRQn[Button];\r
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;\r
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;\r
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
-\r
- NVIC_Init(&NVIC_InitStructure); \r
- }\r
-}\r
-\r
-/**\r
- * @brief Returns the selected Button state.\r
- * @param Button: Specifies the Button to be checked.\r
- * This parameter can be one of following parameters: \r
- * @arg BUTTON_WAKEUP: Wakeup Push Button\r
- * @arg BUTTON_TAMPER: Tamper Push Button \r
- * @arg BUTTON_KEY: Key Push Button \r
- * @arg BUTTON_RIGHT: Joystick Right Push Button \r
- * @arg BUTTON_LEFT: Joystick Left Push Button \r
- * @arg BUTTON_UP: Joystick Up Push Button \r
- * @arg BUTTON_DOWN: Joystick Down Push Button\r
- * @arg BUTTON_SEL: Joystick Sel Push Button \r
- * @retval The Button GPIO pin value.\r
- */\r
-uint32_t STM_EVAL_PBGetState(Button_TypeDef Button)\r
-{\r
- return GPIO_ReadInputDataBit(BUTTON_PORT[Button], BUTTON_PIN[Button]);\r
-}\r
-\r
-/**\r
- * @brief Configures COM port.\r
- * @param COM: Specifies the COM port to be configured.\r
- * This parameter can be one of following parameters: \r
- * @arg COM1\r
- * @arg COM2 \r
- * @param USART_InitStruct: pointer to a USART_InitTypeDef structure that\r
- * contains the configuration information for the specified USART peripheral.\r
- * @retval None\r
- */\r
-void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
-\r
- /* Enable GPIO clock */\r
- RCC_APB2PeriphClockCmd(COM_TX_PORT_CLK[COM] | COM_RX_PORT_CLK[COM] | RCC_APB2Periph_AFIO, ENABLE);\r
-\r
- /* Enable UART clock */\r
- if (COM == COM1)\r
- {\r
- RCC_APB2PeriphClockCmd(COM_USART_CLK[COM], ENABLE); \r
- }\r
- else\r
- {\r
- RCC_APB1PeriphClockCmd(COM_USART_CLK[COM], ENABLE);\r
- }\r
-\r
- /* Configure USART Tx as alternate function push-pull */\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;\r
- GPIO_InitStructure.GPIO_Pin = COM_TX_PIN[COM];\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
- GPIO_Init(COM_TX_PORT[COM], &GPIO_InitStructure);\r
-\r
- /* Configure USART Rx as input floating */\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
- GPIO_InitStructure.GPIO_Pin = COM_RX_PIN[COM];\r
- GPIO_Init(COM_RX_PORT[COM], &GPIO_InitStructure);\r
-\r
- /* USART configuration */\r
- USART_Init(COM_USART[COM], USART_InitStruct);\r
- \r
- /* Enable USART */\r
- USART_Cmd(COM_USART[COM], ENABLE);\r
-}\r
-\r
-/**\r
- * @brief DeInitializes the SD/SD communication.\r
- * @param None\r
- * @retval None\r
- */\r
-void SD_LowLevel_DeInit(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- \r
- SPI_Cmd(SD_SPI, DISABLE); /*!< SD_SPI disable */\r
- SPI_I2S_DeInit(SD_SPI); /*!< DeInitializes the SD_SPI */\r
- \r
- /*!< SD_SPI Periph clock disable */\r
- RCC_APB1PeriphClockCmd(SD_SPI_CLK, DISABLE);\r
- \r
- /*!< Configure SD_SPI pins: SCK */\r
- GPIO_InitStructure.GPIO_Pin = SD_SPI_SCK_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
- GPIO_Init(SD_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI pins: MISO */\r
- GPIO_InitStructure.GPIO_Pin = SD_SPI_MISO_PIN;\r
- GPIO_Init(SD_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI pins: MOSI */\r
- GPIO_InitStructure.GPIO_Pin = SD_SPI_MOSI_PIN;\r
- GPIO_Init(SD_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI_CS_PIN pin: SD Card CS pin */\r
- GPIO_InitStructure.GPIO_Pin = SD_CS_PIN;\r
- GPIO_Init(SD_CS_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI_DETECT_PIN pin: SD Card detect pin */\r
- GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;\r
- GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);\r
-}\r
-\r
-/**\r
- * @brief Initializes the SD_SPI and CS pins.\r
- * @param None\r
- * @retval None\r
- */\r
-void SD_LowLevel_Init(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- SPI_InitTypeDef SPI_InitStructure;\r
-\r
- /*!< SD_SPI_CS_GPIO, SD_SPI_MOSI_GPIO, SD_SPI_MISO_GPIO, SD_SPI_DETECT_GPIO \r
- and SD_SPI_SCK_GPIO Periph clock enable */\r
- RCC_APB2PeriphClockCmd(SD_CS_GPIO_CLK | SD_SPI_MOSI_GPIO_CLK | SD_SPI_MISO_GPIO_CLK |\r
- SD_SPI_SCK_GPIO_CLK | SD_DETECT_GPIO_CLK, ENABLE);\r
-\r
- /*!< SD_SPI Periph clock enable */\r
- RCC_APB1PeriphClockCmd(SD_SPI_CLK, ENABLE);\r
- \r
- /*!< Configure SD_SPI pins: SCK */\r
- GPIO_InitStructure.GPIO_Pin = SD_SPI_SCK_PIN;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;\r
- GPIO_Init(SD_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI pins: MOSI */\r
- GPIO_InitStructure.GPIO_Pin = SD_SPI_MOSI_PIN;\r
- GPIO_Init(SD_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI pins: MISO */\r
- GPIO_InitStructure.GPIO_Pin = SD_SPI_MISO_PIN;\r
- GPIO_Init(SD_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);\r
- \r
- /*!< Configure SD_SPI_CS_PIN pin: SD Card CS pin */\r
- GPIO_InitStructure.GPIO_Pin = SD_CS_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
- GPIO_Init(SD_CS_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure SD_SPI_DETECT_PIN pin: SD Card detect pin */\r
- GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;\r
- GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< SD_SPI Config */\r
- SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;\r
- SPI_InitStructure.SPI_Mode = SPI_Mode_Master;\r
- SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;\r
- SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;\r
- SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;\r
- SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;\r
- SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;\r
- SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;\r
- SPI_InitStructure.SPI_CRCPolynomial = 7;\r
- SPI_Init(SD_SPI, &SPI_InitStructure);\r
- \r
- SPI_Cmd(SD_SPI, ENABLE); /*!< SD_SPI enable */\r
-}\r
-\r
-/**\r
- * @brief DeInitializes peripherals used by the I2C EEPROM driver.\r
- * @param None\r
- * @retval None\r
- */\r
-void sEE_LowLevel_DeInit(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure; \r
- NVIC_InitTypeDef NVIC_InitStructure; \r
- \r
- /* sEE_I2C Peripheral Disable */\r
- I2C_Cmd(sEE_I2C, DISABLE);\r
- \r
- /* sEE_I2C DeInit */\r
- I2C_DeInit(sEE_I2C);\r
-\r
- /*!< sEE_I2C Periph clock disable */\r
- RCC_APB1PeriphClockCmd(sEE_I2C_CLK, DISABLE);\r
- \r
- /*!< GPIO configuration */ \r
- /*!< Configure sEE_I2C pins: SCL */\r
- GPIO_InitStructure.GPIO_Pin = sEE_I2C_SCL_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
- GPIO_Init(sEE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sEE_I2C pins: SDA */\r
- GPIO_InitStructure.GPIO_Pin = sEE_I2C_SDA_PIN;\r
- GPIO_Init(sEE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);\r
- \r
- /* Configure and enable I2C DMA TX Channel interrupt */\r
- NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_TX_IRQn;\r
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO;\r
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO;\r
- NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE;\r
- NVIC_Init(&NVIC_InitStructure);\r
-\r
- /* Configure and enable I2C DMA RX Channel interrupt */\r
- NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_RX_IRQn;\r
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO;\r
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO;\r
- NVIC_Init(&NVIC_InitStructure); \r
- \r
- /* Disable and Deinitialize the DMA channels */\r
- DMA_Cmd(sEE_I2C_DMA_CHANNEL_TX, DISABLE);\r
- DMA_Cmd(sEE_I2C_DMA_CHANNEL_RX, DISABLE);\r
- DMA_DeInit(sEE_I2C_DMA_CHANNEL_TX);\r
- DMA_DeInit(sEE_I2C_DMA_CHANNEL_RX);\r
-}\r
-\r
-/**\r
- * @brief Initializes peripherals used by the I2C EEPROM driver.\r
- * @param None\r
- * @retval None\r
- */\r
-void sEE_LowLevel_Init(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- NVIC_InitTypeDef NVIC_InitStructure; \r
- \r
- /*!< sEE_I2C_SCL_GPIO_CLK and sEE_I2C_SDA_GPIO_CLK Periph clock enable */\r
- RCC_APB2PeriphClockCmd(sEE_I2C_SCL_GPIO_CLK | sEE_I2C_SDA_GPIO_CLK, ENABLE);\r
-\r
- /*!< sEE_I2C Periph clock enable */\r
- RCC_APB1PeriphClockCmd(sEE_I2C_CLK, ENABLE);\r
- \r
- /*!< GPIO configuration */ \r
- /*!< Configure sEE_I2C pins: SCL */\r
- GPIO_InitStructure.GPIO_Pin = sEE_I2C_SCL_PIN;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;\r
- GPIO_Init(sEE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sEE_I2C pins: SDA */\r
- GPIO_InitStructure.GPIO_Pin = sEE_I2C_SDA_PIN;\r
- GPIO_Init(sEE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure); \r
-\r
- /* Configure and enable I2C DMA TX Channel interrupt */\r
- NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_TX_IRQn;\r
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO;\r
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO;\r
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
- NVIC_Init(&NVIC_InitStructure);\r
-\r
- /* Configure and enable I2C DMA RX Channel interrupt */\r
- NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_RX_IRQn;\r
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO;\r
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO;\r
- NVIC_Init(&NVIC_InitStructure); \r
- \r
- /*!< I2C DMA TX and RX channels configuration */\r
- /* Enable the DMA clock */\r
- RCC_AHBPeriphClockCmd(sEE_I2C_DMA_CLK, ENABLE);\r
-\r
- /* I2C TX DMA Channel configuration */\r
- DMA_DeInit(sEE_I2C_DMA_CHANNEL_TX);\r
- sEEDMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)sEE_I2C_DR_Address;\r
- sEEDMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)0; /* This parameter will be configured durig communication */\r
- sEEDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST; /* This parameter will be configured durig communication */\r
- sEEDMA_InitStructure.DMA_BufferSize = 0xFFFF; /* This parameter will be configured durig communication */\r
- sEEDMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;\r
- sEEDMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;\r
- sEEDMA_InitStructure.DMA_PeripheralDataSize = DMA_MemoryDataSize_Byte;\r
- sEEDMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;\r
- sEEDMA_InitStructure.DMA_Mode = DMA_Mode_Normal;\r
- sEEDMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;\r
- sEEDMA_InitStructure.DMA_M2M = DMA_M2M_Disable;\r
- DMA_Init(sEE_I2C_DMA_CHANNEL_TX, &sEEDMA_InitStructure); \r
- \r
- /* I2C RX DMA Channel configuration */\r
- DMA_DeInit(sEE_I2C_DMA_CHANNEL_RX);\r
- DMA_Init(sEE_I2C_DMA_CHANNEL_RX, &sEEDMA_InitStructure); \r
- \r
- /* Enable the DMA Channels Interrupts */\r
- DMA_ITConfig(sEE_I2C_DMA_CHANNEL_TX, DMA_IT_TC, ENABLE);\r
- DMA_ITConfig(sEE_I2C_DMA_CHANNEL_RX, DMA_IT_TC, ENABLE); \r
-}\r
-\r
-/**\r
- * @brief Initializes DMA channel used by the I2C EEPROM driver.\r
- * @param None\r
- * @retval None\r
- */\r
-void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction)\r
-{ \r
- /* Initialize the DMA with the new parameters */\r
- if (Direction == sEE_DIRECTION_TX)\r
- {\r
- /* Configure the DMA Tx Channel with the buffer address and the buffer size */\r
- sEEDMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)pBuffer;\r
- sEEDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST; \r
- sEEDMA_InitStructure.DMA_BufferSize = (uint32_t)BufferSize; \r
- DMA_Init(sEE_I2C_DMA_CHANNEL_TX, &sEEDMA_InitStructure); \r
- }\r
- else\r
- { \r
- /* Configure the DMA Rx Channel with the buffer address and the buffer size */\r
- sEEDMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)pBuffer;\r
- sEEDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;\r
- sEEDMA_InitStructure.DMA_BufferSize = (uint32_t)BufferSize; \r
- DMA_Init(sEE_I2C_DMA_CHANNEL_RX, &sEEDMA_InitStructure); \r
- }\r
-}\r
-\r
-/**\r
- * @brief DeInitializes the peripherals used by the SPI FLASH driver.\r
- * @param None\r
- * @retval None\r
- */\r
-void sFLASH_LowLevel_DeInit(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
-\r
- /*!< Disable the sFLASH_SPI */\r
- SPI_Cmd(sFLASH_SPI, DISABLE);\r
- \r
- /*!< DeInitializes the sFLASH_SPI */\r
- SPI_I2S_DeInit(sFLASH_SPI);\r
- \r
- /*!< sFLASH_SPI Periph clock disable */\r
- RCC_APB2PeriphClockCmd(sFLASH_SPI_CLK, DISABLE);\r
- \r
- /*!< Configure sFLASH_SPI pins: SCK */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_SCK_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
- GPIO_Init(sFLASH_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sFLASH_SPI pins: MISO */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MISO_PIN;\r
- GPIO_Init(sFLASH_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sFLASH_SPI pins: MOSI */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MOSI_PIN;\r
- GPIO_Init(sFLASH_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sFLASH_CS_PIN pin: sFLASH Card CS pin */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_CS_PIN;\r
- GPIO_Init(sFLASH_CS_GPIO_PORT, &GPIO_InitStructure);\r
-}\r
-\r
-/**\r
- * @brief Initializes the peripherals used by the SPI FLASH driver.\r
- * @param None\r
- * @retval None\r
- */\r
-void sFLASH_LowLevel_Init(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
-\r
- /*!< sFLASH_SPI_CS_GPIO, sFLASH_SPI_MOSI_GPIO, sFLASH_SPI_MISO_GPIO \r
- and sFLASH_SPI_SCK_GPIO Periph clock enable */\r
- RCC_APB2PeriphClockCmd(sFLASH_CS_GPIO_CLK | sFLASH_SPI_MOSI_GPIO_CLK | sFLASH_SPI_MISO_GPIO_CLK |\r
- sFLASH_SPI_SCK_GPIO_CLK, ENABLE);\r
-\r
- /*!< sFLASH_SPI Periph clock enable */\r
- RCC_APB2PeriphClockCmd(sFLASH_SPI_CLK, ENABLE);\r
- \r
- /*!< Configure sFLASH_SPI pins: SCK */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_SCK_PIN;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;\r
- GPIO_Init(sFLASH_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sFLASH_SPI pins: MOSI */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MOSI_PIN;\r
- GPIO_Init(sFLASH_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure sFLASH_SPI pins: MISO */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MISO_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; \r
- GPIO_Init(sFLASH_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);\r
- \r
- /*!< Configure sFLASH_CS_PIN pin: sFLASH Card CS pin */\r
- GPIO_InitStructure.GPIO_Pin = sFLASH_CS_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
- GPIO_Init(sFLASH_CS_GPIO_PORT, &GPIO_InitStructure);\r
-}\r
-\r
-/**\r
- * @brief DeInitializes the LM75_I2C.\r
- * @param None\r
- * @retval None\r
- */\r
-void LM75_LowLevel_DeInit(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
-\r
- /*!< Disable LM75_I2C */\r
- I2C_Cmd(LM75_I2C, DISABLE);\r
- /*!< DeInitializes the LM75_I2C */\r
- I2C_DeInit(LM75_I2C);\r
- \r
- /*!< LM75_I2C Periph clock disable */\r
- RCC_APB1PeriphClockCmd(LM75_I2C_CLK, DISABLE);\r
- \r
- /*!< Configure LM75_I2C pins: SCL */\r
- GPIO_InitStructure.GPIO_Pin = LM75_I2C_SCL_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
- GPIO_Init(LM75_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure LM75_I2C pins: SDA */\r
- GPIO_InitStructure.GPIO_Pin = LM75_I2C_SDA_PIN;\r
- GPIO_Init(LM75_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure LM75_I2C pin: SMBUS ALERT */\r
- GPIO_InitStructure.GPIO_Pin = LM75_I2C_SMBUSALERT_PIN;\r
- GPIO_Init(LM75_I2C_SMBUSALERT_GPIO_PORT, &GPIO_InitStructure);\r
-}\r
-\r
-/**\r
- * @brief Initializes the LM75_I2C..\r
- * @param None\r
- * @retval None\r
- */\r
-void LM75_LowLevel_Init(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
-\r
- /*!< LM75_I2C Periph clock enable */\r
- RCC_APB1PeriphClockCmd(LM75_I2C_CLK, ENABLE);\r
- \r
- /*!< LM75_I2C_SCL_GPIO_CLK, LM75_I2C_SDA_GPIO_CLK \r
- and LM75_I2C_SMBUSALERT_GPIO_CLK Periph clock enable */\r
- RCC_APB2PeriphClockCmd(LM75_I2C_SCL_GPIO_CLK | LM75_I2C_SDA_GPIO_CLK |\r
- LM75_I2C_SMBUSALERT_GPIO_CLK, ENABLE);\r
- \r
- /*!< Configure LM75_I2C pins: SCL */\r
- GPIO_InitStructure.GPIO_Pin = LM75_I2C_SCL_PIN;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;\r
- GPIO_Init(LM75_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure LM75_I2C pins: SDA */\r
- GPIO_InitStructure.GPIO_Pin = LM75_I2C_SDA_PIN;\r
- GPIO_Init(LM75_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);\r
-\r
- /*!< Configure LM75_I2C pin: SMBUS ALERT */\r
- GPIO_InitStructure.GPIO_Pin = LM75_I2C_SMBUSALERT_PIN;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;\r
- GPIO_Init(LM75_I2C_SMBUSALERT_GPIO_PORT, &GPIO_InitStructure); \r
-}\r
-\r
-/**\r
- * @}\r
- */ \r
-\r
-/**\r
- * @}\r
- */ \r
-\r
-/**\r
- * @}\r
- */\r
-\r
-/**\r
- * @}\r
- */ \r
-\r
-/**\r
- * @}\r
- */ \r
- \r
-/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r
-// modified by micha\r
-\r
-\r
-// what works?\r
-// LED functions!\r
-\r
/**\r
- ******************************************************************************\r
- * @file stm32100e_eval.h\r
- * @author MCD Application Team\r
- * @version V4.5.0\r
- * @date 07-March-2011\r
- * @brief This file contains definitions for STM32100E_EVAL's Leds, push-buttons\r
- * COM ports, sFLASH (on SPI) and Temperature Sensor LM75 (on I2C)\r
- * hardware resources. \r
- ******************************************************************************\r
- * @attention\r
- *\r
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
- *\r
- * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>\r
- ****************************************************************************** \r
- */ \r
+ ********************************************************\r
+ * \r
+ * uC periphery configuration (headers)\r
+ * \r
+ ********************************************************\r
+ */\r
\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __STM32100E_EVAL_H\r
-#define __STM32100E_EVAL_H\r
-\r
-#ifdef __cplusplus\r
- extern "C" {\r
-#endif \r
\r
/* Includes ------------------------------------------------------------------*/\r
#include "stm32f10x_conf.h"\r
-#include "stm32_eval.h"\r
\r
-/** @addtogroup Utilities\r
- * @{\r
- */ \r
-\r
-/** @addtogroup STM32_EVAL\r
- * @{\r
- */ \r
- \r
-/** @addtogroup STM32100E_EVAL\r
- * @{\r
- */ \r
-\r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL\r
- * @{\r
- */ \r
- \r
-/** @defgroup STM32100E_EVAL_LOW_LEVEL_Exported_Types\r
- * @{\r
- */\r
-/**\r
- * @}\r
- */ \r
\r
-/** @defgroup STM32100E_EVAL_LOW_LEVEL_Exported_Constants\r
- * @{\r
- */ \r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL_LED\r
- * @{\r
- */\r
-#define LEDn 4\r
\r
#define LED1_PIN GPIO_Pin_9\r
#define LED1_GPIO_PORT GPIOC\r
#define ENAD0_PIN GPIO_Pin_3\r
#define ENAD0_GPIO_PORT GPIOC\r
#define ENAD0_GPIO_CLK RCC_APB2Periph_GPIOC\r
-//not working\r
+\r
#define ENAA0_PIN GPIO_Pin_5\r
#define ENAA0_GPIO_PORT GPIOC\r
#define ENAA0_GPIO_CLK RCC_APB2Periph_GPIOC\r
-// not working\r
+\r
#define ENAD1_PIN GPIO_Pin_0\r
#define ENAD1_GPIO_PORT GPIOC\r
#define ENAD1_GPIO_CLK RCC_APB2Periph_GPIOC\r
\r
\r
\r
-\r
-\r
-\r
-/**\r
- * @}\r
- */\r
- \r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL_BUTTON\r
- * @{\r
- */ \r
-#define BUTTONn 8\r
-\r
-/**\r
- * @brief Wakeup push-button\r
- */\r
-#define WAKEUP_BUTTON_PIN GPIO_Pin_0\r
-#define WAKEUP_BUTTON_GPIO_PORT GPIOA\r
-#define WAKEUP_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define WAKEUP_BUTTON_EXTI_LINE EXTI_Line0\r
-#define WAKEUP_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOA\r
-#define WAKEUP_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource0\r
-#define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn \r
-/**\r
- * @brief Tamper push-button\r
- */\r
-#define TAMPER_BUTTON_PIN GPIO_Pin_13\r
-#define TAMPER_BUTTON_GPIO_PORT GPIOC\r
-#define TAMPER_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOC\r
-#define TAMPER_BUTTON_EXTI_LINE EXTI_Line13\r
-#define TAMPER_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOC\r
-#define TAMPER_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource13\r
-#define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn \r
-/**\r
- * @brief Key push-button\r
- */\r
-#define KEY_BUTTON_PIN GPIO_Pin_8\r
-#define KEY_BUTTON_GPIO_PORT GPIOG\r
-#define KEY_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define KEY_BUTTON_EXTI_LINE EXTI_Line8\r
-#define KEY_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOG\r
-#define KEY_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource8\r
-#define KEY_BUTTON_EXTI_IRQn EXTI9_5_IRQn\r
-/**\r
- * @brief Joystick Right push-button\r
- */\r
-#define RIGHT_BUTTON_PIN GPIO_Pin_13\r
-#define RIGHT_BUTTON_GPIO_PORT GPIOG\r
-#define RIGHT_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define RIGHT_BUTTON_EXTI_LINE EXTI_Line13\r
-#define RIGHT_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOG\r
-#define RIGHT_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource13\r
-#define RIGHT_BUTTON_EXTI_IRQn EXTI15_10_IRQn\r
-/**\r
- * @brief Joystick Left push-button\r
- */ \r
-#define LEFT_BUTTON_PIN GPIO_Pin_14\r
-#define LEFT_BUTTON_GPIO_PORT GPIOG\r
-#define LEFT_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define LEFT_BUTTON_EXTI_LINE EXTI_Line14\r
-#define LEFT_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOG\r
-#define LEFT_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource14\r
-#define LEFT_BUTTON_EXTI_IRQn EXTI15_10_IRQn \r
-/**\r
- * @brief Joystick Up push-button\r
- */\r
-#define UP_BUTTON_PIN GPIO_Pin_15\r
-#define UP_BUTTON_GPIO_PORT GPIOG\r
-#define UP_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define UP_BUTTON_EXTI_LINE EXTI_Line15\r
-#define UP_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOG\r
-#define UP_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource15\r
-#define UP_BUTTON_EXTI_IRQn EXTI15_10_IRQn \r
-/**\r
- * @brief Joystick Down push-button\r
- */ \r
-#define DOWN_BUTTON_PIN GPIO_Pin_11\r
-#define DOWN_BUTTON_GPIO_PORT GPIOG\r
-#define DOWN_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define DOWN_BUTTON_EXTI_LINE EXTI_Line11\r
-#define DOWN_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOG\r
-#define DOWN_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource11\r
-#define DOWN_BUTTON_EXTI_IRQn EXTI15_10_IRQn \r
-/**\r
- * @brief Joystick Sel push-button\r
- */ \r
-#define SEL_BUTTON_PIN GPIO_Pin_7\r
-#define SEL_BUTTON_GPIO_PORT GPIOG\r
-#define SEL_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define SEL_BUTTON_EXTI_LINE EXTI_Line7\r
-#define SEL_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOG\r
-#define SEL_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource7\r
-#define SEL_BUTTON_EXTI_IRQn EXTI9_5_IRQn \r
-/**\r
- * @}\r
- */ \r
-\r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL_COM\r
- * @{\r
- */\r
-#define COMn 2\r
-\r
-/**\r
- * @brief Definition for COM port1, connected to USART1\r
- */ \r
-#define EVAL_COM1 USART1\r
-#define EVAL_COM1_CLK RCC_APB2Periph_USART1\r
-#define EVAL_COM1_TX_PIN GPIO_Pin_9\r
-#define EVAL_COM1_TX_GPIO_PORT GPIOA\r
-#define EVAL_COM1_TX_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define EVAL_COM1_RX_PIN GPIO_Pin_10\r
-#define EVAL_COM1_RX_GPIO_PORT GPIOA\r
-#define EVAL_COM1_RX_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define EVAL_COM1_IRQn USART1_IRQn\r
-\r
-/**\r
- * @brief Definition for COM port2, connected to USART2\r
- */ \r
-#define EVAL_COM2 USART2\r
-#define EVAL_COM2_CLK RCC_APB1Periph_USART2\r
-#define EVAL_COM2_TX_PIN GPIO_Pin_2\r
-#define EVAL_COM2_TX_GPIO_PORT GPIOA\r
-#define EVAL_COM2_TX_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define EVAL_COM2_RX_PIN GPIO_Pin_3\r
-#define EVAL_COM2_RX_GPIO_PORT GPIOA\r
-#define EVAL_COM2_RX_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define EVAL_COM2_IRQn USART2_IRQn\r
-\r
-/**\r
- * @}\r
- */ \r
-\r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL_SD_FLASH\r
- * @{\r
- */\r
-/**\r
- * @brief SD SPI Interface pins\r
- */\r
-#define SD_SPI SPI2\r
-#define SD_SPI_CLK RCC_APB1Periph_SPI2\r
-#define SD_SPI_SCK_PIN GPIO_Pin_13 /* PC.13 */\r
-#define SD_SPI_SCK_GPIO_PORT GPIOB /* GPIOB */\r
-#define SD_SPI_SCK_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define SD_SPI_MISO_PIN GPIO_Pin_14 /* PC.14 */\r
-#define SD_SPI_MISO_GPIO_PORT GPIOB /* GPIOB */\r
-#define SD_SPI_MISO_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define SD_SPI_MOSI_PIN GPIO_Pin_15 /* PB.15 */\r
-#define SD_SPI_MOSI_GPIO_PORT GPIOB /* GPIOB */\r
-#define SD_SPI_MOSI_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define SD_CS_PIN GPIO_Pin_6 /* PG.06 */\r
-#define SD_CS_GPIO_PORT GPIOG /* GPIOG */\r
-#define SD_CS_GPIO_CLK RCC_APB2Periph_GPIOG\r
-#define SD_DETECT_PIN GPIO_Pin_11 /* PF.11 */\r
-#define SD_DETECT_GPIO_PORT GPIOF /* GPIOF */\r
-#define SD_DETECT_GPIO_CLK RCC_APB2Periph_GPIOF\r
-\r
-/**\r
- * @}\r
- */\r
-\r
-/** @addtogroup STM3210C_EVAL_LOW_LEVEL_I2C_EE\r
- * @{\r
- */\r
-/**\r
- * @brief I2C EEPROM Interface pins\r
- */ \r
-#define sEE_I2C I2C2\r
-#define sEE_I2C_CLK RCC_APB1Periph_I2C2\r
-#define sEE_I2C_SCL_PIN GPIO_Pin_10 /* PB.10 */\r
-#define sEE_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */\r
-#define sEE_I2C_SCL_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define sEE_I2C_SDA_PIN GPIO_Pin_11 /* PB.11 */\r
-#define sEE_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */\r
-#define sEE_I2C_SDA_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define sEE_M24C64_32\r
-\r
-#define sEE_I2C_DMA DMA1 \r
-#define sEE_I2C_DMA_CHANNEL_TX DMA1_Channel4\r
-#define sEE_I2C_DMA_CHANNEL_RX DMA1_Channel5 \r
-#define sEE_I2C_DMA_FLAG_TX_TC DMA1_IT_TC4 \r
-#define sEE_I2C_DMA_FLAG_TX_GL DMA1_IT_GL4 \r
-#define sEE_I2C_DMA_FLAG_RX_TC DMA1_IT_TC5 \r
-#define sEE_I2C_DMA_FLAG_RX_GL DMA1_IT_GL5 \r
-#define sEE_I2C_DMA_CLK RCC_AHBPeriph_DMA1\r
-#define sEE_I2C_DR_Address ((uint32_t)0x40005810)\r
-#define sEE_USE_DMA\r
- \r
-#define sEE_I2C_DMA_TX_IRQn DMA1_Channel4_IRQn\r
-#define sEE_I2C_DMA_RX_IRQn DMA1_Channel5_IRQn\r
-#define sEE_I2C_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler\r
-#define sEE_I2C_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler \r
-#define sEE_I2C_DMA_PREPRIO 0\r
-#define sEE_I2C_DMA_SUBPRIO 0\r
- \r
-#define sEE_DIRECTION_TX 0\r
-#define sEE_DIRECTION_RX 1 \r
-\r
-/* Time constant for the delay caclulation allowing to have a millisecond \r
- incrementing counter. This value should be equal to (System Clock / 1000).\r
- ie. if system clock = 24MHz then sEE_TIME_CONST should be 24. */\r
-#define sEE_TIME_CONST 24 \r
-\r
-/**\r
- * @}\r
- */ \r
- \r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL_M25P_FLASH_SPI\r
- * @{\r
- */\r
-/**\r
- * @brief M25P FLASH SPI Interface pins\r
- */ \r
-#define sFLASH_SPI SPI1\r
-#define sFLASH_SPI_CLK RCC_APB2Periph_SPI1\r
-#define sFLASH_SPI_SCK_PIN GPIO_Pin_5 /* PA.05 */\r
-#define sFLASH_SPI_SCK_GPIO_PORT GPIOA /* GPIOA */\r
-#define sFLASH_SPI_SCK_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define sFLASH_SPI_MISO_PIN GPIO_Pin_6 /* PA.06 */\r
-#define sFLASH_SPI_MISO_GPIO_PORT GPIOA /* GPIOA */\r
-#define sFLASH_SPI_MISO_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define sFLASH_SPI_MOSI_PIN GPIO_Pin_7 /* PA.07 */\r
-#define sFLASH_SPI_MOSI_GPIO_PORT GPIOA /* GPIOA */\r
-#define sFLASH_SPI_MOSI_GPIO_CLK RCC_APB2Periph_GPIOA\r
-#define sFLASH_CS_PIN GPIO_Pin_6 /* PE.06 */\r
-#define sFLASH_CS_GPIO_PORT GPIOE /* GPIOE */\r
-#define sFLASH_CS_GPIO_CLK RCC_APB2Periph_GPIOE\r
-\r
-/**\r
- * @}\r
- */\r
-\r
-\r
-/** @addtogroup STM32100E_EVAL_LOW_LEVEL_TSENSOR_I2C\r
- * @{\r
- */\r
-/**\r
- * @brief LM75 Temperature Sensor I2C Interface pins\r
- */ \r
-#define LM75_I2C I2C2\r
-#define LM75_I2C_CLK RCC_APB1Periph_I2C2\r
-#define LM75_I2C_SCL_PIN GPIO_Pin_10 /* PB.10 */\r
-#define LM75_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */\r
-#define LM75_I2C_SCL_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define LM75_I2C_SDA_PIN GPIO_Pin_11 /* PB.11 */\r
-#define LM75_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */\r
-#define LM75_I2C_SDA_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define LM75_I2C_SMBUSALERT_PIN GPIO_Pin_12 /* PB.12 */\r
-#define LM75_I2C_SMBUSALERT_GPIO_PORT GPIOB /* GPIOB */\r
-#define LM75_I2C_SMBUSALERT_GPIO_CLK RCC_APB2Periph_GPIOB\r
-#define LM75_I2C_DR ((uint32_t)0x40005810)\r
-\r
-#define LM75_DMA_CLK RCC_AHBPeriph_DMA1\r
-#define LM75_DMA_TX_CHANNEL DMA1_Channel4\r
-#define LM75_DMA_RX_CHANNEL DMA1_Channel5\r
-#define LM75_DMA_TX_TCFLAG DMA1_FLAG_TC4\r
-#define LM75_DMA_RX_TCFLAG DMA1_FLAG_TC5 \r
- \r
-/**\r
- * @}\r
- */\r
- \r
-/**\r
- * @}\r
- */\r
- \r
-/** @defgroup STM32100E_EVAL_LOW_LEVEL_Exported_Macros\r
- * @{\r
- */ \r
-/**\r
- * @}\r
- */ \r
-\r
-/** @defgroup STM32100E_EVAL_LOW_LEVEL_Exported_Functions\r
- * @{\r
- */ \r
-void STM_EVAL_LEDInit(Led_TypeDef Led);\r
-void STM_EVAL_LEDOn(Led_TypeDef Led);\r
-void STM_EVAL_LEDOff(Led_TypeDef Led);\r
-void STM_EVAL_LEDToggle(Led_TypeDef Led);\r
-\r
void CB_GPIO_Out_Init(CB_GPIO_Pin_TypeDef Pin);\r
void CB_GPIO_Out_Hi(CB_GPIO_Pin_TypeDef Pin);\r
void CB_GPIO_Out_Lo(CB_GPIO_Pin_TypeDef Pin);\r
void CB_GPIO_Out_Toggle(CB_GPIO_Pin_TypeDef Pin);\r
void CB_GPIO_Out(CB_GPIO_Pin_TypeDef Pin,uint16_t state);\r
-\r
-void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);\r
-uint32_t STM_EVAL_PBGetState(Button_TypeDef Button);\r
-void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct);\r
-void SD_LowLevel_DeInit(void);\r
-void SD_LowLevel_Init(void); \r
-void sEE_LowLevel_DeInit(void);\r
-void sEE_LowLevel_Init(void);\r
-void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction); \r
-void sFLASH_LowLevel_DeInit(void);\r
-void sFLASH_LowLevel_Init(void); \r
-void LM75_LowLevel_DeInit(void);\r
-void LM75_LowLevel_Init(void); \r
-/**\r
- * @}\r
- */\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
- \r
-#endif /* __STM32100E_EVAL_H */\r
-/**\r
- * @}\r
- */ \r
-\r
-/**\r
- * @}\r
- */ \r
-\r
-/**\r
- * @}\r
- */\r
-\r
-/**\r
- * @}\r
- */\r
- \r
-/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r