CaryCoders
/
demo_SX1276_standalone
standalone sx1276 demo program
Fork of SX1276_GPS by
utilities.cpp
- Committer:
- ftagius
- Date:
- 2015-06-16
- Revision:
- 29:0ea07cc7124b
- Child:
- 31:2c813f321db7
File content as of revision 29:0ea07cc7124b:
#include "mbed.h" #include "sx1276-hal.h" #include "main.h" #include "debug.h" #include "vt100.h" #include "serial_api.h" int get_kbd_str(char* buf, int size) { char c; int i; static int prev_len; for (i = 0;;) { if (pc.readable()) { c = pc.getc(); if (c == 8 && i > 0) { pc.putc(8); pc.putc(' '); pc.putc(8); i--; } else if (c == '\r') { if (i == 0) { if (app == APP_CHAT) return 0; else return prev_len; // repeat previous } else { buf[i] = 0; // null terminate prev_len = i; return i; } } else if (c == 3) { // ctrl-C abort return -1; } else if (i < size) { buf[i++] = c; pc.putc(c); } } else { if (app == APP_PING) ping_pong(); if (app == APP_HELLO) hello(); if (app == APP_GPS) check_gps(); #if 1 if (app == APP_CHAT) { // printf("utility call to console chat\r\n"); check_rx_chat(); } #endif } } // ...for() }