Hi All,

I have few doubts in the following piece of code from
CC1000RadioIntM.nc. I would be grateful if anybody helps me,

1    task void adjustSquelch() {
2        uint16_t tempArray[CC1K_SquelchTableSize];
3      char i,j,min;
4       uint16_t min_value;
5       uint32_t tempsquelch;

6    atomic {
7      usSquelchTable[usSquelchIndex] = usTempSquelch;
8      usSquelchIndex++;
9      if (usSquelchIndex >= CC1K_SquelchTableSize)
10        usSquelchIndex = 0;
11      if (iSquelchCount <= CC1K_SquelchCount)
12       iSquelchCount++;
13    }

14    for (i=0; i<CC1K_SquelchTableSize; i++) {
 15     tempArray[(int)i] = usSquelchTable[(int)i];
 16   }

17   min = 0;
18 //    for (j = 0; j < ((CC1K_SquelchTableSize) >> 1); j++) {
19   for (j = 0; j < 3; j++) {
20      for (i = 1; i < CC1K_SquelchTableSize; i++) {
21        if ((tempArray[(int)i] != 0xFFFF) &&
22           ((tempArray[(int)i] > tempArray[(int)min]) ||
23             (tempArray[(int)min] == 0xFFFF))) {
24          min = i;
25        }
26      }
27      min_value = tempArray[(int)min];
28      tempArray[(int)min] = 0xFFFF;
29    }

30    tempsquelch = ((uint32_t)(usSquelchVal << 5) +
(uint32_t)(min_value << 1));
31    atomic usSquelchVal = (uint16_t)((tempsquelch / 34) & 0x0FFFF);




The doubts are
- is this the code for noise floor estimation by software AGC (bmac).
- then what is the significance of the number 34 in the last line.
-in the for loop in line no.18 what the value being extracted from the
array, the max value/min value
- where is the part of code where the median of the queue containing
noise values is taken and added to an EWMA with an average decay 0.06


TIA
Jagan

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to