Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "radio.h" 00002 00003 #if defined(SX128x_H) 00004 #define BW_KHZ 200 00005 #define SPREADING_FACTOR 7 00006 #define CF_HZ 2487000000 00007 #define TX_DBM 6 00008 #else 00009 #if defined(SX126x_H) 00010 #define TX_DBM (Radio::chipType == CHIP_TYPE_SX1262 ? 20 : 14) 00011 #else 00012 #define TX_DBM 20 00013 #endif 00014 #define BW_KHZ 125 00015 #define SPREADING_FACTOR 7 00016 #define CF_HZ 915000000 00017 #endif 00018 00019 /**********************************************************************/ 00020 EventQueue queue(4 * EVENTS_EVENT_SIZE); 00021 00022 void tx_test() 00023 { 00024 static uint8_t seq = 0; 00025 00026 Radio::radio.tx_buf[0] = seq++; /* set payload */ 00027 Radio::Send(1, 0, 0, 0); /* begin transmission */ 00028 printf("sent\r\n"); 00029 00030 /* { 00031 mbed_stats_cpu_t stats; 00032 mbed_stats_cpu_get(&stats); 00033 printf("canDeep:%u ", sleep_manager_can_deep_sleep()); 00034 printf("Uptime: %llu ", stats.uptime / 1000); 00035 printf("Sleep time: %llu ", stats.sleep_time / 1000); 00036 printf("Deep Sleep: %llu\r\n", stats.deep_sleep_time / 1000); 00037 }*/ 00038 } 00039 00040 void txDoneCB() 00041 { 00042 printf("got-tx-done\r\n"); 00043 queue.call_in(500, tx_test); 00044 } 00045 00046 void rxDoneCB(uint8_t size, float rssi, float snr) 00047 { 00048 } 00049 00050 00051 void radio_irq_callback() 00052 { 00053 queue.call(Radio::service); 00054 } 00055 00056 00057 const RadioEvents_t rev = { 00058 /* DioPin_top_half */ radio_irq_callback, 00059 /* TxDone_topHalf */ NULL, 00060 /* TxDone_botHalf */ txDoneCB, 00061 /* TxTimeout */ NULL, 00062 /* RxDone */ rxDoneCB, 00063 /* RxTimeout */ NULL, 00064 /* RxError */ NULL, 00065 /* FhssChangeChannel */NULL, 00066 /* CadDone */ NULL 00067 }; 00068 00069 int main() 00070 { 00071 printf("\r\nreset-tx "); 00072 00073 Radio::Init(&rev); 00074 00075 Radio::Standby(); 00076 Radio::LoRaModemConfig(BW_KHZ, SPREADING_FACTOR, 1); 00077 Radio::SetChannel(CF_HZ); 00078 00079 Radio::set_tx_dbm(TX_DBM); 00080 00081 // preambleLen, fixLen, crcOn, invIQ 00082 Radio::LoRaPacketConfig(8, false, true, false); 00083 00084 queue.call_in(500, tx_test); 00085 00086 queue.dispatch(); 00087 } 00088
Generated on Sun Jul 17 2022 00:46:28 by
1.7.2