Permalink
Browse files

replaced all tabs with soft-tabs.

1 parent 5e5a087 commit 6d8fb217eb42188080d0268c22959ba1e406971d @gkaindl committed Jun 23, 2013
@@ -69,30 +69,30 @@ int pPos;
static void recvLed(int state)
{
- leds.mode(OUTPUT);
- leds.digiWrite(state);
+ leds.mode(OUTPUT);
+ leds.digiWrite(state);
}
static void sendLed(int state)
{
- leds.mode2(OUTPUT);
- leds.digiWrite2(!state);
+ leds.mode2(OUTPUT);
+ leds.digiWrite2(!state);
}
static void printBuffer(byte* buf, int len)
{
- for (byte i = 0; i < len; ++i) {
- Serial.print(buf[i]);
- Serial.print(' ');
- }
+ for (byte i = 0; i < len; ++i) {
+ Serial.print(buf[i]);
+ Serial.print(' ');
+ }
- Serial.println();
+ Serial.println();
}
void setup()
{
- Serial.begin(57600);
- rf12_initialize(NODE_ID, BAND_ID, GROUP_ID);
+ Serial.begin(57600);
+ rf12_initialize(NODE_ID, BAND_ID, GROUP_ID);
}
void loop()
@@ -112,34 +112,32 @@ void loop()
lastMillis = now;
if (rf12_recvDone() && rf12_crc == 0) {
- Serial.print("RECV ");
- printBuffer((byte*)rf12_data, rf12_len);
- recvLed(1);
- recvLedMillis = LED_DELAY;
+ Serial.print("RECV ");
+ printBuffer((byte*)rf12_data, rf12_len);
+ recvLed(1);
+ recvLedMillis = LED_DELAY;
}
if (sendTimer.poll(SEND_DELAY))
- needToSend = 1;
+ needToSend = 1;
if (needToSend && rf12_canSend()) {
- needToSend = 0;
+ needToSend = 0;
- for (int i=0; i<PACKET_LEN; i++) {
- payload[i] = (pPos + i) % 255;
- }
+ for (int i=0; i<PACKET_LEN; i++) {
+ payload[i] = (pPos + i) % 255;
+ }
- pPos = (pPos + 1) % 255;
+ pPos = (pPos + 1) % 255;
- sendLed(1);
- sendLedMillis = LED_DELAY;
+ sendLed(1);
+ sendLedMillis = LED_DELAY;
- rf12_sendStart(0, payload, PACKET_LEN);
- rf12_sendWait(1);
- rf12_recvDone();
+ rf12_sendStart(0, payload, PACKET_LEN);
+ rf12_sendWait(1);
+ rf12_recvDone();
- Serial.print("SEND ");
- printBuffer((byte*)payload, PACKET_LEN);
- }
+ Serial.print("SEND ");
+ printBuffer((byte*)payload, PACKET_LEN);
+ }
}
-
-
@@ -51,43 +51,42 @@ Port leds (1);
static void recvLed(int state)
{
- leds.mode(OUTPUT);
- leds.digiWrite(state);
+ leds.mode(OUTPUT);
+ leds.digiWrite(state);
}
static void sendLed(int state)
{
- leds.mode2(OUTPUT);
- leds.digiWrite2(!state);
+ leds.mode2(OUTPUT);
+ leds.digiWrite2(!state);
}
static void printBuffer(byte* buf, int len)
{
- for (byte i = 0; i < len; ++i) {
- Serial.print(buf[i]);
- Serial.print(' ');
- }
+ for (byte i = 0; i < len; ++i) {
+ Serial.print(buf[i]);
+ Serial.print(' ');
+ }
- Serial.println();
+ Serial.println();
}
void setup()
{
- Serial.begin(57600);
- rf12_initialize(NODE_ID, BAND_ID, GROUP_ID);
+ Serial.begin(57600);
+ rf12_initialize(NODE_ID, BAND_ID, GROUP_ID);
}
void loop()
{
- if (rf12_recvDone() && rf12_crc == 0) {
- recvLed(1);
+ if (rf12_recvDone() && rf12_crc == 0) {
+ recvLed(1);
- Serial.print("RECV ");
- printBuffer((byte*)rf12_data, rf12_len);
+ Serial.print("RECV ");
+ printBuffer((byte*)rf12_data, rf12_len);
- delay(LED_DELAY);
-
- recvLed(0);
- }
-}
+ delay(LED_DELAY);
+ recvLed(0);
+ }
+}
@@ -60,55 +60,55 @@ int pPos;
static void recvLed(int state)
{
- leds.mode(OUTPUT);
- leds.digiWrite(state);
+ leds.mode(OUTPUT);
+ leds.digiWrite(state);
}
static void sendLed(int state)
{
- leds.mode2(OUTPUT);
- leds.digiWrite2(!state);
+ leds.mode2(OUTPUT);
+ leds.digiWrite2(!state);
}
static void printBuffer(byte* buf, int len)
{
- for (byte i = 0; i < len; ++i) {
- Serial.print(buf[i]);
- Serial.print(' ');
- }
-
- Serial.println();
+ for (byte i = 0; i < len; ++i) {
+ Serial.print(buf[i]);
+ Serial.print(' ');
+ }
+
+ Serial.println();
}
void setup()
{
- Serial.begin(57600);
- rf12_initialize(NODE_ID, BAND_ID, GROUP_ID);
+ Serial.begin(57600);
+ rf12_initialize(NODE_ID, BAND_ID, GROUP_ID);
}
void loop()
{
if (sendTimer.poll(SEND_DELAY))
- needToSend = 1;
+ needToSend = 1;
if (needToSend && (rf12_recvDone() || rf12_canSend())) {
- needToSend = 0;
+ needToSend = 0;
- for (int i=0; i<PACKET_LEN; i++) {
- payload[i] = (pPos + i) % 255;
- }
-
- pPos = (pPos + 1) % 255;
-
- sendLed(1);
- rf12_sendStart(0, payload, PACKET_LEN);
- rf12_sendWait(1);
- delay(LED_DELAY);
- sendLed(0);
-
- Serial.print("SEND ");
- printBuffer((byte*)payload, PACKET_LEN);
- }
+ for (int i=0; i<PACKET_LEN; i++) {
+ payload[i] = (pPos + i) % 255;
+ }
+
+ pPos = (pPos + 1) % 255;
+
+ sendLed(1);
+ rf12_sendStart(0, payload, PACKET_LEN);
+ rf12_sendWait(1);
+ delay(LED_DELAY);
+ sendLed(0);
+
+ Serial.print("SEND ");
+ printBuffer((byte*)payload, PACKET_LEN);
+ }
}
View
@@ -40,11 +40,11 @@ rfm12b_write: rfm12b_write/rfm12b_write.o $(OBJ)
rfm12b_echo: rfm12b_echo/rfm12b_echo.o $(OBJ)
$(dir)
gcc $< $(OBJ) -o bin/$@
-
+
rfm12b_chat: rfm12b_chat/rfm12b_chat.o $(OBJ)
$(dir)
gcc $< $(OBJ) -o bin/$@
-
+
rfm12b_jeenode: rfm12b_jeenode/rfm12b_jeenode.o $(OBJ)
$(dir)
gcc $< $(OBJ) -o bin/$@
@@ -25,27 +25,27 @@
void print_stats(int fd)
{
- rfm12b_stats s;
-
- if (0 == ioctl(fd, RFM12B_IOCTL_GET_STATS, &s)) {
- printf("ioctl() succeeded.\n");
-
- printf(
- "\tbytes_recvd: %lu\n"
- "\tpkts_recvd: %lu\n"
- "\tbytes_sent: %lu\n"
- "\tpkts_sent: %lu\n"
- "\tnum_recv_overflows: %lu\n"
- "\tnum_recv_timeouts: %lu\n"
- "\tnum_recv_crc16_fail: %lu\n"
- "\tnum_send_underruns: %lu\n"
- "\tnum_send_timeouts: %lu\n"
- "\tlow_battery: %lu\n",
- s.bytes_recvd, s.pkts_recvd, s.bytes_sent, s.pkts_sent,
- s.num_recv_overflows, s.num_recv_timeouts, s.num_recv_crc16_fail,
- s.num_send_underruns, s.num_send_timeouts,
- s.low_battery
- );
- } else
- printf("ioctl() failed.\n");
+ rfm12b_stats s;
+
+ if (0 == ioctl(fd, RFM12B_IOCTL_GET_STATS, &s)) {
+ printf("ioctl() succeeded.\n");
+
+ printf(
+ "\tbytes_recvd: %lu\n"
+ "\tpkts_recvd: %lu\n"
+ "\tbytes_sent: %lu\n"
+ "\tpkts_sent: %lu\n"
+ "\tnum_recv_overflows: %lu\n"
+ "\tnum_recv_timeouts: %lu\n"
+ "\tnum_recv_crc16_fail: %lu\n"
+ "\tnum_send_underruns: %lu\n"
+ "\tnum_send_timeouts: %lu\n"
+ "\tlow_battery: %lu\n",
+ s.bytes_recvd, s.pkts_recvd, s.bytes_sent, s.pkts_sent,
+ s.num_recv_overflows, s.num_recv_timeouts, s.num_recv_crc16_fail,
+ s.num_send_underruns, s.num_send_timeouts,
+ s.low_battery
+ );
+ } else
+ printf("ioctl() failed.\n");
}
Oops, something went wrong.

0 comments on commit 6d8fb21

Please sign in to comment.