Elektronika
/
LORA_RX
RX primer za LORO..
Fork of mbed_blinky by
Revision 7:b2b0bae63f3c, committed 2015-02-25
- Comitter:
- exterminator
- Date:
- Wed Feb 25 13:56:54 2015 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- Initial RX
Changed in this revision
diff -r e8cd76f38fa9 -r b2b0bae63f3c SX127x.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SX127x.lib Wed Feb 25 13:56:54 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/dudmuck/code/SX127x/#c9592cbc9f86
diff -r e8cd76f38fa9 -r b2b0bae63f3c main.cpp --- a/main.cpp Fri May 09 19:58:03 2014 +0300 +++ b/main.cpp Wed Feb 25 13:56:54 2015 +0000 @@ -1,12 +1,46 @@ +#include "sx127x_lora.h" #include "mbed.h" +//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(LED1); +Serial pc(USBTX, USBRX); int main() { + uint8_t data[8]; + 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); + + Lora.start_rx(); + + pc.printf("%s","Test RX\r"); + wait_ms(10); while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + //myled = 1; + //wait(0.2); + //myled = 0; + //wait(0.2); + + while(Lora.service() != SERVICE_READ_FIFO); + //for(unsigned i = 0; i < 8; i++) + //{ + data[0] = kom.rx_buf[0]; + pc.printf("%c",data[0]); + //} + + //for (unsigned i = 0; i < 0x71; i++) { + //pc.printf("%X:%02X\r",i,kom.read_reg(i)); + //wait_ms(10); + //} + Lora.start_rx(); } }
diff -r e8cd76f38fa9 -r b2b0bae63f3c mbed.bld --- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ b/mbed.bld Wed Feb 25 13:56:54 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