Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
Minor cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
darconeous committed Jun 3, 2011
1 parent a789ba2 commit 0441e25
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/specan.c
Expand Up @@ -18,10 +18,10 @@
*/

#include <cc1110.h>
#include <stdio.h>
#include "ioCCxx10_bitdef.h"
#include "display.h"
#include "keys.h"
#include "stdio.h"
#include "specan.h"
#include "pm.h"

Expand All @@ -40,34 +40,19 @@ u8 min_chan;
u8 max_chan;
u32 sleep_timer;

/* Returns the median value of the given three parameters */
u8 median_u8(u8 a, u8 b, u8 c) {
// 1 2 3 ... 2
// 1 3 2 ... 3
// 3 2 1 ... 2
// 3 1 2 ... 3
// 2 3 1 ... 1
// 2 1 3 ... 1
if(a<c) {
// 1 2 3
// 1 3 2
// 2 1 3
if(a>b) {
// 2 1 3
b = a;
if(b<a) {
return a;
} else if(c<b) {
// 1 3 2
b = c;
return c;
}
} else {
// 3 2 1
// 2 3 1
// 3 1 2
if(a<b) {
// 3 1 2
b = a;
} else if(c>b) {
// 2 3 1
b = c;
return a;
} else if(b<c) {
return c;
}
}
return b;
Expand Down Expand Up @@ -209,7 +194,8 @@ void radio_setup() {
TEST1 = 0x31;
TEST0 = 0x09;

/* no automatic frequency calibration */
/* no automatic frequency calibration, or attenuation */
/* TODO: Automatic attenuation adjust */
MCSM0 = 0;
}

Expand Down

0 comments on commit 0441e25

Please sign in to comment.