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.
Fork of mbed_blinky by
main.cpp
00001 #include "sx127x_lora.h" 00002 #include "mbed.h" 00003 00004 //SX127x(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName rst, PinName dio_0, PinName dio_1); 00005 SX127x kom(PTD2, PTD3, PTD1, PTD0, PTD5, PTA13, PTC9); 00006 SX127x_lora Lora(kom); 00007 00008 DigitalOut myled(LED1); 00009 Serial pc(USBTX, USBRX); 00010 00011 int main() { 00012 uint8_t data[8]; 00013 uint8_t ret_data; 00014 pc.baud(115200); 00015 kom.init(); 00016 00017 Lora.enable(); 00018 Lora.setSf(12); 00019 Lora.setBw(250); 00020 kom.set_frf_MHz(868); 00021 kom.write_reg(0x22,0x01); 00022 00023 Lora.start_rx(); 00024 00025 pc.printf("%s","Test RX\r"); 00026 wait_ms(10); 00027 while(1) { 00028 //myled = 1; 00029 //wait(0.2); 00030 //myled = 0; 00031 //wait(0.2); 00032 00033 while(Lora.service() != SERVICE_READ_FIFO); 00034 //for(unsigned i = 0; i < 8; i++) 00035 //{ 00036 data[0] = kom.rx_buf[0]; 00037 pc.printf("%c",data[0]); 00038 //} 00039 00040 //for (unsigned i = 0; i < 0x71; i++) { 00041 //pc.printf("%X:%02X\r",i,kom.read_reg(i)); 00042 //wait_ms(10); 00043 //} 00044 Lora.start_rx(); 00045 } 00046 }
Generated on Thu Jul 14 2022 02:00:19 by
