Skip to content

Commit

Permalink
I think console/radio test code ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Shipman committed Jan 26, 2024
1 parent 6ba8b18 commit 5c801b2
Show file tree
Hide file tree
Showing 45 changed files with 112,817 additions and 84,906 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified Code/Not_XbeeJoint/test/build/CMakeFiles/test.dir/test.cpp.obj
Binary file not shown.
Binary file not shown.
Binary file not shown.
3,251 changes: 3,251 additions & 0 deletions Code/Not_XbeeJoint/test/build/CMakeFiles/test_rx.dir/compiler_depend.internal

Large diffs are not rendered by default.

3,770 changes: 3,768 additions & 2 deletions Code/Not_XbeeJoint/test/build/CMakeFiles/test_rx.dir/compiler_depend.make

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/CMakeFiles/test_rx.dir/test.cpp.obj
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
3,251 changes: 3,251 additions & 0 deletions Code/Not_XbeeJoint/test/build/CMakeFiles/test_tx.dir/compiler_depend.internal

Large diffs are not rendered by default.

3,770 changes: 3,768 additions & 2 deletions Code/Not_XbeeJoint/test/build/CMakeFiles/test_tx.dir/compiler_depend.make

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/CMakeFiles/test_tx.dir/test.cpp.obj
Binary file not shown.

Large diffs are not rendered by default.

8,964 changes: 8,962 additions & 2 deletions Code/Not_XbeeJoint/test/build/pioasm/CMakeFiles/pioasm.dir/compiler_depend.make

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test.bin
Binary file not shown.
35,055 changes: 17,203 additions & 17,852 deletions Code/Not_XbeeJoint/test/build/test.dis

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test.elf
Binary file not shown.
1,705 changes: 856 additions & 849 deletions Code/Not_XbeeJoint/test/build/test.elf.map

Large diffs are not rendered by default.

5,039 changes: 2,475 additions & 2,564 deletions Code/Not_XbeeJoint/test/build/test.hex

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test.uf2
Binary file not shown.
Binary file modified Code/Not_XbeeJoint/test/build/test_rx.bin
Binary file not shown.
34,607 changes: 17,241 additions & 17,366 deletions Code/Not_XbeeJoint/test/build/test_rx.dis

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test_rx.elf
Binary file not shown.
1,666 changes: 838 additions & 828 deletions Code/Not_XbeeJoint/test/build/test_rx.elf.map

Large diffs are not rendered by default.

4,976 changes: 2,476 additions & 2,500 deletions Code/Not_XbeeJoint/test/build/test_rx.hex

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test_rx.uf2
Binary file not shown.
Binary file modified Code/Not_XbeeJoint/test/build/test_rx_tx.bin
Binary file not shown.
35,398 changes: 17,249 additions & 18,149 deletions Code/Not_XbeeJoint/test/build/test_rx_tx.dis

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test_rx_tx.elf
Binary file not shown.
1,739 changes: 873 additions & 866 deletions Code/Not_XbeeJoint/test/build/test_rx_tx.elf.map

Large diffs are not rendered by default.

5,090 changes: 2,476 additions & 2,614 deletions Code/Not_XbeeJoint/test/build/test_rx_tx.hex

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test_rx_tx.uf2
Binary file not shown.
Binary file modified Code/Not_XbeeJoint/test/build/test_tx.bin
Binary file not shown.
35,055 changes: 17,203 additions & 17,852 deletions Code/Not_XbeeJoint/test/build/test_tx.dis

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test_tx.elf
Binary file not shown.
1,705 changes: 856 additions & 849 deletions Code/Not_XbeeJoint/test/build/test_tx.elf.map

Large diffs are not rendered by default.

5,041 changes: 2,476 additions & 2,565 deletions Code/Not_XbeeJoint/test/build/test_tx.hex

Large diffs are not rendered by default.

Binary file modified Code/Not_XbeeJoint/test/build/test_tx.uf2
Binary file not shown.
58 changes: 16 additions & 42 deletions Code/Not_XbeeJoint/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
#define TX_TEST 1
#endif

void rx_test(void);
void rx_test(char *buf, short len);
void transmit_test(uint8_t *buf, short len);

DRF1262 radio(spi0, CS_PIN, SCK_PIN, MOSI_PIN, MISO_PIN, TXEN_PIN, DIO1_PIN,
Expand Down Expand Up @@ -77,16 +77,6 @@ int main() {
print_command(&cmd);
cmd.handler(cmd.params);

#if TX_TEST
sleep_ms(4500);
transmit_test();
#endif

#if RX_TEST
rx_test();
radio.get_radio_errors();
#endif

sleep_ms(500);
}
}
Expand All @@ -112,15 +102,17 @@ void transmit_test(uint8_t *buf, short len) {
#endif
}

void rx_test() {
char data[100] = {0};

printf("Receive Test\n");
void rx_test(char *buf, short len) {
printf("Receive Test, press 'c' to cancel\n");

radio.radio_receive_single();

while (!gpio_get(DIO1_PIN)) {
sleep_ms(1);
if (getchar_timeout_us(0) == 'c') {
radio.clear_irq_status();
return;
}
}

// sleep_ms(10);
Expand All @@ -131,9 +123,7 @@ void rx_test() {
radio.clear_irq_status();
radio.get_irq_status();

radio.read_radio_buffer((uint8_t *)data, 5);

printf("Got some data: %s | %x", data, data[4]);
radio.read_radio_buffer((uint8_t *)buf, len);
}

void no_op_handler(uint8_t *args) { printf("handler not implemented\n"); }
Expand All @@ -155,35 +145,19 @@ void help_handler(uint8_t *args) {
}

void send_handler(uint8_t *args) {
int current = 0;
char curr_char = 0;
char buf[100] = {0};

printf("\nEnter string to send: ");

do {
curr_char = getchar_timeout_us(0);

if (is_valid_char(&curr_char)) {
putchar_raw(curr_char);

buf[current] = curr_char;

switch (curr_char) {
case 8:
case 127:
if (current > 0) current--;
break;
default:
current++;
}
}

} while (curr_char != 0x0A);

buf[current] = 0;
get_string(buf);

transmit_test((uint8_t *)(&buf), sizeof(buf));
}

void lstn_handler(uint8_t *args) {}
void lstn_handler(uint8_t *args) {
char buf[100] = {0};

rx_test(buf, sizeof(buf));

printf("rx: %s\n", buf);
}

0 comments on commit 5c801b2

Please sign in to comment.