fork download
  1. #include "stm32f4xx.h"
  2. #include "stm32f4xx_gpio.h"
  3. #include "stm32f4xx_rcc.h"
  4. #include "stm32f4xx_usart.h"
  5.  
  6. void wait() {
  7. volatile int i;
  8. for(i = 0; i < 200000; ++i);
  9. }
  10.  
  11. void wait_min() {
  12. volatile int i;
  13. for(i = 0; i < 10000; ++i);
  14. }
  15.  
  16. int main(int argc, char **argv) {
  17. RCC_AHB1PeriphClockCmd(
  18. RCC_AHB1Periph_GPIOD,
  19. ENABLE
  20. );
  21.  
  22. RCC_AHB1PeriphClockCmd(
  23. RCC_AHB1Periph_GPIOC,
  24. ENABLE
  25. );
  26.  
  27. RCC_APB2PeriphClockCmd(
  28. RCC_APB2Periph_USART6,
  29. ENABLE
  30. );
  31.  
  32. GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_USART6);
  33.  
  34. GPIO_InitTypeDef led, usartPin;
  35.  
  36. led.GPIO_Mode = GPIO_Mode_OUT;
  37. led.GPIO_OType = GPIO_OType_PP;
  38. led.GPIO_Pin = GPIO_Pin_12;
  39. led.GPIO_PuPd = GPIO_PuPd_UP;
  40. led.GPIO_Speed = GPIO_Speed_50MHz;
  41.  
  42. GPIO_Init(GPIOD, &led);
  43.  
  44. usartPin.GPIO_OType = GPIO_OType_PP;
  45. usartPin.GPIO_PuPd = GPIO_PuPd_UP;
  46. usartPin.GPIO_Mode = GPIO_Mode_AF;
  47. usartPin.GPIO_Pin = GPIO_Pin_6;
  48. usartPin.GPIO_Speed = GPIO_High_Speed;
  49.  
  50. GPIO_Init(GPIOC, &usartPin);
  51.  
  52. USART_InitTypeDef usart;
  53.  
  54. USART_StructInit(&usart);
  55. USART_Init(USART6, &usart);
  56. USART_Cmd(USART6, ENABLE);
  57.  
  58. while(1) {
  59. GPIO_WriteBit(GPIOD, GPIO_Pin_12, Bit_SET);
  60. USART_SendData(USART6, 'X');
  61. wait_min();
  62. GPIO_WriteBit(GPIOD, GPIO_Pin_12, Bit_RESET);
  63. wait();
  64. }
  65. }
  66.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:23: fatal error: stm32f4xx.h: No such file or directory
 #include "stm32f4xx.h"
                       ^
compilation terminated.
stdout
Standard output is empty