DRA818 VHF or UHF radio module library. http://www.dorji.com/docs/data/DRA818V.pdf


23 months ago

File content as of revision 3:b822fbac58f4:

// Lib for http://www.dorji.com/docs/data/DRA818V.pdf
#include "mbed.h"
#include "dra818.h"
#define PTT     PB_4    // PTT pin. This is active low.
#define PD      PB_5    // Power Down pin. This need to start low, then be set high before programming.
#define DRA_TXD PA_9
#define DRA_RXD PA_10
Serial dra_serial(DRA_TXD,  DRA_RXD);
DRA818 dra(&dra_serial, PTT);
DigitalOut PowerDown=(PD);
DigitalOut PushToTalk=(PTT);
int main() {
    PowerDown=1; // PD is Active HIGH, so this turns the DRA818 on.
    // The following functions are not instantaneously set, you need to call writeFreq to program them after a PowerDown.
    dra.setGWB(0); // Channels space. 0 = 12.5k  1 = 25k
    dra.setTXFreq(146.525); // TX Frequency
    dra.setRXFreq(146.525); // RX Freqency
    dra.setTXCTCSS(0); // 9 = 91.5 Hz, See https://en.wikipedia.org/wiki/CTCSS for a list.
    dra.setSquelch(3);  // Squelch level 3.
    dra.setRXCTCSS(0); // No CTCSS on RX.
    dra.writeFreq(); // Write out frequency settings to the DRA module.
    // These functions are instantaneously written to the DRA module.
    dra.setVolume(4); // Set output volume to '4'.  
    dra.setFilters(true, true, true); // Sets all filters (Pre/De-Emphasis, High-Pass, Low-Pass) on.
    while(1) {
        PushToTalk = 0; // PTT is Active low, so this turns the PTT on.
        PushToTalk = 1;