daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Oct 21st, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stm32f10x.h>
  2. /*#include <stm32f10x_gpio.h>*/
  3. /*#include <stm32f10x_rcc.h>*/
  4.  
  5. #define LED_PORT GPIOC
  6. #define LED_BLUE (1 << 8)
  7. #define LED_GREEN (1 << 9)
  8.  
  9. int main(int argc, char const *argv[])
  10. {
  11.     /* setup i/o port */
  12.     RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
  13.     LED_PORT->CRH |= GPIO_CRH_MODE8_0 | GPIO_CRH_MODE9_0;
  14.     LED_PORT->CRH &= ~(GPIO_CRH_CNF8 | GPIO_CRH_CNF9);
  15.     /* enable led */
  16.     LED_PORT->ODR = LED_GREEN;
  17.     /* infinity loop */
  18.     while (1);
  19.  
  20.     return 0;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top