Elektronika
/
LORA_TX
LORA TX example
Fork of mbed_blinky by
Revision 7:66f8487ce6a7, committed 2015-02-25
- Comitter:
- exterminator
- Date:
- Wed Feb 25 13:58:07 2015 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- Lora TX example
Changed in this revision
diff -r e8cd76f38fa9 -r 66f8487ce6a7 SX127x.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SX127x.lib Wed Feb 25 13:58:07 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/dudmuck/code/SX127x/#c9592cbc9f86
diff -r e8cd76f38fa9 -r 66f8487ce6a7 main.cpp --- a/main.cpp Fri May 09 19:58:03 2014 +0300 +++ b/main.cpp Wed Feb 25 13:58:07 2015 +0000 @@ -1,12 +1,61 @@ +#include "sx127x_lora.h" #include "mbed.h" -DigitalOut myled(LED1); +//SX127x(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName rst, PinName dio_0, PinName dio_1); +SX127x kom(PTD2, PTD3, PTD1, PTD0, PTD5, PTA13, PTC9); +SX127x_lora Lora(kom); + +DigitalOut myled(LED2); +Serial pc(USBTX, USBRX); int main() { + uint8_t ret_data; + pc.baud(115200); + kom.init(); + + Lora.enable(); + Lora.setSf(12); + Lora.setBw(250); + kom.set_frf_MHz(868); + kom.write_reg(0x22,0x01); + //kom.write_reg(0x01,0x83); //RegOpMode OOK, + //kom.write_reg(0x09,0x8F); //RegPaConfig PA_BOOST, Max Power + //kom.write_reg(0x0A,0x19); //RegPaRamp Std PLL, 40uS (default) + //kom.write_reg(0x0B,0x37); //RegOcp OCP Enabled, 240mA + //kom.write_reg(0x24,0x07); //RegOsc OFF + //kom.write_reg(0x30,0x90); //RegPacketConfig1 Continuous Mode + //kom.write_reg(0x31,0x00); //RegPacketCongig2 Payload Length + //kom.write_reg(0x5A,0x87); //RegPaDac High Power + + //for(unsigned i = 0; i < 8; i++) { + // kom.tx_buf[i] = i; + //} + //Lora.start_tx(8); + //while (Lora.service() != SERVICE_TX_DONE); + + pc.printf("%s","Test TX\r"); + //for (unsigned i = 0; i < 0x71; i++) { + // pc.printf("%X:%02X\r",i,kom.read_reg(i)); + // wait_ms(10); + // } + + unsigned i=0; while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); + //pc.printf("%s","Test TX\r"); + + + kom.tx_buf[0] = i; + Lora.start_tx(1); + while (Lora.service() != SERVICE_TX_DONE); + i++; + //for(unsigned i = 0; i < 8; i++) kom.tx_buf[i] = 0xa; + //Lora.start_tx(8); + //while (Lora.service() != SERVICE_TX_DONE); + + } }
diff -r e8cd76f38fa9 -r 66f8487ce6a7 mbed.bld --- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ b/mbed.bld Wed Feb 25 13:58:07 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file