static int rx2_spi_handler;
+#define HANDLER_STEADY_TIME_US 5000
+void setup_handler(int pin, gpioAlertFunc_t pAlert) {
+ gpioSetMode(pin, PI_INPUT);
+ gpioSetPullUpDown(pin,PI_PUD_UP);
+ // give time to settle to avoid false triggers
+ usleep(10000);
+ gpioSetAlertFunc(pin, pAlert);
+ gpioGlitchFilter(pin, HANDLER_STEADY_TIME_US);
+}
+
+void cwPTT_Alert(int gpio, int level, uint32_t tick) {
+ fprintf(stderr,"init pttAlert\n");
+ fprintf(stderr,"%d - %d -%d - %d\n", running, cw_breakin, transmitter->mode, level);
+ if (running && cw_breakin && (transmitter->mode==modeCWU || transmitter->mode==modeCWL)){
+ g_idle_add(mox_update,(gpointer)level);
+ }
+}
+
float timedifference_msec(struct timeval t0, struct timeval t1)
{
return (t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec - t0.tv_usec) / 1000.0f;
gpioSetMode(16, PI_INPUT); //rx2_FIFOEmpty
gpioSetMode(20, PI_INPUT);
gpioSetMode(21, PI_OUTPUT);
+
+ setup_handler(17, cwPTT_Alert);
+
rx1_spi_handler = spiOpen(0, 15625000, 49155); //channel 0
if (rx1_spi_handler < 0) {
} else {
txFrequency=vfo[VFO_A].frequency-vfo[VFO_B].lo+vfo[VFO_A].offset;
}
- tx_iqdata[0] = 0x00;
- tx_iqdata[1] = 0x00;
+ tx_iqdata[0] = cw_keyer_speed | (cw_keyer_mode<<6);
+ tx_iqdata[1] = cw_keyer_weight | (cw_keyer_spacing<<7);
tx_iqdata[2] = ((txFrequency >> 24) & 0xFF);
tx_iqdata[3] = ((txFrequency >> 16) & 0xFF);
tx_iqdata[4] = ((txFrequency >> 8) & 0xFF);
if (isTransmitting()) {
if (key == 1) {
mic_sample_double = getNextSideToneSample();
- cw_audio_write(mic_sample_double * cw_keyer_sidetone_volume/ 127.0);
- mic_sample_double = mic_sample_double * 200000; //* amplitude
+ cw_audio_write(mic_sample_double * ((cw_keyer_sidetone_volume-1)/127.0));
+ mic_sample_double = mic_sample_double * 0.001; //the mic sample is added to make keying visible in tx screen.
+ //keying done at J2 of RPI IO-16 and IO-15; keys via gpio pin BCM18 and BCM19 will give the sidetone.
} else mic_sample_double=0.0;
}
} else {