![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
end of integration v.1.0
Fork of pcb_bae_testing_vr1_1_1 by
beacon.cpp@3:0931a8800543, 2015-05-13 (annotated)
- Committer:
- sakthipriya
- Date:
- Wed May 13 06:19:25 2015 +0000
- Revision:
- 3:0931a8800543
- Parent:
- 1:bbddd1763652
end of integration v.1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakthipriya | 0:e91ee0e99213 | 1 | //switch off the sync!!!!!!! |
sakthipriya | 0:e91ee0e99213 | 2 | //switch off the preamble!!!!!!! |
sakthipriya | 0:e91ee0e99213 | 3 | /*for crc in tx: |
sakthipriya | 0:e91ee0e99213 | 4 | regIrq2(0x28) : |
sakthipriya | 0:e91ee0e99213 | 5 | |
sakthipriya | 0:e91ee0e99213 | 6 | regpacketconfig 1(0x37) : |
sakthipriya | 0:e91ee0e99213 | 7 | set crc detection/calc. on : | 0x10 |
sakthipriya | 0:e91ee0e99213 | 8 | crcautoclearoff : | 0x08 |
sakthipriya | 0:e91ee0e99213 | 9 | |
sakthipriya | 0:e91ee0e99213 | 10 | for data whitening : regpacketconfig 1(0x37) :| 0x40 |
sakthipriya | 0:e91ee0e99213 | 11 | for |
sakthipriya | 0:e91ee0e99213 | 12 | |
sakthipriya | 0:e91ee0e99213 | 13 | |
sakthipriya | 0:e91ee0e99213 | 14 | |
sakthipriya | 0:e91ee0e99213 | 15 | */ |
sakthipriya | 0:e91ee0e99213 | 16 | // 6CC000 for 435 MHz |
sakthipriya | 0:e91ee0e99213 | 17 | //set all values as FF for checking on spectrum analyzer |
sakthipriya | 0:e91ee0e99213 | 18 | #include "beacon.h" |
sakthipriya | 0:e91ee0e99213 | 19 | #include "HK.h" |
sakthipriya | 1:bbddd1763652 | 20 | #include "pin_config.h" |
sakthipriya | 0:e91ee0e99213 | 21 | Serial chavan(USBTX, USBRX); // tx, rx |
sakthipriya | 1:bbddd1763652 | 22 | //SPI spi(PIN2,PIN1,PIN3); // mosi, miso, sclk |
sakthipriya | 3:0931a8800543 | 23 | DigitalOut cs(PIN6); //slave select or chip select |
sakthipriya | 3:0931a8800543 | 24 | //SPI spi(PTD6,PTD7,PTD5); // mosi, miso, sclk |
sakthipriya | 3:0931a8800543 | 25 | SPI spi(PIN16,PIN17,PIN15); |
sakthipriya | 1:bbddd1763652 | 26 | //DigitalOut cs_bar(PTC11); //slave select or chip select |
sakthipriya | 0:e91ee0e99213 | 27 | //InterruptIn button(p9); |
sakthipriya | 0:e91ee0e99213 | 28 | //#define TIMES 16 |
sakthipriya | 0:e91ee0e99213 | 29 | //Timer t; |
sakthipriya | 0:e91ee0e99213 | 30 | |
sakthipriya | 0:e91ee0e99213 | 31 | /*void interrupt_func() |
sakthipriya | 0:e91ee0e99213 | 32 | { |
sakthipriya | 0:e91ee0e99213 | 33 | chavan.printf("INTERRUPT_FUNC TRIGGERED\n wait for 3 secs\n"); |
sakthipriya | 0:e91ee0e99213 | 34 | wait(3); |
sakthipriya | 0:e91ee0e99213 | 35 | |
sakthipriya | 0:e91ee0e99213 | 36 | }*/ |
sakthipriya | 0:e91ee0e99213 | 37 | |
sakthipriya | 3:0931a8800543 | 38 | |
sakthipriya | 3:0931a8800543 | 39 | |
sakthipriya | 0:e91ee0e99213 | 40 | extern ShortBeacy Shortbeacon; |
sakthipriya | 3:0931a8800543 | 41 | |
sakthipriya | 0:e91ee0e99213 | 42 | void writereg(uint8_t reg,uint8_t val) |
sakthipriya | 0:e91ee0e99213 | 43 | { |
sakthipriya | 3:0931a8800543 | 44 | cs = 0;__disable_irq();spi.write(reg | 0x80);spi.write(val);__enable_irq();cs = 1; |
sakthipriya | 0:e91ee0e99213 | 45 | } |
sakthipriya | 0:e91ee0e99213 | 46 | uint8_t readreg(uint8_t reg) |
sakthipriya | 0:e91ee0e99213 | 47 | { |
sakthipriya | 3:0931a8800543 | 48 | int val;cs = 0;__disable_irq();spi.write(reg & ~0x80);val = spi.write(0);__enable_irq();cs = 1;return val; |
sakthipriya | 3:0931a8800543 | 49 | } |
sakthipriya | 3:0931a8800543 | 50 | void clearTxBuf() |
sakthipriya | 3:0931a8800543 | 51 | { |
sakthipriya | 3:0931a8800543 | 52 | writereg(RF22_REG_08_OPERATING_MODE2,0x01); |
sakthipriya | 3:0931a8800543 | 53 | writereg(RF22_REG_08_OPERATING_MODE2,0x00); |
sakthipriya | 3:0931a8800543 | 54 | } |
sakthipriya | 3:0931a8800543 | 55 | void clearRxBuf() |
sakthipriya | 3:0931a8800543 | 56 | { |
sakthipriya | 3:0931a8800543 | 57 | writereg(RF22_REG_08_OPERATING_MODE2,0x02); |
sakthipriya | 3:0931a8800543 | 58 | writereg(RF22_REG_08_OPERATING_MODE2,0x00); |
sakthipriya | 3:0931a8800543 | 59 | } |
sakthipriya | 3:0931a8800543 | 60 | int setFrequency(float centre,float afcPullInRange) |
sakthipriya | 3:0931a8800543 | 61 | { |
sakthipriya | 3:0931a8800543 | 62 | //freq setting begins |
sakthipriya | 3:0931a8800543 | 63 | uint8_t fbsel = 0x40; |
sakthipriya | 3:0931a8800543 | 64 | uint8_t afclimiter; |
sakthipriya | 3:0931a8800543 | 65 | if (centre >= 480.0) { |
sakthipriya | 3:0931a8800543 | 66 | centre /= 2; |
sakthipriya | 3:0931a8800543 | 67 | fbsel |= 0x20; |
sakthipriya | 3:0931a8800543 | 68 | afclimiter = afcPullInRange * 1000000.0 / 1250.0; |
sakthipriya | 3:0931a8800543 | 69 | } else { |
sakthipriya | 3:0931a8800543 | 70 | if (afcPullInRange < 0.0 || afcPullInRange > 0.159375) |
sakthipriya | 3:0931a8800543 | 71 | return false; |
sakthipriya | 3:0931a8800543 | 72 | afclimiter = afcPullInRange * 1000000.0 / 625.0; |
sakthipriya | 3:0931a8800543 | 73 | } |
sakthipriya | 3:0931a8800543 | 74 | centre /= 10.0; |
sakthipriya | 3:0931a8800543 | 75 | float integerPart = floor(centre); |
sakthipriya | 3:0931a8800543 | 76 | float fractionalPart = centre - integerPart; |
sakthipriya | 3:0931a8800543 | 77 | |
sakthipriya | 3:0931a8800543 | 78 | uint8_t fb = (uint8_t)integerPart - 24; // Range 0 to 23 |
sakthipriya | 3:0931a8800543 | 79 | fbsel |= fb; |
sakthipriya | 3:0931a8800543 | 80 | uint16_t fc = fractionalPart * 64000; |
sakthipriya | 3:0931a8800543 | 81 | writereg(RF22_REG_73_FREQUENCY_OFFSET1, 0); // REVISIT |
sakthipriya | 3:0931a8800543 | 82 | writereg(RF22_REG_74_FREQUENCY_OFFSET2, 0); |
sakthipriya | 3:0931a8800543 | 83 | writereg(RF22_REG_75_FREQUENCY_BAND_SELECT, fbsel); |
sakthipriya | 3:0931a8800543 | 84 | writereg(RF22_REG_76_NOMINAL_CARRIER_FREQUENCY1, fc >> 8); |
sakthipriya | 3:0931a8800543 | 85 | writereg(RF22_REG_77_NOMINAL_CARRIER_FREQUENCY0, fc & 0xff); |
sakthipriya | 3:0931a8800543 | 86 | writereg(RF22_REG_2A_AFC_LIMITER, afclimiter); |
sakthipriya | 3:0931a8800543 | 87 | return 0; |
sakthipriya | 0:e91ee0e99213 | 88 | } |
sakthipriya | 3:0931a8800543 | 89 | |
sakthipriya | 3:0931a8800543 | 90 | |
sakthipriya | 3:0931a8800543 | 91 | |
sakthipriya | 3:0931a8800543 | 92 | void init_beacon() |
sakthipriya | 3:0931a8800543 | 93 | { |
sakthipriya | 3:0931a8800543 | 94 | //reset() |
sakthipriya | 3:0931a8800543 | 95 | writereg(RF22_REG_07_OPERATING_MODE1,0x80); //sw_reset |
sakthipriya | 3:0931a8800543 | 96 | wait(1); //takes time to reset |
sakthipriya | 3:0931a8800543 | 97 | |
sakthipriya | 3:0931a8800543 | 98 | clearTxBuf(); |
sakthipriya | 3:0931a8800543 | 99 | clearRxBuf(); |
sakthipriya | 3:0931a8800543 | 100 | //txfifoalmostempty |
sakthipriya | 3:0931a8800543 | 101 | writereg(RF22_REG_7D_TX_FIFO_CONTROL2,5); |
sakthipriya | 3:0931a8800543 | 102 | //rxfifoalmostfull |
sakthipriya | 3:0931a8800543 | 103 | writereg(RF22_REG_7E_RX_FIFO_CONTROL,20); |
sakthipriya | 3:0931a8800543 | 104 | //Packet-engine registers |
sakthipriya | 3:0931a8800543 | 105 | writereg(RF22_REG_30_DATA_ACCESS_CONTROL,0x8E); //RF22_REG_30_DATA_ACCESS_CONTROL, RF22_ENPACRX | RF22_ENPACTX | RF22_ENCRC | RF22_CRC_CRC_16_IBM |
sakthipriya | 3:0931a8800543 | 106 | //&0x77 = diasable packet rx-tx handling |
sakthipriya | 3:0931a8800543 | 107 | writereg(RF22_REG_32_HEADER_CONTROL1,0x88); //RF22_REG_32_HEADER_CONTROL1, RF22_BCEN_HEADER3 | RF22_HDCH_HEADER3 |
sakthipriya | 3:0931a8800543 | 108 | writereg(RF22_REG_33_HEADER_CONTROL2,0x42); //RF22_REG_33_HEADER_CONTROL2, RF22_HDLEN_4 | RF22_SYNCLEN_2 |
sakthipriya | 3:0931a8800543 | 109 | writereg(RF22_REG_34_PREAMBLE_LENGTH,8); //RF22_REG_34_PREAMBLE_LENGTH, nibbles); preamble length = 8; |
sakthipriya | 3:0931a8800543 | 110 | writereg(RF22_REG_36_SYNC_WORD3,0x2D); //syncword3=2D |
sakthipriya | 3:0931a8800543 | 111 | writereg(RF22_REG_37_SYNC_WORD2,0xD4); //syncword2=D4 |
sakthipriya | 3:0931a8800543 | 112 | writereg(RF22_REG_3F_CHECK_HEADER3,0); //RF22_REG_3F_CHECK_HEADER3, RF22_DEFAULT_NODE_ADDRESS |
sakthipriya | 3:0931a8800543 | 113 | writereg(RF22_REG_3A_TRANSMIT_HEADER3,0xab); //header_to |
sakthipriya | 3:0931a8800543 | 114 | writereg(RF22_REG_3B_TRANSMIT_HEADER2,0xbc); //header_from |
sakthipriya | 3:0931a8800543 | 115 | writereg(RF22_REG_3C_TRANSMIT_HEADER1,0xcd); //header_ids |
sakthipriya | 3:0931a8800543 | 116 | writereg(RF22_REG_3D_TRANSMIT_HEADER0,0xde); //header_flags |
sakthipriya | 3:0931a8800543 | 117 | writereg(RF22_REG_3F_CHECK_HEADER3,0xab); |
sakthipriya | 3:0931a8800543 | 118 | writereg(RF22_REG_40_CHECK_HEADER2,0xbc); |
sakthipriya | 3:0931a8800543 | 119 | writereg(RF22_REG_41_CHECK_HEADER1,0xcd); |
sakthipriya | 3:0931a8800543 | 120 | writereg(RF22_REG_42_CHECK_HEADER0,0xde); |
sakthipriya | 3:0931a8800543 | 121 | |
sakthipriya | 3:0931a8800543 | 122 | //RSSI threshold for clear channel indicator |
sakthipriya | 3:0931a8800543 | 123 | writereg(RF22_REG_27_RSSI_THRESHOLD,0xA5); //55 for -80dBm, 2D for -100dBm, 7D for -60dBm, A5 for -40dBm, CD for -20 dBm |
sakthipriya | 3:0931a8800543 | 124 | |
sakthipriya | 3:0931a8800543 | 125 | writereg(RF22_REG_0B_GPIO_CONFIGURATION0,0x15); // TX state ?? |
sakthipriya | 3:0931a8800543 | 126 | writereg(RF22_REG_0C_GPIO_CONFIGURATION1,0x12); // RX state ?? |
sakthipriya | 3:0931a8800543 | 127 | |
sakthipriya | 3:0931a8800543 | 128 | //interrupts |
sakthipriya | 3:0931a8800543 | 129 | // spiWrite(RF22_REG_05_INTERRUPT_ENABLE1, RF22_ENTXFFAEM |RF22_ENRXFFAFULL | RF22_ENPKSENT |RF22_ENPKVALID| RF22_ENCRCERROR); |
sakthipriya | 3:0931a8800543 | 130 | // spiWrite(RF22_REG_06_INTERRUPT_ENABLE2, RF22_ENPREAVAL); |
sakthipriya | 3:0931a8800543 | 131 | |
sakthipriya | 3:0931a8800543 | 132 | setFrequency(435.0, 0.05); |
sakthipriya | 0:e91ee0e99213 | 133 | |
sakthipriya | 3:0931a8800543 | 134 | //return !(statusRead() & RF22_FREQERR); |
sakthipriya | 3:0931a8800543 | 135 | if((readreg(RF22_REG_02_DEVICE_STATUS)& 0x08)!= 0x00) |
sakthipriya | 3:0931a8800543 | 136 | printf("frequency not set properly\n"); |
sakthipriya | 3:0931a8800543 | 137 | //frequency set |
sakthipriya | 3:0931a8800543 | 138 | |
sakthipriya | 3:0931a8800543 | 139 | //setModemConfig(FSK_Rb2_4Fd36); FSK_Rb2_4Fd36, ///< FSK, No Manchester, Rb = 2.4kbs, Fd = 36kHz |
sakthipriya | 3:0931a8800543 | 140 | //setmodemregisters |
sakthipriya | 3:0931a8800543 | 141 | //0x1b, 0x03, 0x41, 0x60, 0x27, 0x52, 0x00, 0x07, 0x40, 0x0a, 0x1e, 0x80, 0x60, 0x13, 0xa9, 0x2c, 0x22, 0x3a = FSK_RB2_4FD36 |
sakthipriya | 3:0931a8800543 | 142 | //0xc8, 0x03, 0x39, 0x20, 0x68, 0xdc, 0x00, 0x6b, 0x2a, 0x08, 0x2a, 0x80, 0x60, 0x13, 0xa9, 0x2c, 0x21, 0x08 = OOK,2.4, 335 |
sakthipriya | 3:0931a8800543 | 143 | writereg(RF22_REG_1C_IF_FILTER_BANDWIDTH,0x2B); |
sakthipriya | 3:0931a8800543 | 144 | writereg(RF22_REG_1F_CLOCK_RECOVERY_GEARSHIFT_OVERRIDE,0x03); |
sakthipriya | 3:0931a8800543 | 145 | writereg(RF22_REG_20_CLOCK_RECOVERY_OVERSAMPLING_RATE,0x41); |
sakthipriya | 3:0931a8800543 | 146 | writereg(RF22_REG_21_CLOCK_RECOVERY_OFFSET2,0x60); |
sakthipriya | 3:0931a8800543 | 147 | writereg(RF22_REG_22_CLOCK_RECOVERY_OFFSET1,0x27); //updated 20 to 25 reg values from excel sheet for 1.2 Khz freq. deviation,fsk |
sakthipriya | 3:0931a8800543 | 148 | writereg(RF22_REG_23_CLOCK_RECOVERY_OFFSET0,0x52); |
sakthipriya | 3:0931a8800543 | 149 | writereg(RF22_REG_24_CLOCK_RECOVERY_TIMING_LOOP_GAIN1,0x00); |
sakthipriya | 3:0931a8800543 | 150 | writereg(RF22_REG_25_CLOCK_RECOVERY_TIMING_LOOP_GAIN0,0x51); |
sakthipriya | 3:0931a8800543 | 151 | /*writereg(RF22_REG_2C_OOK_COUNTER_VALUE_1,0x2a); |
sakthipriya | 3:0931a8800543 | 152 | writereg(RF22_REG_2D_OOK_COUNTER_VALUE_2,0x08);*/ //not required for fsk (OOK counter value) |
sakthipriya | 3:0931a8800543 | 153 | writereg(RF22_REG_2E_SLICER_PEAK_HOLD,0x1e); //?? |
sakthipriya | 3:0931a8800543 | 154 | writereg(RF22_REG_58,0x80); |
sakthipriya | 3:0931a8800543 | 155 | writereg(RF22_REG_69_AGC_OVERRIDE1,0x60); |
sakthipriya | 3:0931a8800543 | 156 | writereg(RF22_REG_6E_TX_DATA_RATE1,0x09); |
sakthipriya | 3:0931a8800543 | 157 | writereg(RF22_REG_6F_TX_DATA_RATE0,0xd5); |
sakthipriya | 3:0931a8800543 | 158 | writereg(RF22_REG_70_MODULATION_CONTROL1,0x2c); |
sakthipriya | 3:0931a8800543 | 159 | writereg(RF22_REG_71_MODULATION_CONTROL2,0x22);//ook = 0x21 //fsk = 0x22 |
sakthipriya | 3:0931a8800543 | 160 | writereg(RF22_REG_72_FREQUENCY_DEVIATION,0x02); |
sakthipriya | 3:0931a8800543 | 161 | //set tx power |
sakthipriya | 3:0931a8800543 | 162 | writereg(RF22_REG_6D_TX_POWER,0x07); //20dbm |
sakthipriya | 3:0931a8800543 | 163 | writereg(RF22_REG_3E_PACKET_LENGTH,TX_DATA); //packet length |
sakthipriya | 3:0931a8800543 | 164 | } |
sakthipriya | 3:0931a8800543 | 165 | |
sakthipriya | 3:0931a8800543 | 166 | void FUNC_BEA() |
sakthipriya | 3:0931a8800543 | 167 | { |
sakthipriya | 3:0931a8800543 | 168 | init_beacon(); |
sakthipriya | 3:0931a8800543 | 169 | printf("\nBeacon function entered\n"); |
sakthipriya | 3:0931a8800543 | 170 | wait(1); // wait for POR to complete //change the timing later |
sakthipriya | 3:0931a8800543 | 171 | cs=1; // chip must be deselected |
sakthipriya | 3:0931a8800543 | 172 | wait(1); //change the time later |
sakthipriya | 3:0931a8800543 | 173 | spi.format(8,0); |
sakthipriya | 3:0931a8800543 | 174 | spi.frequency(10000000); //10MHz SCLK |
sakthipriya | 3:0931a8800543 | 175 | if (readreg(RF22_REG_00_DEVICE_TYPE) == 0x08) printf("spi connection valid\n"); |
sakthipriya | 3:0931a8800543 | 176 | else printf("error in spi connection\n"); |
sakthipriya | 3:0931a8800543 | 177 | |
sakthipriya | 3:0931a8800543 | 178 | |
sakthipriya | 3:0931a8800543 | 179 | |
sakthipriya | 3:0931a8800543 | 180 | //******** |
sakthipriya | 0:e91ee0e99213 | 181 | //button.rise(&interrupt_func); //interrupt enabled ( rising edge of pin 9) |
sakthipriya | 3:0931a8800543 | 182 | wait(0.02); // pl. update this value or even avoid it!!! |
sakthipriya | 3:0931a8800543 | 183 | //extract values from short_beacon[] |
sakthipriya | 0:e91ee0e99213 | 184 | uint8_t byte_counter = 0; |
sakthipriya | 0:e91ee0e99213 | 185 | /*struct Short_beacon{ |
sakthipriya | 0:e91ee0e99213 | 186 | uint8_t Voltage[1]; |
sakthipriya | 0:e91ee0e99213 | 187 | uint8_t AngularSpeed[2]; |
sakthipriya | 0:e91ee0e99213 | 188 | uint8_t SubsystemStatus[1]; |
sakthipriya | 0:e91ee0e99213 | 189 | uint8_t Temp[3]; |
sakthipriya | 0:e91ee0e99213 | 190 | uint8_t ErrorFlag[1]; |
sakthipriya | 3:0931a8800543 | 191 | }Shortbeacon = { {0x88}, {0x99, 0xAA} , {0xAA},{0xAA,0xDD,0xEE}, {0x00} }; |
sakthipriya | 0:e91ee0e99213 | 192 | */ |
sakthipriya | 0:e91ee0e99213 | 193 | //filling hk data |
sakthipriya | 0:e91ee0e99213 | 194 | uint8_t short_beacon[] = { 0xAB, 0x8A, 0xE2, 0xBB, 0xB8, 0xA2, 0x8E,Shortbeacon.Voltage[0],Shortbeacon.AngularSpeed[0], Shortbeacon.AngularSpeed[1],Shortbeacon.SubsystemStatus[0],Shortbeacon.Temp[0],Shortbeacon.Temp[1],Shortbeacon.Temp[2],Shortbeacon.ErrorFlag[0]}; |
sakthipriya | 0:e91ee0e99213 | 195 | |
sakthipriya | 0:e91ee0e99213 | 196 | for(int i = 0; i < 15 ; i++) |
sakthipriya | 0:e91ee0e99213 | 197 | { |
sakthipriya | 3:0931a8800543 | 198 | printf("0x%X\n",(short_beacon[i])); |
sakthipriya | 0:e91ee0e99213 | 199 | } |
sakthipriya | 3:0931a8800543 | 200 | //tx settings begin |
sakthipriya | 3:0931a8800543 | 201 | //setModeIdle(); |
sakthipriya | 3:0931a8800543 | 202 | writereg(RF22_REG_07_OPERATING_MODE1,0x01); //ready mode |
sakthipriya | 3:0931a8800543 | 203 | //fillTxBuf(data, len); |
sakthipriya | 3:0931a8800543 | 204 | clearTxBuf(); |
sakthipriya | 0:e91ee0e99213 | 205 | |
sakthipriya | 0:e91ee0e99213 | 206 | //Set to Tx mode |
sakthipriya | 3:0931a8800543 | 207 | writereg(RF22_REG_07_OPERATING_MODE1,0x09); |
sakthipriya | 0:e91ee0e99213 | 208 | |
sakthipriya | 3:0931a8800543 | 209 | while(byte_counter!=15){ |
sakthipriya | 0:e91ee0e99213 | 210 | //Check for fifoThresh |
sakthipriya | 3:0931a8800543 | 211 | while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) != 0x20); |
sakthipriya | 0:e91ee0e99213 | 212 | //writing again |
sakthipriya | 3:0931a8800543 | 213 | cs = 0; |
sakthipriya | 3:0931a8800543 | 214 | spi.write(0xFF); |
sakthipriya | 0:e91ee0e99213 | 215 | for(int i=7; i>=0 ;i--) |
sakthipriya | 0:e91ee0e99213 | 216 | { |
sakthipriya | 3:0931a8800543 | 217 | //pc.printf("%d\n",byte_counter); |
sakthipriya | 0:e91ee0e99213 | 218 | if((short_beacon[byte_counter] & (uint8_t) pow(2.0,i))!=0) |
sakthipriya | 0:e91ee0e99213 | 219 | { |
sakthipriya | 0:e91ee0e99213 | 220 | spi.write(0xFF); |
sakthipriya | 0:e91ee0e99213 | 221 | spi.write(0xFF); |
sakthipriya | 0:e91ee0e99213 | 222 | } |
sakthipriya | 0:e91ee0e99213 | 223 | else |
sakthipriya | 0:e91ee0e99213 | 224 | { |
sakthipriya | 0:e91ee0e99213 | 225 | spi.write(0x00); |
sakthipriya | 0:e91ee0e99213 | 226 | spi.write(0x00); |
sakthipriya | 3:0931a8800543 | 227 | |
sakthipriya | 0:e91ee0e99213 | 228 | } |
sakthipriya | 0:e91ee0e99213 | 229 | } |
sakthipriya | 3:0931a8800543 | 230 | cs = 1; |
sakthipriya | 0:e91ee0e99213 | 231 | byte_counter++; |
sakthipriya | 3:0931a8800543 | 232 | |
sakthipriya | 3:0931a8800543 | 233 | } |
sakthipriya | 3:0931a8800543 | 234 | //rf22.waitPacketSent(); |
sakthipriya | 3:0931a8800543 | 235 | while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) != 0x04);//pc.printf(" chck pkt sent!\n"); |
sakthipriya | 3:0931a8800543 | 236 | printf("\nBeacon function exiting\n"); |
sakthipriya | 0:e91ee0e99213 | 237 | |
sakthipriya | 3:0931a8800543 | 238 | } |