diff options
-rw-r--r-- | software/hhd70dongle/hhd70dongle.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c index 34635a4..ff85ab8 100644 --- a/software/hhd70dongle/hhd70dongle.c +++ b/software/hhd70dongle/hhd70dongle.c @@ -142,6 +142,20 @@ void print_part_status(void) //char cw_wordspace[2] = {0, 7}; //} +void beacon_on(void) +{ + hhd70_palna_txmode(); + hhd70_set_OOK_GDO0_high(); + led_on(); +} + +void beacon_off(void) +{ + led_off(); + hhd70_set_OOK_GDO0_low(); + hhd70_palna_rxmode(); +} + int main(void) { MCUSR &= ~(1 << WDRF); @@ -197,6 +211,9 @@ int main(void) enable_rx_part=false; enable_tx_part=false; c1101_init_ook_beacon(); + + c1101_spi_strobe_command(SPIC1101_ADDR_STX); + beacon_on(); } print_part_status(); } @@ -282,12 +299,21 @@ int main(void) } if (change_freq != 0) { - sprintf(write_buffer,"Frequency %s by %lu KHz\r\n", (change_freq > 0 ? "up" : "down"), (change_freq > 0 ? 1 : -1) * change_freq / 1000); + beacon_off(); + c1101_spi_strobe_command(SPIC1101_ADDR_SIDLE); + + sprintf(write_buffer,"Frequency %s by %lu KHz - ", (change_freq > 0 ? "up" : "down"), (change_freq > 0 ? 1 : -1) * change_freq / 1000); CDC_Device_SendString(&VirtualSerial_CDC_Interface, write_buffer); c1101_changeFrequencyByRelativeValue(change_freq); prev_ook_freq = c1101_getCurrentCarrierFrequencyHz(); + + c1101_spi_strobe_command(SPIC1101_ADDR_STX); + beacon_on(); } - sprintf(write_buffer,"Frequency is now: %lu Hz\r\n", c1101_getCurrentCarrierFrequencyHz()); + uint32_t hz = c1101_getCurrentCarrierFrequencyHz(); + uint16_t mhz = hz / 1000000; + uint16_t khz = (hz % 1000000)/1000; + sprintf(write_buffer,"Frequency is now: %d.%03d MHz\r\n", mhz, khz); CDC_Device_SendString(&VirtualSerial_CDC_Interface, write_buffer); } } @@ -375,7 +401,7 @@ int main(void) led_off(); } - if (enable_beacon_part) +/* if (enable_beacon_part) { //char mursat_beacon[8] = {0b11101110, 0b11100010, 0b00111010, 0b10101000, 0b10001110, 0b11101110, 0b00101011, 0b10100000}; //OE6EOF CDC_Device_SendString(&VirtualSerial_CDC_Interface,"OOK Sending Beacon\r\n"); @@ -390,6 +416,6 @@ int main(void) c1101_spi_strobe_command(SPIC1101_ADDR_SIDLE); hhd70_palna_rxmode(); _delay_ms(200); - } + }*/ } } |