Author: jaguarondi
Date: 2008-07-17 15:52:34 +0200 (Thu, 17 Jul 2008)
New Revision: 1334
Modified:
firmware/rf/trunk/main.c
firmware/rf/trunk/prot.c
firmware/rf/trunk/rf_ctrl.c
firmware/rf/trunk/varis.c
firmware/rf/trunk/varis.h
Log:
* Better separation of master and slave with definitions.
Modified: firmware/rf/trunk/main.c
===================================================================
--- firmware/rf/trunk/main.c 2008-07-17 13:52:10 UTC (rev 1333)
+++ firmware/rf/trunk/main.c 2008-07-17 13:52:34 UTC (rev 1334)
@@ -74,7 +74,7 @@
*/
int main(void)
{
-#ifdef _SLAVE
+#if defined(_SLAVE)
volatile uint16_t _count=0;
/* Wait for the head button signal to rise if it isn't pressed. */
for (;_count<0xFFFF; _count++);
Modified: firmware/rf/trunk/prot.c
===================================================================
--- firmware/rf/trunk/prot.c 2008-07-17 13:52:10 UTC (rev 1333)
+++ firmware/rf/trunk/prot.c 2008-07-17 13:52:34 UTC (rev 1334)
@@ -118,9 +118,7 @@
if(rf_rx_state==0xFF){//something received
if(checksum==0x00){//correct received
//pwr_dwn_atr2406();
-
rf_rx_state = 0x00;
- rf_status |= SLAVE;
j = TCNT1;
/* XXX have to change this so ts isn't global
anymore */
@@ -129,7 +127,6 @@
j = j << 3;
OCR1A = T_SYNC - j;
start_rf_timer();
-
return;
}
}
@@ -141,7 +138,6 @@
#endif
/* MASTER mode. */
- rf_status |= MASTER;
pwr_dwn_atr2406();
pwr_up_atr2406();
start_rf_timer();
Modified: firmware/rf/trunk/rf_ctrl.c
===================================================================
--- firmware/rf/trunk/rf_ctrl.c 2008-07-17 13:52:10 UTC (rev 1333)
+++ firmware/rf/trunk/rf_ctrl.c 2008-07-17 13:52:34 UTC (rev 1334)
@@ -224,19 +224,11 @@
rf_buffer_rx = rf_buffer_rx_full;
rf_buffer_rx_full = p;
}
-
- if (rf_status & SLAVE)
- /* SLAVE, resynchronized already. */
- {
- //OCR1A = ts + T_SYNC - T_LATENCY;
- }
- else
- /* MASTER */
- {
- OCR1A = OCR1A + T_PWR_DWN;
- }
}
+#if defined(_SLAVE)
+ /* If slave, synchronisation occurs when a frame is received. */
else
+#endif
/* Wrong frame, just continue. */
{
OCR1A = OCR1A + T_PWR_DWN;
@@ -248,14 +240,12 @@
//PORTD ^= 0x08; // XXX DEBUG
}
-volatile uint16_t testt = T_HEADER;
/*
* Setup 16 bit timer1 which is used to generate all RF related timings.
* We're using a crystal @ sys_clk = 13.824 MHz
*/
void start_rf_timer(void)
{
- testt = T_PWR_DWN;
TCNT1H = 0x00;
TCNT1L = 0x00;
TCCR1A = 0x00;
Modified: firmware/rf/trunk/varis.c
===================================================================
--- firmware/rf/trunk/varis.c 2008-07-17 13:52:10 UTC (rev 1333)
+++ firmware/rf/trunk/varis.c 2008-07-17 13:52:34 UTC (rev 1334)
@@ -73,8 +73,6 @@
-volatile uint8_t rf_status;
-//Satus of the RF - Task (Locked or Unlocked)
volatile uint8_t channel;
//Currently used RF - Channel
uint8_t channel_width;
Modified: firmware/rf/trunk/varis.h
===================================================================
--- firmware/rf/trunk/varis.h 2008-07-17 13:52:10 UTC (rev 1333)
+++ firmware/rf/trunk/varis.h 2008-07-17 13:52:34 UTC (rev 1334)
@@ -52,7 +52,6 @@
extern uint8_t volatile *rf_buffer_rx;
extern uint8_t volatile *rf_buffer_rx_full;
extern uint8_t sof_ary[];
-extern volatile uint8_t rf_status;
extern volatile uint8_t channel;
extern uint8_t channel_width;
extern volatile uint8_t tx_pac_len;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn