From cf5f06b2284e774092a72716f970d322c40655d0 Mon Sep 17 00:00:00 2001 From: schneider Date: Sat, 6 Aug 2011 07:16:03 +0200 Subject: [PATCH] workrarounds in vcard --- firmware/l0dable/recvcard.c | 25 ++++++++++++++++--- firmware/l0dable/sendcard.c | 49 +++++++++++++++++++++++++++++++------ 2 files changed, 64 insertions(+), 10 deletions(-) diff --git a/firmware/l0dable/recvcard.c b/firmware/l0dable/recvcard.c index 3ef7bfb..8e77e21 100644 --- a/firmware/l0dable/recvcard.c +++ b/firmware/l0dable/recvcard.c @@ -34,10 +34,8 @@ uint8_t mac[5] = {1,2,3,2,1}; void ram(void) { - memset(0,0,0); nrf_config_set(&config); - if( sendKeys() ) return; @@ -103,9 +101,15 @@ void sendPublicKey(void) FIL file; if( f_open(&file, "pubx.key", FA_OPEN_EXISTING|FA_READ) ){ + lcdPrint("pubx.key"); + lcdRefresh(); + while(1); return; } if( f_read(&file, buf, 41, &readbytes) || readbytes != 41 ){ + lcdPrint("read x"); + lcdRefresh(); + while(1); return; } f_close(&file); @@ -114,13 +118,22 @@ void sendPublicKey(void) exp[0] = 'P'; bitstr_parse_export((char*)exp+2, buf); exp[1] = 'X'; + nrf_config_set(&config); nrf_snd_pkt_crc(32, exp); delayms(10); if( f_open(&file, "puby.key", FA_OPEN_EXISTING|FA_READ) ){ + lcdPrint("puby.key"); + lcdRefresh(); + while(1); + return; } if( f_read(&file, buf, 41, &readbytes) || readbytes != 41 ){ + lcdPrint("read x"); + lcdRefresh(); + while(1); + return; } f_close(&file); @@ -128,6 +141,7 @@ void sendPublicKey(void) exp[1] = 'Y'; bitstr_parse_export((char*)exp+2, buf); + nrf_config_set(&config); nrf_snd_pkt_crc(32, exp); delayms(10); } @@ -138,10 +152,12 @@ int receiveKey(uint8_t type, uint8_t *x, uint8_t *y) uint8_t buf[32]; uint8_t n; + nrf_config_set(&config); n = nrf_rcv_pkt_time(1000, 32, buf); if( n == 32 && buf[0] == type && buf[1] == 'X' ){ for(int i=0; i> 8; buf[4] = rand & 0xFF; + nrf_config_set(&config); nrf_snd_pkt_crc(32,buf); //setup packet delayms(20); uint16_t index = 0; @@ -282,6 +315,7 @@ void rftransfer_send(uint16_t size, uint8_t *data) buf[i] = *data++; } index++; + nrf_config_set(&config); nrf_snd_pkt_crc(32,buf); //data packet delayms(20); } @@ -291,6 +325,7 @@ void rftransfer_send(uint16_t size, uint8_t *data) buf[2] = crc & 0xFF; buf[3] = rand >> 8; buf[4] = rand & 0xFF; + nrf_config_set(&config); nrf_snd_pkt_crc(32,buf); //setup packet delayms(20); }