summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2016-09-05 20:59:11 -0600
committerBdale Garbee <bdale@gag.com>2016-09-05 20:59:11 -0600
commitc0ad087008856cfc2233b977abfc3f1dcbaccdcc (patch)
treeadc46abc430793112858ce5d1822d3fe0a395e71 /src/drivers
parent148b013dd29c26920ddfb53449ed4d8cc5a4b5ee (diff)
parent4fdf8ca9ca1cd5a84b03bd7a03c5806af64b413d (diff)
Merge branch 'master' into branch-1.6
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/ao_25lc1024.c3
-rw-r--r--src/drivers/ao_25lc1024.h3
-rw-r--r--src/drivers/ao_74hc165.c3
-rw-r--r--src/drivers/ao_74hc165.h3
-rw-r--r--src/drivers/ao_74hc497.c3
-rw-r--r--src/drivers/ao_74hc497.h3
-rw-r--r--src/drivers/ao_aprs.h3
-rw-r--r--src/drivers/ao_at24c.c3
-rw-r--r--src/drivers/ao_at45db161d.c3
-rw-r--r--src/drivers/ao_at45db161d.h3
-rw-r--r--src/drivers/ao_btm.c3
-rw-r--r--src/drivers/ao_bufio.c3
-rw-r--r--src/drivers/ao_bufio.h3
-rw-r--r--src/drivers/ao_button.c9
-rw-r--r--src/drivers/ao_button.h6
-rw-r--r--src/drivers/ao_cc1120.c20
-rw-r--r--src/drivers/ao_cc1120.h3
-rw-r--r--src/drivers/ao_cc115l.c3
-rw-r--r--src/drivers/ao_cc115l.h3
-rw-r--r--src/drivers/ao_cc1200.c52
-rw-r--r--src/drivers/ao_cc1200.h3
-rw-r--r--src/drivers/ao_companion.c3
-rw-r--r--src/drivers/ao_event.c3
-rw-r--r--src/drivers/ao_event.h3
-rw-r--r--src/drivers/ao_fat.c3
-rw-r--r--src/drivers/ao_fat.h3
-rw-r--r--src/drivers/ao_gps_sirf.c3
-rw-r--r--src/drivers/ao_gps_skytraq.c3
-rw-r--r--src/drivers/ao_gps_ublox.c3
-rw-r--r--src/drivers/ao_gps_ublox.h3
-rw-r--r--src/drivers/ao_hmc5883.c3
-rw-r--r--src/drivers/ao_hmc5883.h3
-rw-r--r--src/drivers/ao_lcd.c3
-rw-r--r--src/drivers/ao_lco.c3
-rw-r--r--src/drivers/ao_lco.h3
-rw-r--r--src/drivers/ao_lco_cmd.c3
-rw-r--r--src/drivers/ao_lco_cmd.h3
-rw-r--r--src/drivers/ao_lco_func.c3
-rw-r--r--src/drivers/ao_lco_func.h3
-rw-r--r--src/drivers/ao_lco_two.c103
-rw-r--r--src/drivers/ao_log_fat.c3
-rw-r--r--src/drivers/ao_m25.c3
-rw-r--r--src/drivers/ao_mma655x.c3
-rw-r--r--src/drivers/ao_mma655x.h3
-rw-r--r--src/drivers/ao_mpu6000.c3
-rw-r--r--src/drivers/ao_mpu6000.h3
-rw-r--r--src/drivers/ao_mr25.c3
-rw-r--r--src/drivers/ao_ms5607.c3
-rw-r--r--src/drivers/ao_ms5607.h3
-rw-r--r--src/drivers/ao_ms5607_convert.c3
-rw-r--r--src/drivers/ao_ms5607_convert_8051.c3
-rw-r--r--src/drivers/ao_packet.c3
-rw-r--r--src/drivers/ao_packet_master.c3
-rw-r--r--src/drivers/ao_packet_slave.c3
-rw-r--r--src/drivers/ao_pad.c3
-rw-r--r--src/drivers/ao_pad.h3
-rw-r--r--src/drivers/ao_pca9922.c3
-rw-r--r--src/drivers/ao_pwm.h3
-rw-r--r--src/drivers/ao_pyro_slave.c3
-rw-r--r--src/drivers/ao_quadrature.c3
-rw-r--r--src/drivers/ao_quadrature.h3
-rw-r--r--src/drivers/ao_radio_master.c3
-rw-r--r--src/drivers/ao_radio_slave.c3
-rw-r--r--src/drivers/ao_radio_spi.h3
-rw-r--r--src/drivers/ao_rfpa0133.c3
-rw-r--r--src/drivers/ao_rfpa0133.h3
-rw-r--r--src/drivers/ao_science_slave.c3
-rw-r--r--src/drivers/ao_sdcard.c3
-rw-r--r--src/drivers/ao_sdcard.h3
-rw-r--r--src/drivers/ao_servo.c3
-rw-r--r--src/drivers/ao_servo.h3
-rw-r--r--src/drivers/ao_seven_segment.c3
-rw-r--r--src/drivers/ao_seven_segment.h3
-rw-r--r--src/drivers/ao_trng.c3
-rw-r--r--src/drivers/ao_trng.h3
-rw-r--r--src/drivers/ao_trng_send.c33
-rw-r--r--src/drivers/ao_trng_send.h3
-rw-r--r--src/drivers/ao_watchdog.c3
-rw-r--r--src/drivers/ao_watchdog.h3
79 files changed, 274 insertions, 168 deletions
diff --git a/src/drivers/ao_25lc1024.c b/src/drivers/ao_25lc1024.c
index fac0a430..a9c897b3 100644
--- a/src/drivers/ao_25lc1024.c
+++ b/src/drivers/ao_25lc1024.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_25lc1024.h b/src/drivers/ao_25lc1024.h
index 44e52387..7e48f0dd 100644
--- a/src/drivers/ao_25lc1024.h
+++ b/src/drivers/ao_25lc1024.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_74hc165.c b/src/drivers/ao_74hc165.c
index 143f4e3f..8842801d 100644
--- a/src/drivers/ao_74hc165.c
+++ b/src/drivers/ao_74hc165.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_74hc165.h b/src/drivers/ao_74hc165.h
index 3ae51353..febbf1b3 100644
--- a/src/drivers/ao_74hc165.h
+++ b/src/drivers/ao_74hc165.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_74hc497.c b/src/drivers/ao_74hc497.c
index 4c13ee71..b3fd3c91 100644
--- a/src/drivers/ao_74hc497.c
+++ b/src/drivers/ao_74hc497.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_74hc497.h b/src/drivers/ao_74hc497.h
index 6df7bcae..bb14f20a 100644
--- a/src/drivers/ao_74hc497.h
+++ b/src/drivers/ao_74hc497.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_aprs.h b/src/drivers/ao_aprs.h
index a033fa0b..8f70d2d0 100644
--- a/src/drivers/ao_aprs.h
+++ b/src/drivers/ao_aprs.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_at24c.c b/src/drivers/ao_at24c.c
index 2a23be3a..8f91e3ca 100644
--- a/src/drivers/ao_at24c.c
+++ b/src/drivers/ao_at24c.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_at45db161d.c b/src/drivers/ao_at45db161d.c
index e7e74153..abba3f1f 100644
--- a/src/drivers/ao_at45db161d.c
+++ b/src/drivers/ao_at45db161d.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_at45db161d.h b/src/drivers/ao_at45db161d.h
index 9ee6f1b6..db52f0f4 100644
--- a/src/drivers/ao_at45db161d.h
+++ b/src/drivers/ao_at45db161d.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_btm.c b/src/drivers/ao_btm.c
index 8e7052cb..c65a8548 100644
--- a/src/drivers/ao_btm.c
+++ b/src/drivers/ao_btm.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_bufio.c b/src/drivers/ao_bufio.c
index 70e30b67..f212da53 100644
--- a/src/drivers/ao_bufio.c
+++ b/src/drivers/ao_bufio.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_bufio.h b/src/drivers/ao_bufio.h
index 6629f143..b0a11944 100644
--- a/src/drivers/ao_bufio.h
+++ b/src/drivers/ao_bufio.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_button.c b/src/drivers/ao_button.c
index 8e7dead7..725ac45a 100644
--- a/src/drivers/ao_button.c
+++ b/src/drivers/ao_button.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -92,6 +93,12 @@ _ao_button_init(uint8_t b)
}
+uint8_t
+ao_button_get(uint8_t b)
+{
+ return ao_button_state[b].value;
+}
+
static void
ao_button_isr(void)
{
diff --git a/src/drivers/ao_button.h b/src/drivers/ao_button.h
index ce349d65..601472f9 100644
--- a/src/drivers/ao_button.h
+++ b/src/drivers/ao_button.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,6 +19,9 @@
#ifndef _AO_BUTTON_H_
#define _AO_BUTTON_H_
+uint8_t
+ao_button_get(uint8_t b);
+
void
ao_button_init(void);
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c
index 6b800585..efe5f996 100644
--- a/src/drivers/ao_cc1120.c
+++ b/src/drivers/ao_cc1120.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -182,9 +183,8 @@ ao_radio_fifo_write_start(void)
return status;
}
-static inline uint8_t ao_radio_fifo_write_stop(uint8_t status) {
+static inline void ao_radio_fifo_write_stop(void) {
ao_radio_deselect();
- return status;
}
static uint8_t
@@ -192,7 +192,8 @@ ao_radio_fifo_write(uint8_t *data, uint8_t len)
{
uint8_t status = ao_radio_fifo_write_start();
ao_radio_spi_send(data, len);
- return ao_radio_fifo_write_stop(status);
+ ao_radio_fifo_write_stop();
+ return status;
}
static uint8_t
@@ -200,7 +201,8 @@ ao_radio_fifo_write_fixed(uint8_t data, uint8_t len)
{
uint8_t status = ao_radio_fifo_write_start();
ao_radio_spi_send_fixed(data, len);
- return ao_radio_fifo_write_stop(status);
+ ao_radio_fifo_write_stop();
+ return status;
}
static uint8_t
@@ -773,11 +775,10 @@ void
ao_radio_continuity(uint8_t c)
{
uint8_t i;
- uint8_t status;
ao_rdf_start(AO_RADIO_CONT_TOTAL_LEN);
- status = ao_radio_fifo_write_start();
+ (void) ao_radio_fifo_write_start();
for (i = 0; i < 3; i++) {
ao_radio_spi_send_fixed(0x00, AO_RADIO_CONT_PAUSE_LEN);
if (i < c)
@@ -786,8 +787,7 @@ ao_radio_continuity(uint8_t c)
ao_radio_spi_send_fixed(0x00, AO_RADIO_CONT_TONE_LEN);
}
ao_radio_spi_send_fixed(0x00, AO_RADIO_CONT_PAUSE_LEN);
- status = ao_radio_fifo_write_stop(status);
- (void) status;
+ ao_radio_fifo_write_stop();
ao_rdf_run();
}
@@ -998,6 +998,8 @@ ao_radio_rx_isr(void)
{
uint8_t d;
+ if (ao_radio_abort)
+ return;
if (rx_task_id) {
if (ao_radio_try_select(rx_task_id)) {
++rx_fast_start;
diff --git a/src/drivers/ao_cc1120.h b/src/drivers/ao_cc1120.h
index 943f3449..87b083d4 100644
--- a/src/drivers/ao_cc1120.h
+++ b/src/drivers/ao_cc1120.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_cc115l.c b/src/drivers/ao_cc115l.c
index 24180f34..a67071d2 100644
--- a/src/drivers/ao_cc115l.c
+++ b/src/drivers/ao_cc115l.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_cc115l.h b/src/drivers/ao_cc115l.h
index 811c14aa..c40f5358 100644
--- a/src/drivers/ao_cc115l.h
+++ b/src/drivers/ao_cc115l.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_cc1200.c b/src/drivers/ao_cc1200.c
index cd85f208..2bc99734 100644
--- a/src/drivers/ao_cc1200.c
+++ b/src/drivers/ao_cc1200.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -802,18 +803,12 @@ ao_radio_rdf_abort(void)
ao_wakeup(&ao_radio_wake);
}
-static void
-ao_radio_test_cmd(void)
+static uint8_t radio_on;
+
+void
+ao_radio_test_on(void)
{
- uint8_t mode = 2;
- static uint8_t radio_on;
- ao_cmd_white();
- if (ao_cmd_lex_c != '\n') {
- ao_cmd_decimal();
- mode = (uint8_t) ao_cmd_lex_u32;
- }
- mode++;
- if ((mode & 2) && !radio_on) {
+ if (!radio_on) {
#if HAS_MONITOR
ao_monitor_disable();
#endif
@@ -836,12 +831,12 @@ ao_radio_test_cmd(void)
#endif
radio_on = 1;
}
- if (mode == 3) {
- printf ("Hit a character to stop..."); flush();
- getchar();
- putchar('\n');
- }
- if ((mode & 1) && radio_on) {
+}
+
+void
+ao_radio_test_off(void)
+{
+ if (radio_on) {
ao_radio_idle();
ao_radio_put();
radio_on = 0;
@@ -854,6 +849,27 @@ ao_radio_test_cmd(void)
}
}
+static void
+ao_radio_test_cmd(void)
+{
+ uint8_t mode = 2;
+ ao_cmd_white();
+ if (ao_cmd_lex_c != '\n') {
+ ao_cmd_decimal();
+ mode = (uint8_t) ao_cmd_lex_u32;
+ }
+ mode++;
+ if ((mode & 2))
+ ao_radio_test_on();
+ if (mode == 3) {
+ printf ("Hit a character to stop..."); flush();
+ getchar();
+ putchar('\n');
+ }
+ if ((mode & 1))
+ ao_radio_test_off();
+}
+
void
ao_radio_send(const void *d, uint8_t size)
{
diff --git a/src/drivers/ao_cc1200.h b/src/drivers/ao_cc1200.h
index b2b63cde..8e17bbd9 100644
--- a/src/drivers/ao_cc1200.h
+++ b/src/drivers/ao_cc1200.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c
index 5f07e8b0..f82558a3 100644
--- a/src/drivers/ao_companion.c
+++ b/src/drivers/ao_companion.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_event.c b/src/drivers/ao_event.c
index 8f88d778..9856c2aa 100644
--- a/src/drivers/ao_event.c
+++ b/src/drivers/ao_event.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_event.h b/src/drivers/ao_event.h
index ea89da23..d1c69d81 100644
--- a/src/drivers/ao_event.h
+++ b/src/drivers/ao_event.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_fat.c b/src/drivers/ao_fat.c
index cbcd42bc..fb8eecff 100644
--- a/src/drivers/ao_fat.c
+++ b/src/drivers/ao_fat.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_fat.h b/src/drivers/ao_fat.h
index 01435363..39f4207b 100644
--- a/src/drivers/ao_fat.h
+++ b/src/drivers/ao_fat.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_gps_sirf.c b/src/drivers/ao_gps_sirf.c
index d89435b9..8bebd610 100644
--- a/src/drivers/ao_gps_sirf.c
+++ b/src/drivers/ao_gps_sirf.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c
index 066df6ff..c483382e 100644
--- a/src/drivers/ao_gps_skytraq.c
+++ b/src/drivers/ao_gps_skytraq.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_gps_ublox.c b/src/drivers/ao_gps_ublox.c
index 74c29e0a..22af413a 100644
--- a/src/drivers/ao_gps_ublox.c
+++ b/src/drivers/ao_gps_ublox.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_gps_ublox.h b/src/drivers/ao_gps_ublox.h
index e4a358a8..1d9bcee8 100644
--- a/src/drivers/ao_gps_ublox.h
+++ b/src/drivers/ao_gps_ublox.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_hmc5883.c b/src/drivers/ao_hmc5883.c
index f761671a..f668fb66 100644
--- a/src/drivers/ao_hmc5883.c
+++ b/src/drivers/ao_hmc5883.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_hmc5883.h b/src/drivers/ao_hmc5883.h
index ff2725eb..78637b02 100644
--- a/src/drivers/ao_hmc5883.h
+++ b/src/drivers/ao_hmc5883.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lcd.c b/src/drivers/ao_lcd.c
index 6def0c80..c35093bc 100644
--- a/src/drivers/ao_lcd.c
+++ b/src/drivers/ao_lcd.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco.c b/src/drivers/ao_lco.c
index 6c192537..00f10ecc 100644
--- a/src/drivers/ao_lco.c
+++ b/src/drivers/ao_lco.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco.h b/src/drivers/ao_lco.h
index 253f9702..5721eed5 100644
--- a/src/drivers/ao_lco.h
+++ b/src/drivers/ao_lco.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco_cmd.c b/src/drivers/ao_lco_cmd.c
index 6a365687..dcc0c6d0 100644
--- a/src/drivers/ao_lco_cmd.c
+++ b/src/drivers/ao_lco_cmd.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco_cmd.h b/src/drivers/ao_lco_cmd.h
index c55448cd..2975bffe 100644
--- a/src/drivers/ao_lco_cmd.h
+++ b/src/drivers/ao_lco_cmd.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco_func.c b/src/drivers/ao_lco_func.c
index 08d45467..862cb1be 100644
--- a/src/drivers/ao_lco_func.c
+++ b/src/drivers/ao_lco_func.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco_func.h b/src/drivers/ao_lco_func.h
index 42754352..6b06f928 100644
--- a/src/drivers/ao_lco_func.h
+++ b/src/drivers/ao_lco_func.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_lco_two.c b/src/drivers/ao_lco_two.c
index f53fef7d..1cb0546c 100644
--- a/src/drivers/ao_lco_two.c
+++ b/src/drivers/ao_lco_two.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,6 +19,7 @@
#include <ao.h>
#include <ao_lco.h>
#include <ao_event.h>
+#include <ao_button.h>
#include <ao_lco_func.h>
#include <ao_radio_cmac.h>
@@ -36,7 +38,6 @@ static uint8_t ao_lco_debug;
#define AO_LCO_VALID_EVER 2
static uint8_t ao_lco_suspended;
-static uint8_t ao_lco_selected;
static uint8_t ao_lco_valid;
static uint8_t ao_lco_channels;
static uint16_t ao_lco_tick_offset;
@@ -44,29 +45,34 @@ static uint16_t ao_lco_tick_offset;
/* UI values */
static uint8_t ao_lco_armed;
static uint8_t ao_lco_firing;
-
-#define ao_lco_box (ao_config.pad_box)
+static uint8_t ao_lco_box;
static struct ao_pad_query ao_pad_query;
-#define MASK_SIZE(n) (((n) + 7) >> 3)
-#define MASK_ID(n) ((n) >> 3)
-#define MASK_SHIFT(n) ((n) & 7)
+/* TeleFireTwo boxes have a single pad */
+#define ao_lco_pad 0
static void
-ao_lco_set_armed(int pad, int armed)
+ao_lco_set_box(int box)
{
- uint8_t bit = (1 << pad);
+ ao_lco_box = ao_config.pad_box + box;
+ ao_lco_valid = 0;
+ ao_lco_armed = 0;
+ ao_wakeup(&ao_lco_armed);
+}
+
+static void
+ao_lco_set_armed(int armed)
+{
+ uint8_t bit = (1 << ao_lco_pad);
if (armed) {
- ao_lco_selected |= bit;
- ao_lco_armed |= bit;
+ ao_lco_armed = bit;
} else {
- ao_lco_selected &= ~bit;
- ao_lco_armed &= ~bit;
+ ao_lco_armed = 0;
}
- PRINTD(DEBUG_EVENT, "pad %d bit 0x%x armed %d ao_lco_selected 0x%x ao_lco_armed 0x%x\n",
- pad, bit, armed, ao_lco_selected, ao_lco_armed);
+ PRINTD(DEBUG_EVENT, "pad %d bit 0x%x armed %d ao_lco_armed 0x%x\n",
+ ao_lco_pad, bit, armed, ao_lco_armed);
ao_wakeup(&ao_lco_armed);
}
@@ -76,7 +82,6 @@ ao_lco_suspend(void)
if (!ao_lco_suspended) {
PRINTD(DEBUG_EVENT, "suspend\n");
ao_lco_suspended = 1;
- ao_lco_selected = 0;
ao_lco_armed = 0;
ao_wakeup(&ao_pad_query);
}
@@ -97,7 +102,6 @@ ao_lco_input(void)
static struct ao_event event;
uint8_t timeout;
- ao_config_get();
for (;;) {
if (ao_config.pad_idle && !ao_lco_suspended) {
timeout = ao_event_get_for(&event, AO_SEC_TO_TICKS(ao_config.pad_idle));
@@ -114,14 +118,12 @@ ao_lco_input(void)
switch (event.type) {
case AO_EVENT_BUTTON:
switch (event.unit) {
- case AO_BUTTON_ARM_0:
- ao_lco_set_armed(0, event.value);
+ case AO_BUTTON_BOX:
+ ao_lco_set_box(event.value);
break;
-#if AO_BUTTON_ARM_NUM > 1
- case AO_BUTTON_ARM_1:
- ao_lco_set_armed(1, event.value);
+ case AO_BUTTON_ARM:
+ ao_lco_set_armed(event.value);
break;
-#endif
case AO_BUTTON_FIRE:
if (ao_lco_armed) {
ao_lco_firing = event.value;
@@ -185,6 +187,7 @@ ao_lco_igniter_status(void)
uint8_t t = 0;
for (;;) {
+ uint8_t all_status;
ao_sleep(&ao_pad_query);
while (ao_lco_suspended) {
ao_led_off(AO_LED_GREEN|AO_LED_AMBER|AO_LED_RED|AO_LED_REMOTE_ARM);
@@ -192,13 +195,14 @@ ao_lco_igniter_status(void)
ao_led_off(continuity_led[c]);
ao_sleep(&ao_lco_suspended);
}
- PRINTD(DEBUG_STATUS, "RSSI %d VALID %d\n", ao_radio_cmac_rssi, ao_lco_valid);
+ PRINTD(DEBUG_STATUS, "RSSI %d VALID %d channels %d arm_status %d\n",
+ ao_radio_cmac_rssi, ao_lco_valid,
+ ao_lco_channels, ao_pad_query.arm_status);
if (!(ao_lco_valid & AO_LCO_VALID_LAST)) {
ao_led_on(AO_LED_RED);
ao_led_off(AO_LED_GREEN|AO_LED_AMBER);
- continue;
- }
- if (ao_radio_cmac_rssi < -90) {
+ memset(&ao_pad_query, '\0', sizeof (ao_pad_query));
+ } else if (ao_radio_cmac_rssi < -90) {
ao_led_on(AO_LED_AMBER);
ao_led_off(AO_LED_RED|AO_LED_GREEN);
} else {
@@ -210,15 +214,28 @@ ao_lco_igniter_status(void)
else
ao_led_off(AO_LED_REMOTE_ARM);
+ all_status = AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN;
+ for (c = 0; c < 8; c++) {
+ if (ao_pad_query.channels & (1 << c)) {
+ uint8_t status = ao_pad_query.igniter_status[c];
+ if (status > all_status)
+ all_status = status;
+ PRINTD(DEBUG_STATUS, "\tchannel %d status %d\n", c, status);
+ }
+ }
for (c = 0; c < AO_LED_CONTINUITY_NUM; c++) {
- uint8_t status;
-
- if (ao_pad_query.channels & (1 << c))
- status = ao_pad_query.igniter_status[c];
- else
- status = AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN;
- PRINTD(DEBUG_STATUS, "\tchannel %d status %d\n", c, status);
- if (status == AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN)
+ uint8_t on = 0;
+ if (c == (ao_lco_box - ao_config.pad_box) % AO_LED_CONTINUITY_NUM) {
+ switch (all_status) {
+ case AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN:
+ on = 1;
+ break;
+ case AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_CLOSED:
+ case AO_PAD_IGNITER_STATUS_UNKNOWN:
+ on = t & 1;
+ }
+ }
+ if (on)
ao_led_on(continuity_led[c]);
else
ao_led_off(continuity_led[c]);
@@ -254,10 +271,14 @@ ao_lco_monitor(void)
{
uint16_t delay;
+ ao_config_get();
+ ao_lco_set_box(ao_button_get(AO_BUTTON_BOX));
ao_add_task(&ao_lco_input_task, ao_lco_input, "lco input");
ao_add_task(&ao_lco_arm_warn_task, ao_lco_arm_warn, "lco arm warn");
ao_add_task(&ao_lco_igniter_status_task, ao_lco_igniter_status, "lco igniter status");
+ ao_led_on(~0);
ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
+ ao_led_off(~0);
for (;;) {
while (ao_lco_suspended)
ao_sleep(&ao_lco_suspended);
@@ -270,13 +291,11 @@ ao_lco_monitor(void)
} else {
ao_lco_get_channels();
if (ao_lco_armed) {
- if (ao_lco_selected) {
- PRINTD(DEBUG_STATUS, "Arming pads %x\n",
- ao_lco_selected);
- if (ao_lco_valid & AO_LCO_VALID_EVER) {
- ao_lco_arm(ao_lco_box, ao_lco_selected, ao_lco_tick_offset);
- ao_delay(AO_MS_TO_TICKS(10));
- }
+ PRINTD(DEBUG_STATUS, "Arming pads %x\n",
+ ao_lco_armed);
+ if (ao_lco_valid & AO_LCO_VALID_EVER) {
+ ao_lco_arm(ao_lco_box, ao_lco_armed, ao_lco_tick_offset);
+ ao_delay(AO_MS_TO_TICKS(10));
}
}
}
diff --git a/src/drivers/ao_log_fat.c b/src/drivers/ao_log_fat.c
index 45b67012..62e97868 100644
--- a/src/drivers/ao_log_fat.c
+++ b/src/drivers/ao_log_fat.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_m25.c b/src/drivers/ao_m25.c
index e6c7bb4d..b506b0a7 100644
--- a/src/drivers/ao_m25.c
+++ b/src/drivers/ao_m25.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_mma655x.c b/src/drivers/ao_mma655x.c
index c36858ad..b9f1709c 100644
--- a/src/drivers/ao_mma655x.c
+++ b/src/drivers/ao_mma655x.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_mma655x.h b/src/drivers/ao_mma655x.h
index e57e3377..87f7384d 100644
--- a/src/drivers/ao_mma655x.h
+++ b/src/drivers/ao_mma655x.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c
index c0458027..650407ad 100644
--- a/src/drivers/ao_mpu6000.c
+++ b/src/drivers/ao_mpu6000.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_mpu6000.h b/src/drivers/ao_mpu6000.h
index dc3a9fbf..ae42d4b4 100644
--- a/src/drivers/ao_mpu6000.h
+++ b/src/drivers/ao_mpu6000.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_mr25.c b/src/drivers/ao_mr25.c
index 53cbf9d7..2d355c9f 100644
--- a/src/drivers/ao_mr25.c
+++ b/src/drivers/ao_mr25.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c
index ef31882e..261df67f 100644
--- a/src/drivers/ao_ms5607.c
+++ b/src/drivers/ao_ms5607.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_ms5607.h b/src/drivers/ao_ms5607.h
index b58178fd..18f99bf8 100644
--- a/src/drivers/ao_ms5607.h
+++ b/src/drivers/ao_ms5607.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_ms5607_convert.c b/src/drivers/ao_ms5607_convert.c
index 4d412cbe..0e96f60b 100644
--- a/src/drivers/ao_ms5607_convert.c
+++ b/src/drivers/ao_ms5607_convert.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_ms5607_convert_8051.c b/src/drivers/ao_ms5607_convert_8051.c
index a74086d9..b7081107 100644
--- a/src/drivers/ao_ms5607_convert_8051.c
+++ b/src/drivers/ao_ms5607_convert_8051.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_packet.c b/src/drivers/ao_packet.c
index 18330ead..008af5db 100644
--- a/src/drivers/ao_packet.c
+++ b/src/drivers/ao_packet.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_packet_master.c b/src/drivers/ao_packet_master.c
index 2beda4cb..e63771e5 100644
--- a/src/drivers/ao_packet_master.c
+++ b/src/drivers/ao_packet_master.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_packet_slave.c b/src/drivers/ao_packet_slave.c
index 0872682f..b877128a 100644
--- a/src/drivers/ao_packet_slave.c
+++ b/src/drivers/ao_packet_slave.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c
index 99a90e77..ffa833fe 100644
--- a/src/drivers/ao_pad.c
+++ b/src/drivers/ao_pad.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_pad.h b/src/drivers/ao_pad.h
index d77d105a..648d3005 100644
--- a/src/drivers/ao_pad.h
+++ b/src/drivers/ao_pad.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_pca9922.c b/src/drivers/ao_pca9922.c
index 6d1b5fae..09f52a0e 100644
--- a/src/drivers/ao_pca9922.c
+++ b/src/drivers/ao_pca9922.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_pwm.h b/src/drivers/ao_pwm.h
index 2dd2ffd5..1751ebfd 100644
--- a/src/drivers/ao_pwm.h
+++ b/src/drivers/ao_pwm.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_pyro_slave.c b/src/drivers/ao_pyro_slave.c
index f07c2cba..a293d929 100644
--- a/src/drivers/ao_pyro_slave.c
+++ b/src/drivers/ao_pyro_slave.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_quadrature.c b/src/drivers/ao_quadrature.c
index 0cdcc9fb..deecfb79 100644
--- a/src/drivers/ao_quadrature.c
+++ b/src/drivers/ao_quadrature.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_quadrature.h b/src/drivers/ao_quadrature.h
index d7dda682..a99e4cc5 100644
--- a/src/drivers/ao_quadrature.h
+++ b/src/drivers/ao_quadrature.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_radio_master.c b/src/drivers/ao_radio_master.c
index 128fcf32..79e4b22b 100644
--- a/src/drivers/ao_radio_master.c
+++ b/src/drivers/ao_radio_master.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_radio_slave.c b/src/drivers/ao_radio_slave.c
index 9a0612e5..2f1dab29 100644
--- a/src/drivers/ao_radio_slave.c
+++ b/src/drivers/ao_radio_slave.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_radio_spi.h b/src/drivers/ao_radio_spi.h
index 2957f70d..9dccdd29 100644
--- a/src/drivers/ao_radio_spi.h
+++ b/src/drivers/ao_radio_spi.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_rfpa0133.c b/src/drivers/ao_rfpa0133.c
index a98e261a..7ef32ef3 100644
--- a/src/drivers/ao_rfpa0133.c
+++ b/src/drivers/ao_rfpa0133.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_rfpa0133.h b/src/drivers/ao_rfpa0133.h
index 2ba7f699..793cdf76 100644
--- a/src/drivers/ao_rfpa0133.h
+++ b/src/drivers/ao_rfpa0133.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_science_slave.c b/src/drivers/ao_science_slave.c
index 996e98d9..775318f9 100644
--- a/src/drivers/ao_science_slave.c
+++ b/src/drivers/ao_science_slave.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_sdcard.c b/src/drivers/ao_sdcard.c
index 47188ef3..4b17c5e3 100644
--- a/src/drivers/ao_sdcard.c
+++ b/src/drivers/ao_sdcard.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_sdcard.h b/src/drivers/ao_sdcard.h
index 50b70c73..8f794efc 100644
--- a/src/drivers/ao_sdcard.h
+++ b/src/drivers/ao_sdcard.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_servo.c b/src/drivers/ao_servo.c
index b48a4112..78978e3e 100644
--- a/src/drivers/ao_servo.c
+++ b/src/drivers/ao_servo.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_servo.h b/src/drivers/ao_servo.h
index e1df347a..23059c44 100644
--- a/src/drivers/ao_servo.h
+++ b/src/drivers/ao_servo.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_seven_segment.c b/src/drivers/ao_seven_segment.c
index f1339ee5..d2e1248f 100644
--- a/src/drivers/ao_seven_segment.c
+++ b/src/drivers/ao_seven_segment.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_seven_segment.h b/src/drivers/ao_seven_segment.h
index f997f3b5..bdac98c7 100644
--- a/src/drivers/ao_seven_segment.h
+++ b/src/drivers/ao_seven_segment.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_trng.c b/src/drivers/ao_trng.c
index e69cd30b..d89cc81a 100644
--- a/src/drivers/ao_trng.c
+++ b/src/drivers/ao_trng.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_trng.h b/src/drivers/ao_trng.h
index 78577428..307a20fd 100644
--- a/src/drivers/ao_trng.h
+++ b/src/drivers/ao_trng.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_trng_send.c b/src/drivers/ao_trng_send.c
index 4ac6ee5e..85034efd 100644
--- a/src/drivers/ao_trng_send.c
+++ b/src/drivers/ao_trng_send.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -96,18 +97,7 @@ ao_trng_send_raw(void)
#endif
-/* Make sure there's at least 8 bits of variance in the samples */
-#define MIN_VARIANCE (128 * 128)
-
-/* Make sure the signal is spread around a bit */
-#define MAX_VARIANCE (512 * 512)
-
-#define ADD_STATS(value) do { \
- sum += (value); \
- sum2 += (value) * (value); \
- } while(0)
-
-#define VARIANCE(n) ((sum2 - (sum / (n) * sum)) / (n))
+static uint32_t previous[AO_USB_IN_SIZE / sizeof (uint16_t)];
static int
ao_trng_get_cooked(uint16_t *buf)
@@ -115,29 +105,24 @@ ao_trng_get_cooked(uint16_t *buf)
uint16_t i;
uint16_t t;
uint32_t *rnd = (uint32_t *) ao_adc_ring;
- int32_t sum, sum2, var;
+ uint8_t mismatch = 0;
- sum = sum2 = 0;
t = ao_adc_get(AO_USB_IN_SIZE) >> 1; /* one 16-bit value per output byte */
for (i = 0; i < AO_USB_IN_SIZE / sizeof (uint16_t); i++) {
uint32_t v;
- uint16_t v1, v2;
/* Fetch two values in one operation */
v = rnd[t];
+ if (v != previous[i]) {
+ mismatch = 1;
+ previous[i] = v;
+ }
t = (t + 1) & ((AO_ADC_RING_SIZE >> 1) - 1);
*buf++ = ao_crc_in_32_out_16(v);
-
- v1 = v;
- v2 = v >> 16;
-
- ADD_STATS(v1);
- ADD_STATS(v2);
}
ao_adc_ack(AO_USB_IN_SIZE);
- var = VARIANCE(2 * AO_USB_IN_SIZE / sizeof (uint16_t));
- return var >= MIN_VARIANCE && var <= MAX_VARIANCE;
+ return mismatch;
}
#define AO_TRNG_START_WAIT 1024
diff --git a/src/drivers/ao_trng_send.h b/src/drivers/ao_trng_send.h
index 83312d59..4a41637f 100644
--- a/src/drivers/ao_trng_send.h
+++ b/src/drivers/ao_trng_send.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_watchdog.c b/src/drivers/ao_watchdog.c
index 096a5564..1a877fcb 100644
--- a/src/drivers/ao_watchdog.c
+++ b/src/drivers/ao_watchdog.c
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/drivers/ao_watchdog.h b/src/drivers/ao_watchdog.h
index 73e1559d..e40475f6 100644
--- a/src/drivers/ao_watchdog.h
+++ b/src/drivers/ao_watchdog.h
@@ -3,7 +3,8 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of