|
@@ -13,10 +13,21 @@
|
|
|
#include "cc1200_protocol.h"
|
|
|
#include "board.h"
|
|
|
|
|
|
-//#include "ax25_pad2.h"
|
|
|
-//#include "ax25_pad.h"
|
|
|
+#include "ax25_pad2.h"
|
|
|
+#include "ax25_pad.h"
|
|
|
#include "fcs_calc.h"
|
|
|
|
|
|
+#include "nvs.h"
|
|
|
+#include "nvs_flash.h"
|
|
|
+#include "esp_log.h"
|
|
|
+#include "esp_bt.h"
|
|
|
+#include "esp_bt_main.h"
|
|
|
+#include "esp_gap_bt_api.h"
|
|
|
+#include "esp_bt_device.h"
|
|
|
+#include "esp_spp_api.h"
|
|
|
+#include "bt_spp.c"
|
|
|
+
|
|
|
+
|
|
|
uint8_t APRS_TEST_PACKET[] = { 0x82, 0x98, 0x98, 0x40, 0x40, 0x40, 0xe0, 0x96, 0x84, 0x66, 0xaa, 0x96, 0xac, 0xe0, 0xae, 0x92,
|
|
|
0x88, 0x8a, 0x62, 0x40, 0x62, 0xae, 0x92, 0x88, 0x8a, 0x64, 0x40, 0x65, 0x03, 0xf0, 0x3a, 0x4b,
|
|
|
0x42, 0x33, 0x55, 0x4b, 0x56, 0x2d, 0x32, 0x20, 0x3a, 0x48, 0x69, 0x21, 0x20, 0x54, 0x68, 0x69, 0x73,
|
|
@@ -24,34 +35,23 @@ uint8_t APRS_TEST_PACKET[] = { 0x82, 0x98, 0x98, 0x40, 0x40, 0x40, 0xe0, 0x96, 0
|
|
|
|
|
|
void IRAM_ATTR app_main()
|
|
|
{
|
|
|
- cc1200_radio_init(APRS_SETTINGS, sizeof(APRS_SETTINGS)/sizeof(cc1200_reg_settings_t));
|
|
|
- vTaskDelay(500/portTICK_PERIOD_MS);
|
|
|
-
|
|
|
-// // generate sample packet
|
|
|
-// packet_t pp;
|
|
|
-// unsigned char fbuf[AX25_MAX_PACKET_LEN+2];
|
|
|
-// uint32_t flen;
|
|
|
-// uint32_t c;
|
|
|
-//
|
|
|
-// pp = ax25_from_text("WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 1 of 4", 1);
|
|
|
-// flen = ax25_pack(pp, fbuf);
|
|
|
-//
|
|
|
-// uint32_t fcs = fcs_calc(fbuf, flen);
|
|
|
-//
|
|
|
-// ax25_hex_dump(pp);
|
|
|
-// printf("FCS: %x\n", fcs);
|
|
|
-
|
|
|
-
|
|
|
- //while(1)
|
|
|
- {
|
|
|
-
|
|
|
- //cc1200_radio_APRSTXPacket(APRS_TEST_PACKET, sizeof(APRS_TEST_PACKET)/sizeof(uint8_t), 4, 2);
|
|
|
- vTaskDelay(1000/portTICK_PERIOD_MS);
|
|
|
+ // Initialize Flash
|
|
|
+ esp_err_t ret = nvs_flash_init();
|
|
|
+ if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
|
+ ESP_ERROR_CHECK(nvs_flash_erase());
|
|
|
+ ret = nvs_flash_init();
|
|
|
}
|
|
|
+ ESP_ERROR_CHECK( ret );
|
|
|
|
|
|
- //cc1120_radio_APRSTXPacket();
|
|
|
- //xTaskCreatePinnedToCore();
|
|
|
+ // Setup Radio
|
|
|
+ cc1200_radio_init(APRS_SETTINGS, sizeof(APRS_SETTINGS)/sizeof(cc1200_reg_settings_t));
|
|
|
+ cc1200_radio_frequency(144390000-6000);
|
|
|
|
|
|
+ vTaskDelay(500/portTICK_PERIOD_MS);
|
|
|
|
|
|
+ // Setup TNC
|
|
|
+ tnc_init();
|
|
|
|
|
|
+ // Initalize BLE
|
|
|
+ bt_spp_init();
|
|
|
}
|