|
@@ -44,13 +44,12 @@ RingbufHandle_t radio_tx_buf;
|
|
|
SemaphoreHandle_t xRadioRXISRSemaphore;
|
|
|
SemaphoreHandle_t xRadioRXSemaphore;
|
|
|
SemaphoreHandle_t xRadioTXSemaphore;
|
|
|
-TaskHandle_t xRadioRXTaskHandle;
|
|
|
|
|
|
|
|
|
|
|
|
extern int8_t EXTERNAL_DATA;
|
|
|
|
|
|
-#define WINDOW_SIZE 7
|
|
|
+#define WINDOW_SIZE 6
|
|
|
#define SAMPLEFREQUENCY 6000
|
|
|
|
|
|
int window[WINDOW_SIZE];
|
|
@@ -108,6 +107,35 @@ int window_get_size(void)
|
|
|
return WINDOW_SIZE;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+void IRAM_ATTR rx_timer_isr(void *para)
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ int timer_idx = (int) para;
|
|
|
+
|
|
|
+
|
|
|
+ and update the alarm time for the timer with without reload */
|
|
|
+ TIMERG0.int_clr_timers.t0 = 1;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ TIMERG0.hw_timer[0].config.alarm_en = TIMER_ALARM_EN;
|
|
|
+
|
|
|
+ static BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
|
|
+
|
|
|
+ xSemaphoreGiveFromISR(xRadioRXISRSemaphore, &xHigherPriorityTaskWoken);
|
|
|
+ if (xHigherPriorityTaskWoken == pdTRUE)
|
|
|
+ {
|
|
|
+ portYIELD_FROM_ISR( );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
void TX_Task(void *pvParameters)
|
|
|
{
|
|
@@ -122,7 +150,10 @@ void TX_Task(void *pvParameters)
|
|
|
|
|
|
if (p != NULL)
|
|
|
{
|
|
|
+
|
|
|
|
|
|
+ timer_pause(TIMER_GROUP_0, TIMER_0);
|
|
|
+ timer_disable_intr(TIMER_GROUP_0, TIMER_0);
|
|
|
cc1200_radio_stop_APRSRX();
|
|
|
|
|
|
|
|
@@ -138,6 +169,9 @@ void TX_Task(void *pvParameters)
|
|
|
enable_green_led();
|
|
|
|
|
|
cc1200_radio_start_APRSRX();
|
|
|
+ timer_enable_intr(TIMER_GROUP_0, TIMER_0);
|
|
|
+ timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0x00000000ULL);
|
|
|
+ timer_start(TIMER_GROUP_0, TIMER_0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -157,16 +191,15 @@ void RX_Task(void *pvParameters)
|
|
|
|
|
|
xRadioRXISRSemaphore = xSemaphoreCreateBinary();
|
|
|
|
|
|
-
|
|
|
- xRadioRXTaskHandle = xTaskGetCurrentTaskHandle();
|
|
|
-
|
|
|
|
|
|
enable_green_led();
|
|
|
disable_red_led();
|
|
|
|
|
|
cc1200_radio_start_APRSRX();
|
|
|
+ timer_enable_intr(TIMER_GROUP_0, TIMER_0);
|
|
|
+ timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0x00000000ULL);
|
|
|
+ timer_start(TIMER_GROUP_0, TIMER_0);
|
|
|
|
|
|
- uint32_t ulNotificationValue;
|
|
|
|
|
|
while(1)
|
|
|
{
|
|
@@ -191,36 +224,10 @@ void RX_Task(void *pvParameters)
|
|
|
{
|
|
|
disable_debug_IO(DEBUG_0);
|
|
|
}
|
|
|
- ulNotificationValue = 0;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
void radio_init()
|
|
|
{
|
|
@@ -233,10 +240,27 @@ void radio_init()
|
|
|
cc1200_radio_init(APRS_RX_SETTINGS, sizeof(APRS_RX_SETTINGS)/sizeof(cc1200_reg_settings_t));
|
|
|
cc1200_radio_frequency(144390000-6000);
|
|
|
|
|
|
+
|
|
|
+ timer_config_t config;
|
|
|
+ config.divider = 2;
|
|
|
+ config.counter_dir = TIMER_COUNT_UP;
|
|
|
+ config.counter_en = TIMER_PAUSE;
|
|
|
+ config.alarm_en = TIMER_ALARM_EN;
|
|
|
+ config.intr_type = TIMER_INTR_LEVEL;
|
|
|
+ config.auto_reload = TIMER_AUTORELOAD_EN;
|
|
|
+ timer_init(TIMER_GROUP_0, TIMER_0, &config);
|
|
|
+ timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0x00000000ULL);
|
|
|
+ timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, 6666);
|
|
|
+
|
|
|
+ timer_isr_register(TIMER_GROUP_0, TIMER_0, rx_timer_isr,
|
|
|
+ (void *) TIMER_0, ESP_INTR_FLAG_IRAM, NULL);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
- xTaskCreatePinnedToCore(RX_Task, "RX Task", 1024*4, 0, 1, NULL, 1);
|
|
|
xTaskCreatePinnedToCore(TX_Task, "TX Task", 1024*4, 0, 2, NULL, 1);
|
|
|
+ xTaskCreatePinnedToCore(RX_Task, "RX Task", 1024*4, 0, 1, NULL, 1);
|
|
|
|
|
|
|
|
|
|