Changeset - 910a3533e103
[Not reviewed]
default
0 5 0
Ethan Zonca - 11 years ago 2014-03-30 00:06:55
ez@ethanzonca.com
Strip out random crap
5 files changed with 1 insertions and 309 deletions:
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    main.c 
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   Main program body
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
 
  *
 
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
 
  * You may not use this file except in compliance with the License.
 
  * You may obtain a copy of the License at:
 
  *
 
  *        http://www.st.com/software_license_agreement_liberty_v2
 
  *
 
  * Unless required by applicable law or agreed to in writing, software 
 
  * distributed under the License is distributed on an "AS IS" BASIS, 
 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  * See the License for the specific language governing permissions and
 
  * limitations under the License.
 
  *
 
  ******************************************************************************
 
  */ 
 
 
/* Includes ------------------------------------------------------------------*/
 
#include "main.h"
 
#include "stm32l100c_discovery.h"
 
/** @addtogroup STM32L100C-Discovery_Demo
 
  * @{
 
  */
 
 
/* Private typedef -----------------------------------------------------------*/
 
/* Private define ------------------------------------------------------------*/
 
/* Private macro -------------------------------------------------------------*/
 
/* Private variables ---------------------------------------------------------*/
 
static __IO uint32_t TimingDelay;
 
uint8_t BlinkSpeed = 0;
 
 
/* Private function prototypes -----------------------------------------------*/
 
/* Private functions ---------------------------------------------------------*/
 
 
/**
 
  * @brief  Main program.
 
  * @param  None
 
  * @retval None
 
  */
 
int main(void)
 
{
 
  RCC_ClocksTypeDef RCC_Clocks;
 
  
 
  /* Configure LED3 and LED4 on STM32L100C-Discovery */
 
  STM_EVAL_LEDInit(LED3);
 
  STM_EVAL_LEDInit(LED4);
 
  
 
  /* Initialize User_Button on STM32L100C-Discovery */
 
  STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO);
 
  
 
  /* SysTick end of count event each 1ms */
 
  RCC_GetClocksFreq(&RCC_Clocks);
 
  SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
 
   
 
  /* Initiate Blink Speed variable */ 
 
  BlinkSpeed = 1;
 
  
 
  while(1)
 
@@ -139,30 +101,24 @@ void TimingDelay_Decrement(void)
 
    TimingDelay--;
 
  }
 
}
 
 
#ifdef  USE_FULL_ASSERT
 
 
/**
 
  * @brief  Reports the name of the source file and the source line number
 
  *   where the assert_param error has occurred.
 
  * @param  file: pointer to the source file name
 
  * @param  line: assert_param error line source number
 
  * @retval None
 
  */
 
void assert_failed(uint8_t* file, uint32_t line)
 
{ 
 
  /* User can add his own implementation to report the file name and line number,
 
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
 
 
  /* Infinite loop */
 
  while (1)
 
  {}
 
}
 
#endif
 
 
/**
 
  * @}
 
  */
 
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
main.h
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    main.h 
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   Header for main.c module
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
 
  *
 
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
 
  * You may not use this file except in compliance with the License.
 
  * You may obtain a copy of the License at:
 
  *
 
  *        http://www.st.com/software_license_agreement_liberty_v2
 
  *
 
  * Unless required by applicable law or agreed to in writing, software 
 
  * distributed under the License is distributed on an "AS IS" BASIS, 
 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  * See the License for the specific language governing permissions and
 
  * limitations under the License.
 
  *
 
  ******************************************************************************
 
  */ 
 
  
 
/* Define to prevent recursive inclusion -------------------------------------*/
 
#ifndef __MAIN_H
 
#define __MAIN_H
 
 
/* Includes ------------------------------------------------------------------*/
 
#include "stm32l1xx.h"
 
#include "stm32l100c_discovery.h"
 
/* Exported types ------------------------------------------------------------*/
 
/* Private define ------------------------------------------------------------*/
 
/* Exported constants --------------------------------------------------------*/
 
/* Exported macro ------------------------------------------------------------*/
 
/* Exported functions ------------------------------------------------------- */
 
 
void TimingDelay_Decrement(void);
 
void Delay(__IO uint32_t nTime);
 
 
#endif /* __MAIN_H */
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32l100c_discovery.c
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    stm32l100c_discovery.c
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   This file provides set of firmware functions to manage Leds and
 
  *          push-button available on STM32L100C-Discovery Kit from STMicroelectronics.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
 
  *
 
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
 
  * You may not use this file except in compliance with the License.
 
  * You may obtain a copy of the License at:
 
  *
 
  *        http://www.st.com/software_license_agreement_liberty_v2
 
  *
 
  * Unless required by applicable law or agreed to in writing, software 
 
  * distributed under the License is distributed on an "AS IS" BASIS, 
 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  * See the License for the specific language governing permissions and
 
  * limitations under the License.
 
  *
 
  ******************************************************************************
 
  */
 
  
 
/* Includes ------------------------------------------------------------------*/
 
#include "stm32l100c_discovery.h"
 
 
/** @addtogroup Utilities
 
  * @{
 
  */ 
 
 
/** @addtogroup STM32L100C_DISCOVERY
 
  * @{
 
  */ 
 
    
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL 
 
  * @brief This file provides firmware functions to manage Leds and push-buttons, 
 
  *        available on STM32L100C_DISCOVERY evaluation board from STMicroelectronics.
 
  * @{
 
  */ 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Private_TypesDefinitions
 
  * @{
 
  */ 
 
/**
 
  * @}
 
  */ 
 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Private_Defines
 
  * @{
 
  */ 
 
/**
 
  * @}
 
  */ 
 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Private_Macros
 
  * @{
 
  */ 
 
/**
 
  * @}
 
  */ 
 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Private_Variables
 
  * @{
 
  */ 
 
GPIO_TypeDef* GPIO_PORT[LEDn] = {LED3_GPIO_PORT, LED4_GPIO_PORT};
 
const uint16_t GPIO_PIN[LEDn] = {LED3_PIN, LED4_PIN};
 
const uint32_t GPIO_CLK[LEDn] = {LED3_GPIO_CLK, LED4_GPIO_CLK};
 
 
GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {USER_BUTTON_GPIO_PORT}; 
 
 
const uint16_t BUTTON_PIN[BUTTONn] = {USER_BUTTON_PIN}; 
 
 
const uint32_t BUTTON_CLK[BUTTONn] = {USER_BUTTON_GPIO_CLK};
 
 
const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {USER_BUTTON_EXTI_LINE};
 
 
const uint16_t BUTTON_PORT_SOURCE[BUTTONn] = {USER_BUTTON_EXTI_PORT_SOURCE};
 
								 
 
const uint16_t BUTTON_PIN_SOURCE[BUTTONn] = {USER_BUTTON_EXTI_PIN_SOURCE}; 
 
 
const uint16_t BUTTON_IRQn[BUTTONn] = {USER_BUTTON_EXTI_IRQn};
 
 
/**
 
  * @}
 
  */ 
 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Private_FunctionPrototypes
 
  * @{
 
  */ 
 
 
/**
 
  * @}
 
  */ 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Private_Functions
 
  * @{
 
  */ 
 
 
/**
 
  * @brief  Configures LED GPIO.
 
  * @param  Led: Specifies the Led to be configured. 
 
  *   This parameter can be one of following parameters:
 
  *     @arg LED3
 
  *     @arg LED4
 
  * @retval None
 
  */
 
void STM_EVAL_LEDInit(Led_TypeDef Led)
 
{
 
  GPIO_InitTypeDef  GPIO_InitStructure;
 
  
 
  /* Enable the GPIO_LED Clock */
 
  RCC_AHBPeriphClockCmd(GPIO_CLK[Led], ENABLE);
 
 
  /* Configure the GPIO_LED pin */
 
  GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led];
 
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
 
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
 
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
 
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
 
  GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure);
 
}
 
 
/**
 
@@ -217,41 +130,24 @@ void STM_EVAL_PBInit(Button_TypeDef Butt
 
 
    /* Enable and set Button EXTI Interrupt to the lowest priority */
 
    NVIC_InitStructure.NVIC_IRQChannel = BUTTON_IRQn[Button];
 
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
 
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
 
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
 
 
    NVIC_Init(&NVIC_InitStructure); 
 
  }
 
}
 
 
/**
 
  * @brief  Returns the selected Button state.
 
  * @param  Button: Specifies the Button to be checked.
 
  *   This parameter can be one of following parameters:
 
  *     @arg BUTTON_USER: User Push Button    
 
  * @retval The Button GPIO pin value.
 
  */
 
uint32_t STM_EVAL_PBGetState(Button_TypeDef Button)
 
{
 
  /* There is no Wakeup button on STM32f0-Discovery Kit */
 
  return GPIO_ReadInputDataBit(BUTTON_PORT[Button], BUTTON_PIN[Button]);
 
}
 
 
/**
 
  * @}
 
  */ 
 
 
/**
 
  * @}
 
  */
 
 
/**
 
  * @}
 
  */
 
 
/**
 
  * @}
 
  */ 
 
    
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32l100c_discovery.h
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    stm32l100c_discovery.h
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   This file contains definitions for STM32L100C-Discovery's Leds, push-
 
  *          buttons hardware resources.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
 
  *
 
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
 
  * You may not use this file except in compliance with the License.
 
  * You may obtain a copy of the License at:
 
  *
 
  *        http://www.st.com/software_license_agreement_liberty_v2
 
  *
 
  * Unless required by applicable law or agreed to in writing, software 
 
  * distributed under the License is distributed on an "AS IS" BASIS, 
 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  * See the License for the specific language governing permissions and
 
  * limitations under the License.
 
  *
 
  ******************************************************************************
 
  */
 
  
 
/* Define to prevent recursive inclusion -------------------------------------*/
 
#ifndef __STM32L100C_DISCOVERY_H
 
#define __STM32L100C_DISCOVERY_H
 
 
#ifdef __cplusplus
 
 extern "C" {
 
#endif
 
 
/* Includes ------------------------------------------------------------------*/
 
#include "stm32l1xx.h"
 
 
/** @addtogroup Utilities
 
  * @{
 
  */
 
 
/** @addtogroup STM32L100C_DISCOVERY
 
  * @{
 
  */
 
      
 
/** @addtogroup STM32L100C_DISCOVERY_LOW_LEVEL
 
  * @{
 
  */ 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Exported_Types
 
  * @{
 
  */
 
typedef enum 
 
{
 
  LED3 = 0,
 
  LED4 = 1
 
} Led_TypeDef;
 
 
typedef enum 
 
{
 
  BUTTON_USER = 0,
 
} Button_TypeDef;
 
 
typedef enum 
 
{  
 
  BUTTON_MODE_GPIO = 0,
 
  BUTTON_MODE_EXTI = 1
 
} ButtonMode_TypeDef;
 
  
 
/**
 
  * @}
 
  */ 
 
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Exported_Constants
 
  * @{
 
  */ 
 
 
/** @addtogroup STM32L100C_DISCOVERY_LOW_LEVEL_LED
 
  * @{
 
  */
 
#define LEDn                             2
 
 
#define LED3_PIN                         GPIO_Pin_9
 
#define LED3_GPIO_PORT                   GPIOC
 
#define LED3_GPIO_CLK                    RCC_AHBPeriph_GPIOC
 
  
 
#define LED4_PIN                         GPIO_Pin_8
 
#define LED4_GPIO_PORT                   GPIOC
 
#define LED4_GPIO_CLK                    RCC_AHBPeriph_GPIOC
 
/**
 
  * @}
 
  */ 
 
 
/** @addtogroup SSTM32L100C_DISCOVERY_LOW_LEVEL_BUTTON
 
  * @{
 
  */  
 
#define BUTTONn                          1
 
 
/**
 
 * @brief USER push-button
 
 */
 
#define USER_BUTTON_PIN                GPIO_Pin_0
 
#define USER_BUTTON_GPIO_PORT          GPIOA
 
#define USER_BUTTON_GPIO_CLK           RCC_AHBPeriph_GPIOA
 
#define USER_BUTTON_EXTI_LINE          EXTI_Line0
 
#define USER_BUTTON_EXTI_PORT_SOURCE   EXTI_PortSourceGPIOA
 
#define USER_BUTTON_EXTI_PIN_SOURCE    EXTI_PinSource0
 
#define USER_BUTTON_EXTI_IRQn          EXTI0_IRQn 
 
 
/**
 
  * @}
 
  */ 
 
  
 
    
 
/** @defgroup STM32L100C_DISCOVERY_LOW_LEVEL_Exported_Macros
 
  * @{
 
  */  
 
/**
 
  * @}
 
  */ 
 
 
/** @defgroup STM32L100C_DISCOVERY_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);
 
 
/**
 
  * @}
 
  */
 
  
 
#ifdef __cplusplus
 
}
 
#endif
 
 
#endif /* __STM32L100C_DISCOVERY_H */
 
/**
 
  * @}
 
  */ 
 
 
/**
 
  * @}
 
  */ 
 
 
/**
 
  * @}
 
  */
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32l1xx_conf.h
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    stm32l1xx_conf.h 
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   Library configuration file.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
 
  *
 
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
 
  * You may not use this file except in compliance with the License.
 
  * You may obtain a copy of the License at:
 
  *
 
  *        http://www.st.com/software_license_agreement_liberty_v2
 
  *
 
  * Unless required by applicable law or agreed to in writing, software 
 
  * distributed under the License is distributed on an "AS IS" BASIS, 
 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  * See the License for the specific language governing permissions and
 
  * limitations under the License.
 
  *
 
  ******************************************************************************
 
  */
 
 
/* Define to prevent recursive inclusion -------------------------------------*/
 
#ifndef __STM32L1xx_CONF_H
 
#define __STM32L1xx_CONF_H
 
 
/* Includes ------------------------------------------------------------------*/
 
/* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */
 
#include "stm32l1xx_adc.h"
 
#include "stm32l1xx_aes.h"
 
#include "stm32l1xx_comp.h"
 
#include "stm32l1xx_crc.h"
 
#include "stm32l1xx_dac.h"
 
#include "stm32l1xx_dbgmcu.h"
 
#include "stm32l1xx_dma.h"
 
#include "stm32l1xx_exti.h"
 
#include "stm32l1xx_flash.h"
 
#include "stm32l1xx_fsmc.h"
 
#include "stm32l1xx_gpio.h"
 
#include "stm32l1xx_i2c.h"
 
#include "stm32l1xx_iwdg.h"
 
#include "stm32l1xx_lcd.h"
 
#include "stm32l1xx_opamp.h"
 
#include "stm32l1xx_pwr.h"
 
#include "stm32l1xx_rcc.h"
 
#include "stm32l1xx_rtc.h"
 
#include "stm32l1xx_sdio.h"
 
#include "stm32l1xx_spi.h"
 
#include "stm32l1xx_syscfg.h"
 
#include "stm32l1xx_tim.h"
 
#include "stm32l1xx_usart.h"
 
#include "stm32l1xx_wwdg.h"
 
#include "misc.h"  /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
 
 
/* Exported types ------------------------------------------------------------*/
 
/* Exported constants --------------------------------------------------------*/
 
/* Uncomment the line below to expanse the "assert_param" macro in the 
 
   Standard Peripheral Library drivers code */
 
/* #define USE_FULL_ASSERT    1 */
 
 
/* Exported macro ------------------------------------------------------------*/
 
#ifdef  USE_FULL_ASSERT
 
 
/**
 
  * @brief  The assert_param macro is used for function's parameters check.
 
  * @param  expr: If expr is false, it calls assert_failed function which reports 
 
  *         the name of the source file and the source line number of the call 
 
  *         that failed. If expr is true, it returns no value.
 
  * @retval None
 
  */
 
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
 
/* Exported functions ------------------------------------------------------- */
 
  void assert_failed(uint8_t* file, uint32_t line);
 
#else
 
  #define assert_param(expr) ((void)0)
 
#endif /* USE_FULL_ASSERT */
 
 
#endif /* __STM32L1xx_CONF_H */
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0 comments (0 inline, 0 general)