More serial support
This commit is contained in:
parent
75c5ae71d9
commit
4b95235843
|
@ -0,0 +1,14 @@
|
||||||
|
i: initialize
|
||||||
|
cb / cm / cr: config funk for beacon/mesh/remote
|
||||||
|
Ck<hex>: set encryptionkey
|
||||||
|
Ct<hex>: set txmac
|
||||||
|
Cc<hex>: set channel
|
||||||
|
Ct<hex>: set rxmac(0)
|
||||||
|
|
||||||
|
s <hex>: send packet
|
||||||
|
s+ <hex>: send packet 10 times
|
||||||
|
sd <hex>: send packet with debugoutput
|
||||||
|
|
||||||
|
r: recv packets
|
||||||
|
r+<hex>: recv packets for <hex> seconds
|
||||||
|
r-<hex>: recv <hex> packets (5 seconds max)
|
|
@ -86,7 +86,7 @@ void dwim(void){
|
||||||
input[inputptr+l]=0;
|
input[inputptr+l]=0;
|
||||||
puts_plus(&input[inputptr]);
|
puts_plus(&input[inputptr]);
|
||||||
for(int i=0;i<l;i++){
|
for(int i=0;i<l;i++){
|
||||||
if(input[inputptr+i] =='\r'){
|
if(input[inputptr+i] =='\r' || input[inputptr+i] =='\n'){
|
||||||
input[inputptr+i]=0;
|
input[inputptr+i]=0;
|
||||||
process(input);
|
process(input);
|
||||||
if(i<l)
|
if(i<l)
|
||||||
|
@ -233,24 +233,41 @@ int process(char * input){
|
||||||
__attribute__ ((aligned (4))) uint8_t buf[32];
|
__attribute__ ((aligned (4))) uint8_t buf[32];
|
||||||
int status=0;
|
int status=0;
|
||||||
int len;
|
int len;
|
||||||
if (input[1]==' '){
|
int idx=1;
|
||||||
uint8_t *hex=hextobyte(&input[2],&len);
|
char ctr=1;
|
||||||
if(len<10) len=10;
|
char debug=0;
|
||||||
|
if(input[idx]=='d'){
|
||||||
|
debug=1;
|
||||||
|
idx++;
|
||||||
|
};
|
||||||
|
if(input[idx]=='+'){
|
||||||
|
ctr=10;
|
||||||
|
idx++;
|
||||||
|
};
|
||||||
|
|
||||||
len+=2;
|
if (input[idx]==' '){
|
||||||
puts_plus("S Len:");
|
uint8_t *hex=hextobyte(&input[idx],&len);
|
||||||
puts_plus(IntToStrX( len,2 ));
|
if(len<10) len=10; // minmal packet length?
|
||||||
puts_plus("\r\n");
|
len+=2; // Add crc!
|
||||||
|
|
||||||
status=nrf_snd_pkt_crc_encr(len,hex,thekey);
|
memcpy(buf,hex,len);
|
||||||
|
status=nrf_snd_pkt_crc_encr(len,buf,thekey);
|
||||||
|
|
||||||
puts_plus("P ");
|
puts_plus("P ");
|
||||||
puts_plus("[");puts_plus(IntToStrX(len,2));puts_plus("] ");
|
puts_plus("[");puts_plus(IntToStrX(len,2));puts_plus("] ");
|
||||||
for(int i=0;i<len;i++){
|
if(debug){
|
||||||
puts_plus(IntToStrX( hex[i],2 ));
|
for(int i=0;i<len;i++){
|
||||||
puts_plus(" ");
|
puts_plus(IntToStrX( buf[i],2 ));
|
||||||
|
puts_plus(" ");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
puts("\r\n");
|
||||||
|
|
||||||
|
while(--ctr>0){
|
||||||
|
delayms(23);
|
||||||
|
memcpy(buf,hex,len);
|
||||||
|
status=nrf_snd_pkt_crc_encr(len,buf,thekey);
|
||||||
};
|
};
|
||||||
puts_plus("\r\n");
|
|
||||||
}else if (input[1]=='t'){
|
}else if (input[1]=='t'){
|
||||||
static int ctr=1;
|
static int ctr=1;
|
||||||
int status;
|
int status;
|
||||||
|
|
Loading…
Reference in New Issue