Skip to content

Commit

Permalink
firmware: devices: radio: Updating returned values from functions #78
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelboing committed May 11, 2022
1 parent 9ebb69a commit 05058cf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
27 changes: 20 additions & 7 deletions firmware/devices/radio/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* \brief Radio device implementation.
*
* \author Gabriel Mariano Marcelino <[email protected]>
* \author Miguel Boing <[email protected]>
*
* \version 0.1.23
*
Expand All @@ -47,25 +48,36 @@ int radio_init(void)
sys_log_print_event_from_module(SYS_LOG_INFO, RADIO_MODULE_NAME, "Initializing radio device...");
sys_log_new_line();

int err = si446x_init();

si446x_rx_init();
int err = -1;
if (si446x_init())
{
if (si446x_rx_init())
{
err = 0;
}
}

return err;
}

int radio_send(uint8_t *data, uint16_t len)
{
sys_log_print_event_from_module(SYS_LOG_INFO, RADIO_MODULE_NAME, "Transmmiting ");
sys_log_print_event_from_module(SYS_LOG_INFO, RADIO_MODULE_NAME, "Transmitting ");
sys_log_print_uint(len);
sys_log_print_msg(" byte(s)...");
sys_log_new_line();

int err = 0;
int err = -1;

if(si446x_tx_long_packet(data, len))
{
if(si446x_rx_init())
{
err = 0;
}
}

si446x_tx_long_packet(data, len);

si446x_rx_init();

return err;
}
Expand Down Expand Up @@ -97,6 +109,7 @@ int radio_recv(uint8_t *data, uint16_t len, uint32_t timeout_ms)

int radio_available(void)
{
/*TODO */
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion firmware/devices/radio/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int radio_send(uint8_t *data, uint16_t len);
*
* \param[in] timeout_ms is the timeout to received a packet in milliseconds.
*
* \return The number of read bytes (-1 on error).
* \return The status/error code.
*/
int radio_recv(uint8_t *data, uint16_t len, uint32_t timeout_ms);

Expand Down

0 comments on commit 05058cf

Please sign in to comment.