mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-21 19:29:18 +00:00
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. */
|
||||
/* 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
|
||||
#define CCA_SLEEP_TIME RTIMER_ARCH_SECOND / 2000
|
||||
#else
|
||||
#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
|
||||
CCAs. */
|
||||
@ -153,7 +157,11 @@ static int we_are_receiving_burst = 0;
|
||||
/* LISTEN_TIME_AFTER_PACKET_DETECTED is the time that we keep checking
|
||||
for activity after a potential packet has been detected by a CCA
|
||||
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
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
|
Loading…
Reference in New Issue
Block a user