Skip to content

Commit

Permalink
rename allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
KaitlynAnn99 committed Nov 25, 2024
1 parent 687bb17 commit 3bb9564
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions include/tiny_gea_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum {
/*!
* Macro for allocating a GEA3 packet with a given payload size on the stack. Payload size is set automatically.
*/
#define tiny_gea3_STACK_ALLOC_PACKET(_name, _payloadLength) \
#define tiny_gea_STACK_ALLOC_PACKET(_name, _payloadLength) \
uint8_t _name##Storage[_payloadLength + tiny_gea_packet_overhead] = { 0, _payloadLength }; \
tiny_gea_packet_t* const _name = (tiny_gea_packet_t*)_name##Storage

Expand All @@ -37,9 +37,9 @@ enum {
* @note The payload types should have no alignment requirements (all fields should have single-byte
* alignment, ie: should be u8s).
*/
#define tiny_gea3_STACK_ALLOC_PACKET_TYPE(_packetName, _payloadName, _payloadType) \
tiny_gea3_STACK_ALLOC_PACKET(_packetName, sizeof(_payloadType)); \
_payloadType* _payloadName; \
#define tiny_gea_STACK_ALLOC_PACKET_TYPE(_packetName, _payloadName, _payloadType) \
tiny_gea_STACK_ALLOC_PACKET(_packetName, sizeof(_payloadType)); \
_payloadType* _payloadName; \
_payloadName = (_payloadType*)_packetName->payload;

/*!
Expand Down
20 changes: 10 additions & 10 deletions test/tests/tiny_erd_client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_read_response_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, tiny_erd_t erd, uint8_t data)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 7);
tiny_gea_STACK_ALLOC_PACKET(packet, 7);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_read_response;
Expand All @@ -323,7 +323,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_read_response_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, tiny_erd_t erd, uint16_t data)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 8);
tiny_gea_STACK_ALLOC_PACKET(packet, 8);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_read_response;
Expand All @@ -340,7 +340,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_read_failure_response_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, tiny_erd_t erd, tiny_gea3_erd_api_read_result_t result)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 5);
tiny_gea_STACK_ALLOC_PACKET(packet, 5);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_read_response;
Expand All @@ -354,7 +354,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_write_response_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, tiny_erd_t erd, tiny_gea3_erd_api_write_result_t result)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 5);
tiny_gea_STACK_ALLOC_PACKET(packet, 5);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_write_response;
Expand All @@ -368,7 +368,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_malformed_write_response_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, tiny_erd_t erd, tiny_gea3_erd_api_write_result_t result)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 6);
tiny_gea_STACK_ALLOC_PACKET(packet, 6);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_write_response;
Expand All @@ -382,7 +382,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_subscribe_all_response_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, bool successful)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 3);
tiny_gea_STACK_ALLOC_PACKET(packet, 3);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_subscribe_all_response;
Expand All @@ -394,7 +394,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_subscription_publication_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, uint8_t context, tiny_erd_t erd, uint8_t data)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 8);
tiny_gea_STACK_ALLOC_PACKET(packet, 8);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_publication;
Expand All @@ -411,7 +411,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_subscription_publication_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, uint8_t context, tiny_erd_t erd, uint16_t data)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 9);
tiny_gea_STACK_ALLOC_PACKET(packet, 9);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_publication;
Expand All @@ -429,7 +429,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_subscription_publication_is_received(tiny_gea3_erd_api_request_id_t request_id, uint8_t address, uint8_t context, tiny_erd_t erd1, uint8_t data1, tiny_erd_t erd2, uint16_t data2)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 13);
tiny_gea_STACK_ALLOC_PACKET(packet, 13);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_publication;
Expand All @@ -451,7 +451,7 @@ TEST_GROUP(tiny_erd_client)

void after_a_subscription_host_startup_is_received(uint8_t address)
{
tiny_gea3_STACK_ALLOC_PACKET(packet, 1);
tiny_gea_STACK_ALLOC_PACKET(packet, 1);
packet->source = address;
packet->destination = endpoint_address;
packet->payload[0] = tiny_gea3_erd_api_command_subscription_host_startup;
Expand Down

0 comments on commit 3bb9564

Please sign in to comment.