1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_mac: add MAC duty-cycle record macro

This commit is contained in:
shuguo 2018-04-12 13:09:48 +08:00 committed by Martine Lenders
parent c274e4e1a1
commit ed4a80db00
3 changed files with 11 additions and 12 deletions

View File

@ -84,15 +84,6 @@ extern "C" {
*/
#define GNRC_GOMACH_TYPE_KNOWN (1U)
/**
* @brief Enable/disable duty-cycle record and print out.
*
* Set "1" to enable, set "0" to disable.
*/
#ifndef GNRC_GOMACH_ENABLE_DUTYCYLE_RECORD
#define GNRC_GOMACH_ENABLE_DUTYCYLE_RECORD (0U)
#endif
/**
* @brief State-machine states of Broadcast procedure of GoMacH.
*/
@ -304,8 +295,7 @@ typedef struct gomach {
uint8_t rx_pkt_lqi; /**< LQI of latest received
packet */
#if (GNRC_GOMACH_ENABLE_DUTYCYLE_RECORD == 1)
#if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
/* Parameters for recording duty-cycle */
uint64_t last_radio_on_time_ticks; /**< The last time in ticks
when radio is on */

View File

@ -56,6 +56,15 @@ extern "C" {
#define GNRC_MAC_TX_QUEUE_SIZE (8U)
#endif
/**
* @brief Enable/disable MAC radio duty-cycle recording and displaying.
*
* Set "1" to enable, set "0" to disable.
*/
#ifndef GNRC_MAC_ENABLE_DUTYCYCLE_RECORD
#define GNRC_MAC_ENABLE_DUTYCYCLE_RECORD (1U)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -2194,7 +2194,7 @@ static void _gomach_init(gnrc_netif_t *netif)
netif->mac.tx.t2u_fail_count = 0;
#if (GNRC_GOMACH_ENABLE_DUTYCYLE_RECORD == 1)
#if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
/* Start duty cycle recording */
netif->mac.prot.gomach.system_start_time_ticks = xtimer_now_usec64();
netif->mac.prot.gomach.last_radio_on_time_ticks =