From: Michael Gernoth Date: Fri, 28 Jun 2013 14:21:48 +0000 (+0200) Subject: rebase against r378 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/fhem-stuff/commitdiff_plain/ce15a4651e73d1e5a0f55c2fe7d073ba8958e653?ds=inline rebase against r378 --- diff --git a/culfw/culfw-asksin-fix.diff b/culfw/culfw-asksin-fix.diff index 19e6598..65dc3bb 100644 --- a/culfw/culfw-asksin-fix.diff +++ b/culfw/culfw-asksin-fix.diff @@ -1,6 +1,6 @@ Index: clib/rf_asksin.c =================================================================== ---- clib/rf_asksin.c (revision 377) +--- clib/rf_asksin.c (revision 378) +++ clib/rf_asksin.c (working copy) @@ -9,15 +9,18 @@ @@ -40,15 +40,8 @@ Index: clib/rf_asksin.c static void rf_asksin_reset_rx(void); void -@@ -68,15 +72,35 @@ - - my_delay_ms(4); - -- ccRX(); -+ // enable RX, but don't enable the interrupt -+ do { -+ ccStrobe(CC1100_SRX); -+ } while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_RX); +@@ -74,12 +78,29 @@ + } while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_RX); } +// Workaround for CC1101 Errata 3 @@ -77,7 +70,7 @@ Index: clib/rf_asksin.c ccStrobe( CC1100_SRX ); } -@@ -87,13 +111,29 @@ +@@ -90,13 +111,29 @@ uint8_t dec[MAX_ASKSIN_MSG]; uint8_t rssi; uint8_t l; @@ -109,7 +102,7 @@ Index: clib/rf_asksin.c if (enc[0] >= MAX_ASKSIN_MSG) { // Something went horribly wrong, out of sync? -@@ -101,6 +141,27 @@ +@@ -104,6 +141,27 @@ return; } @@ -137,7 +130,7 @@ Index: clib/rf_asksin.c CC1100_ASSERT; cc1100_sendbyte( CC1100_READ_BURST | CC1100_RXFIFO ); -@@ -109,12 +170,19 @@ +@@ -112,14 +170,19 @@ } rssi = cc1100_sendbyte( 0 ); @@ -145,7 +138,9 @@ Index: clib/rf_asksin.c CC1100_DEASSERT; -- ccStrobe( CC1100_SRX ); +- do { +- ccStrobe(CC1100_SRX); +- } while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_RX); + // We must not read the last byte from the RX fifo while RX is in progress (Errata 1) + while (((read_cc1100_rxbytes() & 0x7f) < 2) && (cc1100_readReg(CC1100_PKTSTATUS) & (1 << 3))) { + my_delay_ms(1); @@ -159,31 +154,3 @@ Index: clib/rf_asksin.c dec[0] = enc[0]; dec[1] = (~enc[1]) ^ 0x89; -@@ -182,7 +250,11 @@ - - enc[l] = dec[l] ^ dec[2]; - -- ccTX(); -+ // enable TX, wait for CCA -+ while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_TX) { -+ ccStrobe(CC1100_STX); -+ } -+ - if (dec[2] & (1 << 4)) { // BURST-bit set? - // According to ELV, devices get activated every 300ms, so send burst for 360ms - for(l = 0; l < 3; l++) -@@ -209,11 +281,12 @@ - ccStrobe( CC1100_SFTX ); - ccStrobe( CC1100_SIDLE ); - ccStrobe( CC1100_SNOP ); -- ccStrobe( CC1100_SRX ); - } - - if(asksin_on) { -- ccRX(); -+ do { -+ ccStrobe(CC1100_SRX); -+ } while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_RX); - } else { - set_txrestore(); - }