12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <time.h>
- #include <sys/time.h>
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "esp_sleep.h"
- #include "esp_log.h"
- #include "driver/uart.h"
- #include "driver/rtc_io.h"
- #include "esp_intr_alloc.h"
- #include "esp_attr.h"
- #include "driver/timer.h"
- #include <stddef.h>
- #include "esp_intr_alloc.h"
- #include "led.h"
- #include "rxTimer.h"
- #include "transceiver.h"
- #include "receiver.h"
- #include "nexaTransmit.h"
- #include "wifi.h"
- #include "udp_client.h"
- void app_main(void)
- {
- //volatile uint32_t counter = 0;
- // Init stuff
- disableRx = true;
- rxTimerInit(); // First we start the Timer (which samples Rx and handles uS-delays)
- #ifdef WIFI_ENABLED
- initWifi(); // Init WIFI
- udpClientInit();
- #endif
- initTransceiver(); // Init the 433-transceiver-HW
- initLed(); // Init LED-Blink
- initReceiver(); // Init receiver-task
- initNexaTransmit(); // Init NEXA Transmit task
- disableRx = false;
-
- while (true)
- {
- vTaskDelay(100 / portTICK_PERIOD_MS);
- int c;
- c=getchar();
- if( c == 't') {
- ESP_LOGI("MAIN", "Time: %10d mS",millis());
- }
- if( c == '?' ) {
- char buff[40*15];
- vTaskList(buff);
- printf(buff);
- }
- if( c == 'p' ) {
- int idx=dataArrIdx;
- for(int i=0;i<500;i++) {
-
- if( dataArr[idx] > 200 && dataArr[idx] < 5000 )
- printf("%u\n",dataArr[idx]);
- else
- printf("-\n");
- idx--;
- if( idx == -1 ) idx = 999;
- }
- }
- if( c == 'w' ) {
- char buff[40*10];
- vTaskGetRunTimeStats(buff);
- printf(buff);
- }
- if( c == '0' ) {
- sendNexaCode(0x4C90AD81);
- }
- if( c == '1' ) {
- sendNexaCode(0x4C90AD91);
- }
- }
- }
|