Skip to content

Commit

Permalink
add working set_register with delays
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-goddard committed Dec 20, 2024
1 parent 312ec0d commit 7f98016
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions test/rf_transmit/rf_transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "hardware/uart.h"
#include "constants.hpp"
#include "pins.hpp"
#include "tusb.h"
#include <cstring>

const char *command_enter_seq = "+++";
Expand All @@ -11,21 +12,33 @@ const char *reboot_seq = "ATZ\r";

void set_register(uint8_t register_num, uint8_t value) {
uart_write_blocking(UART_PORT, (const uint8_t *)command_enter_seq, strlen(command_enter_seq));
sleep_ms(1000);
printf("Wrote \"%s\"\n", command_enter_seq);
sleep_ms(5000);

char command[20];
sprintf(command, "ATS%d=%d\r", register_num, value);

uart_write_blocking(UART_PORT, (const uint8_t *)command, strlen(command));
printf("Wrote \"%s\"\n", command);
sleep_ms(5000);

uart_write_blocking(UART_PORT, (const uint8_t *)save_values_seq, strlen(save_values_seq));
sleep_ms(100);
printf("Wrote \"%s\"\n", save_values_seq);
sleep_ms(5000);

uart_write_blocking(UART_PORT, (const uint8_t *)reboot_seq, strlen(reboot_seq));
printf("Wrote \"%s\"\n", reboot_seq);
sleep_ms(5000);
}

int main() {
stdio_init_all();

while (!tud_cdc_connected()) {
sleep_ms(500);
}
printf("Connected\n");
sleep_ms(5000);
uart_init(UART_PORT, 115200);

gpio_set_function(RFM_TX, GPIO_FUNC_UART);
Expand All @@ -39,7 +52,9 @@ int main() {
int i = 0;
char buffer[107];

// set_register(4, 0);
set_register(12, 0);

sleep_ms(10000);



Expand Down

0 comments on commit 7f98016

Please sign in to comment.