Make ContikiMAC more configurable
Allow the project / platform to provide values for CCA_SLEEP_TIME and LISTEN_TIME_AFTER_PACKET_DETECTED. This is useful for sub-ghz operation. This has been shamelessly stolen from the [Mountain Sensing project](https://github.com/feshie/contiki) @heliosfa @kmartinez
This commit is contained in:
parent
ca50a2c6df
commit
503a992887
|
@ -136,11 +136,15 @@ static int we_are_receiving_burst = 0;
|
||||||
|
|
||||||
/* CCA_SLEEP_TIME is the time between two successive CCA checks. */
|
/* CCA_SLEEP_TIME is the time between two successive CCA checks. */
|
||||||
/* Add 1 when rtimer ticks are coarse */
|
/* Add 1 when rtimer ticks are coarse */
|
||||||
|
#ifdef CONTIKIMAC_CONF_CCA_SLEEP_TIME
|
||||||
|
#define CCA_SLEEP_TIME CONTIKIMAC_CONF_CCA_SLEEP_TIME
|
||||||
|
#else
|
||||||
#if RTIMER_ARCH_SECOND > 8000
|
#if RTIMER_ARCH_SECOND > 8000
|
||||||
#define CCA_SLEEP_TIME RTIMER_ARCH_SECOND / 2000
|
#define CCA_SLEEP_TIME RTIMER_ARCH_SECOND / 2000
|
||||||
#else
|
#else
|
||||||
#define CCA_SLEEP_TIME (RTIMER_ARCH_SECOND / 2000) + 1
|
#define CCA_SLEEP_TIME (RTIMER_ARCH_SECOND / 2000) + 1
|
||||||
#endif
|
#endif /* RTIMER_ARCH_SECOND > 8000 */
|
||||||
|
#endif /* CONTIKIMAC_CONF_CCA_SLEEP_TIME */
|
||||||
|
|
||||||
/* CHECK_TIME is the total time it takes to perform CCA_COUNT_MAX
|
/* CHECK_TIME is the total time it takes to perform CCA_COUNT_MAX
|
||||||
CCAs. */
|
CCAs. */
|
||||||
|
@ -153,7 +157,11 @@ static int we_are_receiving_burst = 0;
|
||||||
/* LISTEN_TIME_AFTER_PACKET_DETECTED is the time that we keep checking
|
/* LISTEN_TIME_AFTER_PACKET_DETECTED is the time that we keep checking
|
||||||
for activity after a potential packet has been detected by a CCA
|
for activity after a potential packet has been detected by a CCA
|
||||||
check. */
|
check. */
|
||||||
|
#ifdef CONTIKIMAC_CONF_LISTEN_TIME_AFTER_PACKET_DETECTED
|
||||||
|
#define LISTEN_TIME_AFTER_PACKET_DETECTED CONTIKIMAC_CONF_LISTEN_TIME_AFTER_PACKET_DETECTED
|
||||||
|
#else
|
||||||
#define LISTEN_TIME_AFTER_PACKET_DETECTED RTIMER_ARCH_SECOND / 80
|
#define LISTEN_TIME_AFTER_PACKET_DETECTED RTIMER_ARCH_SECOND / 80
|
||||||
|
#endif
|
||||||
|
|
||||||
/* MAX_SILENCE_PERIODS is the maximum amount of periods (a period is
|
/* MAX_SILENCE_PERIODS is the maximum amount of periods (a period is
|
||||||
CCA_CHECK_TIME + CCA_SLEEP_TIME) that we allow to be silent before
|
CCA_CHECK_TIME + CCA_SLEEP_TIME) that we allow to be silent before
|
||||||
|
|
Loading…
Reference in a new issue