1 Index: clib/rf_asksin.c
2 ===================================================================
3 --- clib/rf_asksin.c (revision 373)
4 +++ clib/rf_asksin.c (working copy)
9 -const uint8_t PROGMEM ASKSIN_CFG[50] = {
10 +const uint8_t PROGMEM ASKSIN_CFG[] = {
18 - 0x17, 0x30, // always go into IDLE
19 + 0x17, 0x3F, // always go into RX, CCA, ELV uses 0x03
39 - for (uint8_t i = 0; i<50; i += 2) {
41 - if (pgm_read_byte( &ASKSIN_CFG[i] )>0x40)
44 + for (uint8_t i = 0; i < sizeof(ASKSIN_CFG); i += 2) {
45 cc1100_writeReg( pgm_read_byte(&ASKSIN_CFG[i]),
46 pgm_read_byte(&ASKSIN_CFG[i+1]) );
49 ccStrobe( CC1100_SCAL );
61 rssi = cc1100_sendbyte( 0 );
62 + /* LQI = */ cc1100_sendbyte( 0 );
66 - ccStrobe( CC1100_SFRX );
67 - ccStrobe( CC1100_SIDLE );
68 - ccStrobe( CC1100_SNOP );
69 - ccStrobe( CC1100_SRX );
72 dec[1] = (~enc[1]) ^ 0x89;
76 dec[l] = enc[l] ^ dec[2];
79 if (tx_report & REP_BINTIME) {
90 - switch (cc1100_readReg( CC1100_MARCSTATE )) {
96 - ccStrobe( CC1100_SFRX );
97 - ccStrobe( CC1100_SIDLE );
98 - ccStrobe( CC1100_SNOP );
99 - ccStrobe( CC1100_SRX );
104 + if (cc1100_readReg( CC1100_MARCSTATE ) == MARCSTATE_RXFIFO_OVERFLOW) {
105 + ccStrobe( CC1100_SFRX );
106 + ccStrobe( CC1100_SIDLE );
107 + ccStrobe( CC1100_SNOP );
108 + ccStrobe( CC1100_SRX );
114 my_delay_ms(3); // 3ms: Found by trial and error
117 - ccStrobe(CC1100_SIDLE);
118 - ccStrobe(CC1100_SFRX );
119 - ccStrobe(CC1100_SFTX );
121 - if (dec[2] & (1 << 4)) { //BURST-bit set?
122 - ccStrobe(CC1100_STX ); //We need to send a burst
124 - //According to ELV, devices get activated every 300ms, so send burst for 360ms
125 - for(l = 0; l < 3; l++)
126 - my_delay_ms(120); //arg is uint_8, so loop
132 enc[1] = (~dec[1]) ^ 0x89;
136 enc[l] = dec[l] ^ dec[2];
139 + if (dec[2] & (1 << 4)) { // BURST-bit set?
140 + // According to ELV, devices get activated every 300ms, so send burst for 360ms
141 + for(l = 0; l < 3; l++)
142 + my_delay_ms(120); // arg is uint_8, so loop
149 cc1100_sendbyte(CC1100_WRITE_BURST | CC1100_TXFIFO);
150 @@ -205,12 +185,17 @@
154 - ccStrobe( CC1100_SFRX );
155 - ccStrobe( CC1100_STX );
156 + // wait for TX to finish
157 + while(cc1100_readReg( CC1100_MARCSTATE ) == MARCSTATE_TX)
160 + if (cc1100_readReg( CC1100_MARCSTATE ) == MARCSTATE_TXFIFO_UNDERFLOW) {
161 + ccStrobe( CC1100_SFTX );
162 + ccStrobe( CC1100_SIDLE );
163 + ccStrobe( CC1100_SNOP );
164 + ccStrobe( CC1100_SRX );
167 - while( cc1100_readReg( CC1100_MARCSTATE ) != 1 )