changed init values to match .bas example, modified TX routine to match example from RFM02_code.pdf

master
Andre Frantzke 2014-11-07 08:46:21 +01:00
rodzic 3aad6d2af5
commit bbb6783656
1 zmienionych plików z 25 dodań i 8 usunięć

Wyświetl plik

@ -82,6 +82,17 @@ void RFM02::writeRegister(uint8_t HighByte, uint8_t LowByte) {
void RFM02::configureDeviceSettings() {
writeRegister(0xCC,0x00); // read status
writeRegister(0x93,0x62); // 868MHz Band +/- 90kHz Bandbreite
writeRegister(0xA6,0x86); // 868.35 MHz
//writeRegister(0xD0,0x40); // RATE/2
writeRegister(0xC8,0x11); // 4.8kbps
writeRegister(0xC2,0x20); // Bit Sync active
writeRegister(0xC0,0x01); // disable TX
writeRegister(0xD2,0x40); // PLL 25%
writeRegister(0xB3,0x00); // -9 db
writeRegister(0xE0,0x00); // 'disable wakeup timer
/*
writeRegister(0xCC,0x00); // read status
writeRegister(0x90,0x82); // 868MHz Band +/- 90kHz Bandbreite
writeRegister(0xA6,0x86); // 868.35 MHz
@ -90,7 +101,13 @@ void RFM02::configureDeviceSettings() {
writeRegister(0xC2,0x20); // Bit Sync active
writeRegister(0xB3,0x00); // 0dBm output power
writeRegister(0xC0,0x01); // disable TX
*/
digitalWrite(26, HIGH);
delay(100);
digitalWrite(26, LOW);
digitalWrite(26, HIGH);
delay(100);
digitalWrite(26, LOW);
}
// Data via FSK
@ -117,15 +134,15 @@ uint8_t i=8;
while(i){ // do 8 times..., (any number of bit's will do, also 9 or 121)
i=i-1;
digitalWrite(_pinFSK, LOW); //OUT_PORT_REG &= ~FSK; // first set Bitx as '0'
if( DataByte & BIT7 ) // if not '0' write over with '1'
//OUT_PORT_REG |= FSK; // ...write '1' if most significant bit is '1'
digitalWrite(_pinFSK, HIGH); // ...write '1' if most significant bit is '1'
//while(!(IN_PORT_REG & nIRQ)); // wait for the 0-1-edge of nIRQ, reading in the data
//while(IN_PORT_REG & nIRQ); // wait for 1-0-edge to send the last bit
while(!(digitalRead(_pinNIRQ))); // wait for the 0-1-edge of nIRQ, reading in the data
while((digitalRead(_pinNIRQ))); // wait for the 0-1-edge of nIRQ, reading in the data
while((digitalRead(_pinNIRQ))); // wait for 1-0-edge to send the last bit
if( DataByte & BIT7 ) // if not '0' write over with '1'
digitalWrite(_pinFSK, HIGH); // ...write '1' if most significant bit is '1'
else
digitalWrite(_pinFSK, LOW); //OUT_PORT_REG &= ~FSK; // first set Bitx as '0'
DataByte <<= 1; // shift DataByte one bit left to write the next bit
}
}