|
@@ -322,21 +322,6 @@ float const delta_phi_1 = (float) 1200 / SAMPLE_FREQUENCY * LUT_SIZE;
|
|
|
float const delta_phi_2 = (float) 2200 / SAMPLE_FREQUENCY * LUT_SIZE;
|
|
|
uint8_t data;
|
|
|
|
|
|
-//const uint8_t APRS_TEST_PACKET[] = {168,138,166,168, 64, 64,224,174,132,100,158,166,180,255, 3,240, 44, 84,
|
|
|
-// 104,101, 32,113,117,105, 99,107, 32, 98,114,111,119,110, 32,102,111,120,
|
|
|
-// 32,106,117,109,112,115, 32,111,118,101,114, 32,116,104,101, 32,108, 97,
|
|
|
-// 122,121, 32,100,111,103, 33, 32, 32, 49, 32,111,102, 32, 52, 40,110};
|
|
|
-
|
|
|
-const 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,
|
|
|
- 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x54, 0x65, 0x73, 0x74, 0x7b, 0x31, 0xad, 0xa1 };
|
|
|
-
|
|
|
-//#define APRS_TEST_PACKET fbuf
|
|
|
-
|
|
|
-extern unsigned char *fbuf;
|
|
|
-extern uint32_t flen;
|
|
|
-//const uint8_t APRS_TEST_PACKET[] = {0xFF, 0xFF, 0xFF};
|
|
|
|
|
|
// The output needs to be continous phase.
|
|
|
|
|
@@ -354,7 +339,7 @@ aprs_flags_t DRAM_ATTR aprs_flags = {
|
|
|
.one_count = 0,
|
|
|
.sample_count = 0,
|
|
|
.byte = 0,
|
|
|
- .packet_len = sizeof(APRS_TEST_PACKET)/sizeof(uint8_t),
|
|
|
+// .packet_len = sizeof(APRS_TEST_PACKET)/sizeof(uint8_t),
|
|
|
.prev_bit = 0,
|
|
|
.cur_bit = 0,
|
|
|
.tone = 0
|
|
@@ -399,8 +384,7 @@ void cc1200_lut_init(void)
|
|
|
#define PREAMBLE_LENGTH 20
|
|
|
#define SUFFIX_LENGTH 1
|
|
|
|
|
|
-// test function to generate APRS s1 or s2
|
|
|
-void IRAM_ATTR cc1200_radio_APRSTXPacket(void)
|
|
|
+void IRAM_ATTR cc1200_radio_APRSTXPacket(uint8_t *f, uint16_t f_len, uint8_t tx_delay, uint8_t tx_tail)
|
|
|
{
|
|
|
// start CW transmission
|
|
|
cc1200_spi_write_byte(CC120X_FIFO, 0x12);
|
|
@@ -415,18 +399,20 @@ void IRAM_ATTR cc1200_radio_APRSTXPacket(void)
|
|
|
// acquire SPI bus for fastest possible SPI transactions
|
|
|
spi_device_acquire_bus(spi, portMAX_DELAY);
|
|
|
|
|
|
+
|
|
|
int16_t i,j;
|
|
|
+ uint16_t p_len = tx_delay * 12;
|
|
|
+ uint16_t t_len = tx_tail * 12;
|
|
|
|
|
|
- while(1)
|
|
|
- {
|
|
|
- // start CW transmission
|
|
|
+ // Start CW transmission
|
|
|
cc1200_spi_write_byte(CC120X_FIFO, 0x12);
|
|
|
cc1200_spi_strobe(CC120X_STX);
|
|
|
|
|
|
sample_count = 0;
|
|
|
new_sample = 0;
|
|
|
- /* Send Flag */
|
|
|
- for (i = 0; i<PREAMBLE_LENGTH; i++)
|
|
|
+
|
|
|
+ // Send HDLC Flag for TX Delay Time
|
|
|
+ for (i = 0; i<p_len; i++)
|
|
|
{
|
|
|
aprs_flags.byte = 0x7E;
|
|
|
for(j=0; j<8; j++)
|
|
@@ -463,10 +449,11 @@ void IRAM_ATTR cc1200_radio_APRSTXPacket(void)
|
|
|
}
|
|
|
aprs_flags.one_count = 0;
|
|
|
|
|
|
- /* Send Packet */
|
|
|
- for (i=0;i<aprs_flags.packet_len;i++)
|
|
|
+ // Send Packet / Frame
|
|
|
+ //for (i=0;i<aprs_flags.packet_len;i++)
|
|
|
+ for (i=0;i<f_len;i++)
|
|
|
{
|
|
|
- aprs_flags.byte = APRS_TEST_PACKET[i];
|
|
|
+ aprs_flags.byte = f[i];
|
|
|
for(j=0; j<8; j++)
|
|
|
{
|
|
|
aprs_flags.cur_bit = aprs_flags.byte & 0x01; // bool of first bit
|
|
@@ -522,8 +509,8 @@ void IRAM_ATTR cc1200_radio_APRSTXPacket(void)
|
|
|
}
|
|
|
aprs_flags.one_count = 0;
|
|
|
|
|
|
- /* Send Flag */
|
|
|
- for (i = 0; i<SUFFIX_LENGTH; i++)
|
|
|
+ // Send HDLC Flag for TX Tail
|
|
|
+ for (i = 0; i<t_len; i++)
|
|
|
{
|
|
|
aprs_flags.byte = 0x7E;
|
|
|
for(j=0; j<8;j++)
|
|
@@ -558,12 +545,9 @@ void IRAM_ATTR cc1200_radio_APRSTXPacket(void)
|
|
|
}
|
|
|
}
|
|
|
cc1200_spi_strobe(CC120X_SIDLE);
|
|
|
-
|
|
|
- vTaskDelay(10000/portTICK_PERIOD_MS);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
-extern RingbufHandle_t cfm_buf_handle;
|
|
|
+RingbufHandle_t cfm_buf_handle;
|
|
|
|
|
|
static void IRAM_ATTR cc1200_aprs_rx_isr(void* arg)
|
|
|
{
|