JN516x: minor fixes

This commit is contained in:
Simon Duquennoy 2015-11-21 10:23:15 +01:00
parent 9effff6526
commit 673d1d103b
3 changed files with 14 additions and 9 deletions

View file

@ -121,7 +121,6 @@ output(void)
} else { } else {
PRINTF("SUT: %u\n", uip_len); PRINTF("SUT: %u\n", uip_len);
slip_send(); slip_send();
printf("\n");
} }
return 0; return 0;
} }

View file

@ -327,7 +327,8 @@ init(void)
return 0; return 0;
} else { } else {
rx_frame_buffer = &input_array[put_index]; rx_frame_buffer = &input_array[put_index];
} input_frame_buffer = rx_frame_buffer; }
input_frame_buffer = rx_frame_buffer;
process_start(&micromac_radio_process, NULL); process_start(&micromac_radio_process, NULL);
@ -361,7 +362,8 @@ on(void)
); );
} else { } else {
missed_radio_on_request = 1; missed_radio_on_request = 1;
} ENERGEST_ON(ENERGEST_TYPE_LISTEN); }
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
listen_on = 1; listen_on = 1;
return 1; return 1;
} }
@ -436,7 +438,8 @@ transmit(unsigned short payload_len)
RIMESTATS_ADD(noacktx); RIMESTATS_ADD(noacktx);
} else { } else {
ret = RADIO_TX_ERR; ret = RADIO_TX_ERR;
} return ret; }
return ret;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int static int
@ -452,8 +455,8 @@ prepare(const void *payload, unsigned short payload_len)
} }
if(payload_len > 127 || payload == NULL) { if(payload_len > 127 || payload == NULL) {
return 1; return 1;
/* Copy payload to (soft) Ttx buffer */
} }
/* Copy payload to (soft) Ttx buffer */
memcpy(tx_frame_buffer.uPayload.au8Byte, payload, payload_len); memcpy(tx_frame_buffer.uPayload.au8Byte, payload, payload_len);
i = payload_len; i = payload_len;
#if CRC_SW #if CRC_SW
@ -563,6 +566,7 @@ read(void *buf, unsigned short bufsize)
len = input_frame_buffer->u8PayloadLength; len = input_frame_buffer->u8PayloadLength;
if(len <= CHECKSUM_LEN) { if(len <= CHECKSUM_LEN) {
input_frame_buffer->u8PayloadLength = 0;
return 0; return 0;
} else { } else {
len -= CHECKSUM_LEN; len -= CHECKSUM_LEN;
@ -599,8 +603,9 @@ read(void *buf, unsigned short bufsize)
} }
} else { } else {
len = 0; len = 0;
/* Disable further read attempts */ }
} input_frame_buffer->u8PayloadLength = 0; /* Disable further read attempts */
input_frame_buffer->u8PayloadLength = 0;
} }
return len; return len;

View file

@ -49,8 +49,9 @@
#define RTIMER_ARCH_SECOND (F_CPU / 2) #define RTIMER_ARCH_SECOND (F_CPU / 2)
#endif #endif
#define US_TO_RTIMERTICKS(D) ((int64_t)(D) << 4) #define US_TO_RTIMERTICKS(D) ((int64_t)(D) << 4)
#define RTIMERTICKS_TO_US(T) ((int64_t)(T) >> 4) #define RTIMERTICKS_TO_US(T) ((int64_t)(T) >> 4)
#define RTIMERTICKS_TO_US_64(T) RTIMERTICKS_TO_US(T)
rtimer_clock_t rtimer_arch_now(void); rtimer_clock_t rtimer_arch_now(void);