Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.12 KB | None | 0 0
  1. #include <stm32f1xx_ll_bus.h>
  2. #include <stm32f1xx_ll_gpio.h>
  3. #include <stm32f1xx_ll_utils.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. typedef enum
  8. {
  9.     Led_off = 0U,
  10.     Led_on
  11. }LedState_t;
  12.  
  13. LedState_t LedState;
  14.  
  15. int main(void)
  16. {
  17.     LL_InitTick(8000000, 1000);
  18.  
  19.     //Warning: if the line below triggers an error, GPIOC is not connected to a AHB1 (Group 1) on this device.
  20.     //In this case, please search the stm32xxxx_ll_bus.h file for 'PERIPH_GPIOC' to find out the correct
  21.     //macro name and use it to replace LL_AHB1_GRP1_PERIPH_$$com.sysprogs.examples.lBedblink.LEDPORT$$ and LL_AHB1_GRP1_EnableClock() below.
  22.     LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
  23.     LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_13, LL_GPIO_MODE_OUTPUT);
  24.     LL_GPIO_SetPinOutputType(GPIOC, LL_GPIO_PIN_13, LL_GPIO_OUTPUT_PUSHPULL);
  25.     LL_GPIO_SetPinSpeed(GPIOC, LL_GPIO_PIN_13, LL_GPIO_SPEED_FREQ_LOW);
  26.     LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_13);
  27.    
  28.    
  29.     for (;;)
  30.     {
  31.         LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_13);
  32.         LedState = Led_off;
  33.         LL_mDelay(500);
  34.        
  35.         LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_13);
  36.         LedState = Led_on;
  37.         LL_mDelay(500);
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement