Merge branch 'master' of github.com:r0ket/r0ket

This commit is contained in:
schneider 2011-07-18 01:17:44 +02:00
commit 2d4e1163d0
8 changed files with 12 additions and 32 deletions

View File

@ -90,8 +90,6 @@ void main_executor(void) {
int yctr=8; int yctr=8;
int dx=0; int dx=0;
font_direction = FONT_DIR_LTR; // LeftToRight is the default
yctr=18; yctr=18;
uint8_t trigger; uint8_t trigger;

View File

@ -19,8 +19,6 @@ void main_sec(void) {
int yctr=8; int yctr=8;
int dx=0; int dx=0;
font_direction = FONT_DIR_LTR; // LeftToRight is the default
yctr=18; yctr=18;
uint8_t trigger; uint8_t trigger;

View File

@ -238,7 +238,7 @@ void sspInit (uint8_t portNum, sspClockPolarity_t polarity, sspClockPhase_t phas
Block length of the data buffer Block length of the data buffer
*/ */
/**************************************************************************/ /**************************************************************************/
void sspSend (uint8_t portNum, uint8_t *buf, uint32_t length) void sspSend (uint8_t portNum, const uint8_t *buf, uint32_t length)
{ {
uint32_t i; uint32_t i;
uint8_t Dummy = Dummy; uint8_t Dummy = Dummy;

View File

@ -79,7 +79,7 @@ sspClockPhase_t;
extern void SSP_IRQHandler (void); extern void SSP_IRQHandler (void);
void sspInit (uint8_t portNum, sspClockPolarity_t polarity, sspClockPhase_t phase); void sspInit (uint8_t portNum, sspClockPolarity_t polarity, sspClockPhase_t phase);
void sspSend (uint8_t portNum, uint8_t *buf, uint32_t length); void sspSend (uint8_t portNum, const uint8_t *buf, uint32_t length);
void sspReceive (uint8_t portNum, uint8_t *buf, uint32_t length); void sspReceive (uint8_t portNum, uint8_t *buf, uint32_t length);
void sspSendReceive(uint8_t portNum, uint8_t *buf, uint32_t length); void sspSendReceive(uint8_t portNum, uint8_t *buf, uint32_t length);
#endif #endif

View File

@ -2,8 +2,10 @@
#include "nrf24l01p.h" #include "nrf24l01p.h"
#include "filetransfer.h" #include "filetransfer.h"
#include "rftransfer.h" #include "rftransfer.h"
#include "basic/basic.h"
#include "basic/xxtea.h" #include "basic/xxtea.h"
#include "filesystem/ff.h" #include "filesystem/ff.h"
#include "lcd/print.h"
//TODO: use a proper MAC to sign the message //TODO: use a proper MAC to sign the message
@ -53,25 +55,6 @@ int filetransfer_send(uint8_t *filename, uint16_t size,
return 0; return 0;
} }
void put_rc_y (FRESULT rc, int y) {
const TCHAR *p =
_T("OK\0DISK_ERR\0INT_ERR\0NOT_READY\0NO_FILE\0NO_PATH\0INVALID_NAME\0")
_T("DENIED\0EXIST\0INVALID_OBJECT\0WRITE_PROTECTED\0INVALID_DRIVE\0")
_T("NOT_ENABLED\0NO_FILE_SYSTEM\0MKFS_ABORTED\0TIMEOUT\0LOCKED\0")
_T("NOT_ENOUGH_CORE\0TOO_MANY_OPEN_FILES\0");
FRESULT i;
for (i = 0; i != rc && *p; i++) {
while(*p++) ;
}
DoString(0,y,p);
}
void put_rc (FRESULT rc){
put_rc_y(rc,0);
};
int filetransfer_receive(uint8_t *mac, uint32_t const k[4]) int filetransfer_receive(uint8_t *mac, uint32_t const k[4])
{ {
uint8_t buf[MAXSIZE+1]; uint8_t buf[MAXSIZE+1];
@ -100,7 +83,7 @@ int filetransfer_receive(uint8_t *mac, uint32_t const k[4])
res = f_open(&file, (const char*)metadata, FA_OPEN_ALWAYS|FA_WRITE); res = f_open(&file, (const char*)metadata, FA_OPEN_ALWAYS|FA_WRITE);
//lcdPrintln("file opened"); lcdRefresh(); //lcdPrintln("file opened"); lcdRefresh();
if( res ) {lcdPrintln("res"); put_rc(res); lcdRefresh(); while(1);} if( res ) {lcdPrintln("res"); lcdPrint(f_get_rc_string(res)); lcdRefresh(); while(1);}
if( res ) if( res )
return res; return res;

View File

@ -81,7 +81,7 @@ void nrf_read_pkt_crc(int len, uint8_t* data, uint8_t* crc){
CS_HIGH(); CS_HIGH();
}; };
void nrf_write_long(const uint8_t cmd, int len, uint8_t* data){ void nrf_write_long(const uint8_t cmd, int len, const uint8_t* data){
CS_LOW(); CS_LOW();
xmit_spi(cmd); xmit_spi(cmd);
sspSend(0,data,len); sspSend(0,data,len);
@ -185,7 +185,7 @@ char nrf_snd_pkt_crc_encr(int size, uint8_t * pkt, uint32_t const key[4]){
return nrf_cmd_status(C_NOP); return nrf_cmd_status(C_NOP);
}; };
void nrf_set_rx_mac(int pipe, int rxlen, int maclen, uint8_t * mac){ void nrf_set_rx_mac(int pipe, int rxlen, int maclen, const uint8_t * mac){
#ifdef SAFE #ifdef SAFE
assert(maclen>=1 || maclen<=5); assert(maclen>=1 || maclen<=5);
assert(rxlen>=1 || rxlen<=32); assert(rxlen>=1 || rxlen<=32);
@ -202,7 +202,7 @@ void nrf_set_rx_mac(int pipe, int rxlen, int maclen, uint8_t * mac){
); );
}; };
void nrf_set_tx_mac(int maclen, uint8_t * mac){ void nrf_set_tx_mac(int maclen, const uint8_t * mac){
#ifdef SAFE #ifdef SAFE
assert(maclen>=1 || maclen<=5); assert(maclen>=1 || maclen<=5);
assert(mac!=NULL); assert(mac!=NULL);

View File

@ -145,10 +145,10 @@ void nrf_cmd_rw_long(uint8_t* data, int len);
void nrf_read_long(const uint8_t reg, int len, uint8_t* data); void nrf_read_long(const uint8_t reg, int len, uint8_t* data);
void nrf_write_reg(const uint8_t reg, const uint8_t val); void nrf_write_reg(const uint8_t reg, const uint8_t val);
uint8_t nrf_read_reg(const uint8_t reg); uint8_t nrf_read_reg(const uint8_t reg);
void nrf_write_reg_long(const uint8_t reg, int len, uint8_t* data); void nrf_write_long(const uint8_t cmd, int len, const uint8_t* data);
void nrf_set_rx_mac(int pipe, int rxlen, int maclen, uint8_t * mac); void nrf_set_rx_mac(int pipe, int rxlen, int maclen, const uint8_t * mac);
void nrf_set_tx_mac(int maclen, uint8_t * mac); void nrf_set_tx_mac(int maclen, const uint8_t * mac);
void nrf_disable_pipe(int pipe); void nrf_disable_pipe(int pipe);
void nrf_set_channel(int channel); void nrf_set_channel(int channel);

View File

@ -2,6 +2,7 @@
#include "nrf24l01p.h" #include "nrf24l01p.h"
#include <basic/basic.h> #include <basic/basic.h>
#include <core/systick/systick.h> #include <core/systick/systick.h>
#include <lcd/print.h>
#define MAXPACKET 32 #define MAXPACKET 32
void rftransfer_send(uint16_t size, uint8_t *data) void rftransfer_send(uint16_t size, uint8_t *data)