Change slip_write return type and use it where possible

This commit is contained in:
George Oikonomou 2017-11-22 02:45:00 +00:00
parent 8f2fa80401
commit 38df9fdfb2
5 changed files with 5 additions and 35 deletions

View File

@ -37,7 +37,7 @@
/*---------------------------------------------------------------------------*/
#define UIP_CONF_ROUTER 0
#define CMD_CONF_OUTPUT slip_radio_cmd_output
#define CMD_CONF_OUTPUT slip_write
/* Default CMD handlers if the target did not specify them */
#ifndef CMD_CONF_HANDLERS

View File

@ -49,27 +49,6 @@ slipnet_init(void)
{
}
/*---------------------------------------------------------------------------*/
void
slip_send_packet(const uint8_t *ptr, int len)
{
uint16_t i;
uint8_t c;
slip_arch_writeb(SLIP_END);
for(i = 0; i < len; ++i) {
c = *ptr++;
if(c == SLIP_END) {
slip_arch_writeb(SLIP_ESC);
c = SLIP_ESC_END;
} else if(c == SLIP_ESC) {
slip_arch_writeb(SLIP_ESC);
c = SLIP_ESC_ESC;
}
slip_arch_writeb(c);
}
slip_arch_writeb(SLIP_END);
}
/*---------------------------------------------------------------------------*/
static void
slipnet_input(void)
{
@ -94,7 +73,7 @@ slipnet_input(void)
}
LOG_DBG_("\n");
slip_send_packet(uip_buf, uip_len);
slip_write(uip_buf, uip_len);
}
/*---------------------------------------------------------------------------*/
static uint8_t

View File

@ -56,8 +56,6 @@
extern const struct slip_radio_sensors SLIP_RADIO_CONF_SENSORS;
#endif
void slip_send_packet(const uint8_t *ptr, int len);
/* max 16 packets at the same time??? */
uint8_t packet_ids[16];
int packet_pos;
@ -187,12 +185,6 @@ slip_radio_cmd_handler(const uint8_t *data, int len)
return 0;
}
/*---------------------------------------------------------------------------*/
void
slip_radio_cmd_output(const uint8_t *data, int data_len)
{
slip_send_packet(data, data_len);
}
/*---------------------------------------------------------------------------*/
static void
slip_input_callback(void)
{

View File

@ -110,7 +110,7 @@ slip_send(void)
return UIP_FW_OK;
}
/*---------------------------------------------------------------------------*/
uint8_t
void
slip_write(const void *_ptr, int len)
{
const uint8_t *ptr = _ptr;
@ -130,9 +130,8 @@ slip_write(const void *_ptr, int len)
}
slip_arch_writeb(c);
}
slip_arch_writeb(SLIP_END);
return len;
slip_arch_writeb(SLIP_END);
}
/*---------------------------------------------------------------------------*/
static void

View File

@ -62,7 +62,7 @@ uint8_t slip_send(void);
*/
int slip_input_byte(unsigned char c);
uint8_t slip_write(const void *ptr, int len);
void slip_write(const void *ptr, int len);
/**
* Set a function to be called when there is activity on the SLIP