main.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Project: Arrow
  3. * Author: curiousmuch
  4. */
  5. #include <stdio.h>
  6. #include "freertos/FreeRTOS.h"
  7. #include "freertos/task.h"
  8. #include "driver/gpio.h"
  9. #include "sdkconfig.h"
  10. #include "esp_task_wdt.h"
  11. #include "cc1200.h"
  12. #include "cc1200_protocol.h"
  13. #include "board.h"
  14. #include "ax25_pad2.h"
  15. #include "ax25_pad.h"
  16. #include "fcs_calc.h"
  17. #include "nvs.h"
  18. #include "nvs_flash.h"
  19. #include "esp_log.h"
  20. #include "esp_bt.h"
  21. #include "esp_bt_main.h"
  22. #include "esp_gap_bt_api.h"
  23. #include "esp_bt_device.h"
  24. #include "esp_spp_api.h"
  25. #include "bt_spp.c"
  26. uint8_t APRS_TEST_PACKET[] = { 0x82, 0x98, 0x98, 0x40, 0x40, 0x40, 0xe0, 0x96, 0x84, 0x66, 0xaa, 0x96, 0xac, 0xe0, 0xae, 0x92,
  27. 0x88, 0x8a, 0x62, 0x40, 0x62, 0xae, 0x92, 0x88, 0x8a, 0x64, 0x40, 0x65, 0x03, 0xf0, 0x3a, 0x4b,
  28. 0x42, 0x33, 0x55, 0x4b, 0x56, 0x2d, 0x32, 0x20, 0x3a, 0x48, 0x69, 0x21, 0x20, 0x54, 0x68, 0x69, 0x73,
  29. 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x54, 0x65, 0x73, 0x74, 0x7b, 0x31, 0xad, 0xa1 };
  30. void IRAM_ATTR app_main()
  31. {
  32. // Initialize Flash
  33. esp_err_t ret = nvs_flash_init();
  34. if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
  35. ESP_ERROR_CHECK(nvs_flash_erase());
  36. ret = nvs_flash_init();
  37. }
  38. ESP_ERROR_CHECK( ret );
  39. // Setup Radio
  40. cc1200_radio_init(APRS_SETTINGS, sizeof(APRS_SETTINGS)/sizeof(cc1200_reg_settings_t));
  41. cc1200_radio_frequency(144390000-6000);
  42. vTaskDelay(500/portTICK_PERIOD_MS);
  43. // Setup TNC
  44. tnc_init();
  45. // Initalize BLE
  46. bt_spp_init();
  47. }