Skip to content

Commit

Permalink
fixed doxy
Browse files Browse the repository at this point in the history
  • Loading branch information
KaitlynAnn99 committed Nov 25, 2024
1 parent 4b1fe6f commit f4168c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 50 deletions.
20 changes: 4 additions & 16 deletions include/tiny_gea2_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,7 @@ typedef struct
} tiny_gea2_interface_t;

/*!
* @param instance
* @param uart
* @param time_source
* @param msec_interrupt
* @param receive_buffer
* @param receive_buffer_size
* @param send_buffer
* @param send_buffer_size
* @param address
* @param ignore_destination_address Receives all valid packets when this is enabled to allow for routing or sniffing.
* Initialize a GEA2 interface.
*/
void tiny_gea2_interface_init(
tiny_gea2_interface_t* instance,
Expand All @@ -101,18 +92,15 @@ void tiny_gea2_interface_init(
uint8_t receive_buffer_size,
uint8_t* send_buffer,
uint8_t send_buffer_size,
uint8_t address,
bool ignore_destination_address);
uint8_t address);

/*!
* Will emit received packets. Run this in the background context.
* @param instance
* Run the interface and publish received packets.
*/
void tiny_gea2_interface_run(tiny_gea2_interface_t* instance);

/*!
* @param instance
* @param retries
* Set the retries to a custom amount
*/
void tiny_gea2_interface_set_retries(tiny_gea2_interface_t* instance, uint8_t retries);

Expand Down
7 changes: 2 additions & 5 deletions src/tiny_gea2_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ static bool received_packet_is_addressed_to_me(self_t* self)
{
tiny_gea3_packet_t* packet = (tiny_gea3_packet_t*)self->_private.receive.buffer;
return (packet->destination == self->_private.address) ||
is_broadcast_address(packet->destination) ||
self->_private.ignore_destination_address;
is_broadcast_address(packet->destination);
}

static void send_ack(self_t* instance, uint8_t address)
Expand Down Expand Up @@ -598,14 +597,12 @@ void tiny_gea2_interface_init(
uint8_t receive_buffer_size,
uint8_t* send_buffer,
uint8_t send_buffer_size,
uint8_t address,
bool ignore_destination_address)
uint8_t address)
{
instance->interface.api = &api;
instance->_private.uart = uart;
instance->_private.address = address;
instance->_private.retries = default_retries;
instance->_private.ignore_destination_address = ignore_destination_address;
instance->_private.receive.buffer = receive_buffer;
instance->_private.receive.buffer_size = receive_buffer_size;
instance->_private.receive.packet_ready = false;
Expand Down
31 changes: 2 additions & 29 deletions test/tests/tiny_gea2_interface_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ TEST_GROUP(tiny_gea2_interface)
receive_buffer_size,
send_buffer,
send_buffer_size,
address,
false);
address);

tiny_event_subscription_init(&receiveSubscription, NULL, packet_received);
tiny_event_subscribe(tiny_gea3_interface_on_receive(&instance.interface), &receiveSubscription);
Expand All @@ -78,8 +77,7 @@ TEST_GROUP(tiny_gea2_interface)
receive_buffer_size,
send_buffer,
send_buffer_size,
address,
true);
address);

tiny_event_subscribe(tiny_gea3_interface_on_receive(&instance.interface), &receiveSubscription);
}
Expand Down Expand Up @@ -1366,28 +1364,3 @@ TEST(tiny_gea2_interface, should_enter_idle_cooldown_when_a_non_stx_byte_is_rece
tiny_gea3_etx);
after(1);
}

TEST(tiny_gea2_interface, should_receive_packets_addressed_to_other_nodes_when_ignore_destination_address_is_enabled)
{
given_uart_echoing_is_enabled();

given_that_ignore_destination_address_is_enabled();

ack_should_be_sent();
after_bytes_are_received_via_uart(
tiny_gea3_stx,
address + 1, // dst
0x08, // len
0x45, // src
0xBF, // payload
0xEF, // crc
0xD1,
tiny_gea3_etx);

tiny_gea3_STATIC_ALLOC_PACKET(packet, 1);
packet->destination = address + 1;
packet->source = 0x45;
packet->payload[0] = 0xBF;
packet_should_be_received(packet);
after_the_interface_is_run();
}

0 comments on commit f4168c3

Please sign in to comment.