Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 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. char buffer[10];
  8. char *bufferp;
  9.  
  10. int main(void)
  11. {
  12.     LL_InitTick(8000000, 1000);
  13.  
  14.     //Warning: if the line below triggers an error, GPIOC is not connected to a AHB1 (Group 1) on this device.
  15.     //In this case, please search the stm32xxxx_ll_bus.h file for 'PERIPH_GPIOC' to find out the correct
  16.     //macro name and use it to replace LL_AHB1_GRP1_PERIPH_$$com.sysprogs.examples.lBedblink.LEDPORT$$ and LL_AHB1_GRP1_EnableClock() below.
  17.     LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
  18.     LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_13, LL_GPIO_MODE_OUTPUT);
  19.     LL_GPIO_SetPinOutputType(GPIOC, LL_GPIO_PIN_13, LL_GPIO_OUTPUT_PUSHPULL);
  20.     LL_GPIO_SetPinSpeed(GPIOC, LL_GPIO_PIN_13, LL_GPIO_SPEED_FREQ_LOW);
  21.     LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_13);
  22.    
  23.     bufferp = buffer;
  24.    
  25.     for (;;)
  26.     {
  27.         LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_13);
  28.         strcpy(bufferp, "Hello");
  29.         //printf("led off\n");
  30.         LL_mDelay(500);
  31.         LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_13);
  32.         strcpy(bufferp, "World");
  33.         //printf("led on\n");
  34.         LL_mDelay(500);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement