main.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. *********************************************************************************************************
  3. * 函 数 名: main
  4. * 功能说明: c程序入口
  5. * 形 参:无
  6. * 返 回 值: 错误代码(无需处理)
  7. *********************************************************************************************************
  8. */
  9. #include "stm32f4xx.h"
  10. #include "led.h"
  11. void Delay(uint32_t count)
  12. {
  13. for (; count != 0; count--)
  14. ;
  15. }
  16. int main(void)
  17. {
  18. #if 0
  19. /* 打开GOIOI 端口时钟 */
  20. *(unsigned int *)(0x40023800 + 0x30) |= (1 << 8);
  21. /* PI10 为输出 */
  22. *(unsigned int *)(0x40022000 + 0x00) &= ~((0x03) << (2 * 10));
  23. *(unsigned int *)(0x40022000 + 0x00) |= (1 << (2 * 10));
  24. /* PI10 输出高电平 */
  25. *(unsigned int *)(0x40022000 + 0x14) |= (1 << 10);
  26. /* PI10 输出低电平 */
  27. *(unsigned int *)(0x40022000 + 0x14) &= ~(1 << 10);
  28. #elif 1
  29. LED_Init();
  30. while (1)
  31. {
  32. GPIO_ResetBits(GPIOI, GPIO_Pin_10);
  33. Delay(0xFFFFFFFF);
  34. // GPIO_SetBits(GPIOI, GPIO_Pin_10);
  35. // Delay(0xFFFFFFFF);
  36. GPIO_ResetBits(GPIOF, GPIO_Pin_7);
  37. Delay(0xFFFFFF);
  38. // GPIO_SetBits(GPIOF, GPIO_Pin_7);
  39. // Delay(0xFFFFFF);
  40. GPIO_ResetBits(GPIOF, GPIO_Pin_8);
  41. Delay(0xFFFFFF);
  42. // GPIO_SetBits(GPIOF, GPIO_Pin_8);
  43. // Delay(0xFFFFFF);
  44. GPIO_ResetBits(GPIOC, GPIO_Pin_2);
  45. Delay(0xFFFFFF);
  46. // GPIO_SetBits(GPIOC, GPIO_Pin_2);
  47. // Delay(0xFFFFFF);
  48. };
  49. #endif
  50. }
  51. // void SystemInit(void)
  52. // {
  53. // }