NAMote72 Utility Application – Serial Terminal Monitor control for NAMote72 (note: this application replaces the previous na_mote1 test code application)
Dependencies: SX127x lib_gps lib_mma8451q lib_mpl3115a2 lib_sx9500 mbed
Fork of na_mote1 by
See wiki Page for a detailed
This is a link to the wiki page
Diff: main.cpp
- Revision:
- 1:b13a15a34c3f
- Parent:
- 0:9c2b09ecb20f
- Child:
- 2:fb41d1c4b299
diff -r 9c2b09ecb20f -r b13a15a34c3f main.cpp --- a/main.cpp Wed Oct 01 20:41:16 2014 +0000 +++ b/main.cpp Mon Oct 06 18:59:49 2014 +0000 @@ -1,13 +1,21 @@ #include "sx127x_lora.h" #include "sx127x_fsk.h" -/* - * http://mbed.org/handbook/mbed-FRDM-KL25Z - */ +#include "mma8451q.h" +#include "mpl3115a2.h" +#include "sx9500.h" -//DigitalOut green(LED_GREEN); - +/* + * + */ Serial pc(USBTX, USBRX); +DigitalInOut pb8(PB_8); +DigitalInOut pb9(PB_9); +//char _pb8, _pb9; +/*I2C i2c(I2C_SDA, I2C_SCL); +MMA8451Q mma8451q(i2c); +MPL3115A2 mpl3115a2(i2c); +SX9500 sx9500(i2c);*/ uint8_t tx_cnt; char pcbuf[64]; @@ -1289,7 +1297,51 @@ sscanf(pcbuf+2, "%x %x", &i, &len); radio.write_reg(i, len); printf("%02x: %02x\r\n", i, radio.read_reg(i)); - } else if (pcbuf[0] == 'm' && pcbuf[1] == 'p' && !radio.RegOpMode.bits.LongRangeMode) { + } else if (pcbuf[0] == 'b' && pcbuf[1] == '8') { + printf("SCL:"); + switch (pcbuf[2]) { + case '0': + pb8.output(); + pb8 = 0; + printf("lo"); + break; + case '1': + pb8.output(); + pb8 = 1; + printf("hi"); + break; + case 'z': + pb8.input(); + printf("z"); + break; + } + printf("\n"); + } else if (pcbuf[0] == 'b' && pcbuf[1] == '9') { + printf("SDA:"); + switch (pcbuf[2]) { + case '0': + pb9.output(); + pb9 = 0; + printf("lo"); + break; + case '1': + pb9.output(); + pb9 = 1; + printf("hi"); + break; + case 'z': + pb9.input(); + printf("z"); + break; + } + printf("\n"); + } /*else if (pcbuf[0] == 'm' && pcbuf[1] == 'm') { + mma8451q.try_read(); + } else if (pcbuf[0] == 'm' && pcbuf[1] == 'p' && pcbuf[2] == 'l') { + mpl3115a2.try_read(); + } else if (pcbuf[0] == '9' && pcbuf[1] == '5') { + sx9500.try_read(); + } */else if (pcbuf[0] == 'm' && pcbuf[1] == 'p' && !radio.RegOpMode.bits.LongRangeMode) { radio.RegDioMapping2.bits.MapPreambleDetect ^= 1; radio.write_reg(REG_DIOMAPPING2, radio.RegDioMapping2.octet); printf("MapPreambleDetect:"); @@ -1547,3 +1599,11 @@ } // ...while(1) } +/* +GPS, Pressure sensor, touch sensor etc +3-axis accelerometer: MMA8415IQ peripherials/mma8415..c +SX9500 SAR, peripherials/sx9500.c +altimeter & temperature: MPL3115A2. peripherials/mpl3115.c +GPS: NMEA from system/gps.c, boards/LoRaMote/gps-board.c + * +*/