pgk.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. ******************************** STM32F10x *********************************
  3. * @文件名 : main.c
  4. * @作者 : sun
  5. * @库版本 : V3.5.0
  6. * @文件版本 : V1.0.0
  7. * @日期 : 2016年05月09日
  8. * @摘要 :
  9. ******************************************************************************/
  10. /*----------------------------------------------------------------------------
  11. 更新日志:
  12. ----------------------------------------------------------------------------*/
  13. /* 包含的头文件 --------------------------------------------------------------*/
  14. #include "bsp.h"
  15. #include "spi.h"
  16. #include "timer.h"
  17. #include "usart.h"
  18. #include "radio.h"
  19. #include "LoraUsart.h"
  20. #include "systick.h"
  21. #include "LoraComm.h"
  22. #include "led.h"
  23. #include "sx1276-Hal.h"
  24. #include "rtc.h"
  25. #include "ch455h.h"
  26. /************************************************
  27. 函数名称 : main
  28. 功 能 : 主函数入口
  29. 参 数 : 无
  30. 返 回 值 : int
  31. 作 者 : sun
  32. *************************************************/
  33. int main(void)
  34. {
  35. uint8_t temp = 0;
  36. uint32_t times=0;
  37. uint8_t test = 0;
  38. uint8_t i = 0;
  39. uint32_t t=0;
  40. System_Initializes();
  41. LED_Init(); //初始化与LED连接的硬件接口
  42. Radio = RadioDriverInit( ); //无线射频模块函数定义
  43. temp = Radio->Init( ); //无线射频模块初始化
  44. printf("采集器,LoRa串口透传测试程序.\r\n");
  45. printf("LED0常亮:电源指示.\r\n");
  46. printf("LED1闪烁:系统运行中.\r\n");
  47. printf("LED2闪烁:串口接收到数据.\r\n");
  48. printf("LED3闪烁:LoRa接收到数据.\r\n");
  49. for(i=0;i<0x70;i++)
  50. {
  51. SX1276Read(i, &test);
  52. printf("LoRa address=0x%02x,value=0x%02x\r\n",i,test);
  53. }
  54. if(temp == 0)
  55. {
  56. SysReboot();
  57. }
  58. while(1)
  59. {
  60. UsartToLora(); //串口透传
  61. if(times&0x00002000)
  62. {
  63. LED1=1;
  64. }
  65. else
  66. {
  67. LED1=0;
  68. }
  69. times++;
  70. if(t!=DeviceRTC.Second)
  71. {
  72. //printf("%02d:%02d:%02d\r\n",DeviceRTC.Hour,DeviceRTC.Minute,DeviceRTC.Second);
  73. //RUN_LED3_TOGGLE;
  74. t=DeviceRTC.Second;
  75. CH455_Write( CH455_DIG1 | Letter_tab[t%10]);
  76. }
  77. }
  78. }
  79. /**** Copyright (C)2016 sun. All Rights Reserved **** END OF FILE ****/