Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@
A Arduino library to control the RTC6715 RichWave 5.8 GHz RX Chip.
This chip is commonly used in Foxtech/Boscam Receiver modules for example the RX5808 which is in turn is used
inside receivers like the RC305 or can be used stand-alone.

Created by Timo Witte

Modified by der-Frickler.net
- Added RSSI Pin and RSSI Reading.

- Added 4x Richwave RX5808 Video Receiver as Example. Attach the 4 RX modules to a video processor:
http://www.banggood.com/de/4-CH-Channel-DVR-CCTV-Quad-Video-Camera-Processor-System-kit-Splitter-Switcher-p-1032225.html
and you get a nice splitscreen view of 4 different FPV Channels:
https://www.youtube.com/watch?v=YXnQFq7hVz4

35 changes: 33 additions & 2 deletions RichWave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ DO WHATEVER YOU WANT PUBLIC LICENSE
Version 1.0:
- initial version
- set Register and setFrequency support

Modified by der-Frickler.net
- Added RSSI Pin and RSSI Reading.

*/

#include "RichWave.h"

// SPIDATA = CS0; SPILE = CS1; SPICLK = CS2
RichWave::RichWave(uint8_t spiDataPin, uint8_t spiLePin, uint8_t spiClkPin)
RichWave::RichWave(uint8_t spiDataPin, uint8_t spiLePin, uint8_t spiClkPin, uint8_t rSSIPin)
{
dataPin = spiDataPin;
lePin = spiLePin;
clkPin = spiClkPin;
rssiPin = rSSIPin;

pinMode(spiDataPin, OUTPUT);
pinMode(spiLePin, OUTPUT);
Expand All @@ -39,6 +44,7 @@ void RichWave::setFrequency(int freq) {
// A Part
int a = (freq%64)/2;
setRegister(0x01, a | (n << 7));
lastTuned = millis();
}

void RichWave::setRegister(byte address, unsigned long data) {
Expand Down Expand Up @@ -68,4 +74,29 @@ void RichWave::sendBit(boolean isOne) {
// generate clock pulse
digitalWrite(clkPin, HIGH);
digitalWrite(clkPin, LOW);
}
}


// ----------------------------------------------------------------------------
// readRSSI read rssi of given module.
// ----------------------------------------------------------------------------
uint16_t RichWave::readRSSI()
{
// check if RSSI is stable after tune by checking the time
uint16_t tune_time = millis() - lastTuned;
// module need >20ms to tune.
if (tune_time < 30)
{
// wait until tune time is full filled
delay(30 - tune_time);
}

uint16_t rssi = 0;
for (uint8_t i = 0; i < 10; i++)
{
rssi += analogRead(rssiPin);
}
rssi = rssi / 10; // average

return rssi;
}
7 changes: 5 additions & 2 deletions RichWave.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
class RichWave
{
public:
RichWave(uint8_t dataPin, uint8_t lePin, uint8_t clkPin);
RichWave(uint8_t dataPin, uint8_t lePin, uint8_t clkPin, uint8_t rssiPin);
void setFrequency(int frequency);
void setRegister(byte address, unsigned long data);
uint16_t readRSSI();
private:
uint8_t dataPin;
uint8_t lePin;
uint8_t clkPin;
uint8_t rssiPin;
uint16_t lastTuned;
void sendBit(boolean isOne);
};

#endif
#endif
Loading