#include #include "basic/basic.h" #include "basic/byteorder.h" #include "lcd/lcd.h" #include "lcd/print.h" #include "funk/nrf24l01p.h" #include "usbcdc/usb.h" #include "usbcdc/usbcore.h" #include "usbcdc/usbhw.h" #include "usbcdc/cdcuser.h" #include "usbcdc/cdc_buf.h" #include "usbcdc/util.h" #include #define REMOTE_CHANNEL 91 #define REMOTE_MAC "REM0T" #define MESH_CHANNEL 85 #define MESH_MAC "MESHB" #define BEACON_CHANNEL 81 #define BEACON_MAC "\x1\x2\x3\x2\1" uint32_t const beaconkey[4] = { 0xB4595344,0xD3E119B6,0xA814D0EC,0xEFF5A24E }; uint32_t remotekey[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; uint32_t meshkey[4] = { 0x0, 0x0, 0x0, 0x0 }; #if CFG_USBMSC #error "MSC is defined" #endif #if !CFG_USBCDC #error "CDC is not defined" #endif /**************************************************************************/ uint32_t thekey[4] = { 0x0, 0x0, 0x0, 0x0 }; struct NRF_CFG config = { .channel= BEACON_CHANNEL, .txmac= BEACON_MAC, .nrmacs=1, .mac0= BEACON_MAC, .maclen ="\x10", }; int process(char * input); #define INPUTLEN 99 void dwim(void){ char input[INPUTLEN+1]; int inputptr=0; char dirty=0; usbCDCInit(); delayms(500); getInputWaitRelease(); puts("D start\r\n"); while(!getInputRaw()){ // Input int l=INPUTLEN-inputptr; CDC_OutBufAvailChar (&l); if(l>0){ dirty=10; if(l>1) dirty=50; CDC_RdOutBuf (input+inputptr, &l); if(input[inputptr]==8){ inputptr=0; puts("\r\n"); continue; }; input[inputptr+l]=0; puts_plus(&input[inputptr]); for(int i=0;i0) dirty--; if(dirty==1) puts(""); }; inputptr+=l; }; puts("D exit\r\n"); } #define BUFLEN 32 #define NYB(x) ((x>'9')?(x|0x20)-'a'+10:x-'0') uint8_t * hextobyte(char * input, int *len){ static uint8_t buf[BUFLEN]; int p=0; int bp=0; char c; while(bp0){ puts_plus("\r\nD Abort.\r\n"); break; }; }; puts("\r\n"); if(pctr--==0) break; }while(t>getTimer()); nrf_rcv_pkt_end(); }else{ puts_plus("D no action\r\n"); }; puts("D done.\r\n"); return 0; };