Advertisement
dtung

Untitled

Sep 25th, 2020
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include "stm32f10x.h"
  2.  
  3. void gpio_init(void);
  4.  
  5. void gpio_init() {
  6. // enable PORTC GPIO13 to output push-pull with max_speed 50MHz
  7. RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
  8. GPIOC->CRH &= ~(GPIO_CRH_CNF13|GPIO_CRH_MODE13);
  9. GPIOC->CRH |= GPIO_CRH_MODE13;
  10. }
  11.  
  12. int main() {
  13. gpio_init();
  14.  
  15. for (;;) {
  16. GPIOC->ODR ^= GPIO_ODR_ODR13;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement