From aecd7632b4484c2272fa293ee682d9a07217181b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 20 Oct 2018 09:23:55 -0400 Subject: [PATCH] alternating CW and AFSK! --- cw/cw_main.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/cw/cw_main.c b/cw/cw_main.c index 810489d6..d0e8df33 100644 --- a/cw/cw_main.c +++ b/cw/cw_main.c @@ -118,11 +118,11 @@ int main(void) int msg_length; while(1) { // loop forever - //send_afsk(); - //config_cw(); - for (channel = 0; channel < 7; channel++) { - + + send_afsk(); + config_cw(); + if (channel == 0) { // start with telemetry header "hi hi" plus a few chars to help CW decoding software sync msg_length = encode_header(&packet[0], MAX_MESSAGE_LENGTH + 1); @@ -377,6 +377,34 @@ int upper_digit(int number) { // void config_cw() { + uint8_t retVal; + +// Configure SPI bus to AX5043 + setSpiChannel(SPI_CHANNEL); + setSpiSpeed(SPI_SPEED); + initializeSpi(); + printf("1\n"); + + // Initialize the AX5043 + retVal = axradio_init(); + printf("2\n"); + if (retVal == AXRADIO_ERR_NOCHIP) { + fprintf(stderr, "ERROR: No AX5043 RF chip found\n"); + exit(EXIT_FAILURE); + } + if (retVal != AXRADIO_ERR_NOERROR) { + fprintf(stderr, "ERROR: Unable to initialize AX5043\n"); + exit(EXIT_FAILURE); + } + + printf("INFO: Found and initialized AX5043\n"); + + retVal = mode_tx(); + if (retVal != AXRADIO_ERR_NOERROR) { + fprintf(stderr, "ERROR: Unable to enter TX mode\n"); + exit(EXIT_FAILURE); + } + printf("Register write to clear framing and crc\n"); ax5043WriteReg(0x12,0);