From 9d23c476da6243b431918a9481023bb545599254 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Tue, 5 Jul 2011 14:42:12 +0200 Subject: [PATCH] More debugging --- firmware/applications/funk.c | 39 +++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/firmware/applications/funk.c b/firmware/applications/funk.c index e41ec1b..bbd77f0 100644 --- a/firmware/applications/funk.c +++ b/firmware/applications/funk.c @@ -19,7 +19,6 @@ void f_init(void){ #include "core/ssp/ssp.h" void f_status(void){ - int status; int dx=0; int dy=8; uint8_t buf[4]; @@ -31,22 +30,52 @@ void f_status(void){ gpioSetDir(RB_SPI_NRF_CS, gpioDirection_Output); gpioSetPullup(&RB_SPI_NRF_CS_IO, gpioPullupMode_Inactive); - CS_LOW(); + gpioSetDir(RB_NRF_CE, gpioDirection_Output); + gpioSetPullup(&RB_NRF_CE_IO, gpioPullupMode_Inactive); + gpioSetValue(RB_NRF_CE, 0); + +delayms(10); + buf[0]=C_W_REGISTER | R_CONFIG; buf[1]=R_CONFIG_PRIM_RX| R_CONFIG_PWR_UP| R_CONFIG_CRCO; +// buf[0]=C_R_REGISTER | 5; buf[1]=10; +// buf[0]=C_W_REGISTER | R_EN_AA; buf[1]=0x21; buf[2]=0; buf[3]=0; dx=DoString(0,dy,"Snd:"); DoIntX(dx,dy,*(int*)buf);dy+=8; - sspSend(0, (uint8_t*) &buf, 2); - sspReceive(0, &buf, 2); + CS_LOW(); +delayms(10); + sspSend(0, buf, 2); + sspReceive(0, buf, 2); + CS_HIGH(); +delayms(10); dx=DoString(0,dy,"Rcv:"); DoIntX(dx,dy,*(int*)buf);dy+=8; + /* + CS_LOW(); status=nrf_cmd_status(C_NOP); CS_HIGH(); dx=DoString(0,dy,"St:"); DoIntX(dx,dy,status); dy+=8; + */ + + buf[0]=C_R_REGISTER | R_CONFIG; +// buf[0]=C_R_REGISTER | R_EN_AA; + buf[1]=0; + buf[2]=0; + buf[3]=0; + dx=DoString(0,dy,"S2:"); DoIntX(dx,dy,*(int*)buf);dy+=8; + + CS_LOW(); +delayms(10); + sspSend(0, buf, 2); + sspReceive(0, buf, 2); + CS_HIGH(); +delayms(10); + + dx=DoString(0,dy,"R2:"); DoIntX(dx,dy,*(int*)buf);dy+=8; }; void f_recv(void){ @@ -79,8 +108,8 @@ const struct MENU_DEF menu_rcv = {"F Recv", &f_recv}; const struct MENU_DEF menu_nop = {"---", NULL}; static menuentry menu[] = { - &menu_init, &menu_status, + &menu_init, &menu_rcv, &menu_nop, &menu_ISP,