aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIneiev <ineiev@gnu.org>2016-08-03 13:51:57 +0000
committerIneiev <ineiev@gnu.org>2016-09-09 08:12:26 +0000
commit8466024adba814619aeae1c3d293221b042ec33b (patch)
treeaab15b6b668e92faa9e91a50ea61eac7fc4dfa70
parent0d76b981b19049b8307429887136650789a23cfb (diff)
downloadmiguel-8466024adba814619aeae1c3d293221b042ec33b.tar.gz
miguel-8466024adba814619aeae1c3d293221b042ec33b.tar.bz2
move unused_columns to keytab.h
-rw-r--r--firmware/clav.c52
-rw-r--r--firmware/keytab-gb.h14
2 files changed, 36 insertions, 30 deletions
diff --git a/firmware/clav.c b/firmware/clav.c
index f43c330..9ac2cfc 100644
--- a/firmware/clav.c
+++ b/firmware/clav.c
@@ -28,6 +28,21 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
#include <avr/pgmspace.h>
#include "usbdrv.h"
+
+enum probe_constants
+{
+ PROBE_SIZE_LOG = 5,
+ PROBE_SIZE = 1 << PROBE_SIZE_LOG,
+ PROBE_MASK = PROBE_SIZE - 1,
+ PROBE_LED = 1 << 6,
+ PROBE_E1 = 1 << 4,
+ PROBE_E2 = 1 << 5,
+ FIRST_MODIFIER = 0xE0,
+ PROBE_PERIOD = 300, /* 200 us */
+ LED_NUM = 4,
+ EXTRA_LED = 1 << (LED_NUM - 1)
+};
+
#include "keytab.h"
enum local_constants
@@ -121,21 +136,6 @@ counter_off (void)
TCCR0B = 0;
}
-enum probe_constants
-{
- PROBE_SIZE_LOG = 5,
- PROBE_SIZE = 1 << PROBE_SIZE_LOG,
- PROBE_MASK = PROBE_SIZE - 1,
- PROBE_LED = 1 << 6,
- PROBE_E1 = 1 << 4,
- PROBE_E2 = 1 << 5,
- FIRST_MODIFIER = 0xE0,
- PROBE_PERIOD = 300, /* 200 us */
- UNUSED_COLUMNS = 10,
- LED_NUM = 4,
- EXTRA_LED = 1 << (LED_NUM - 1)
-};
-
PROGMEM const unsigned char light_addr[LED_NUM] =
{
27 - PROBE_E1 + PROBE_E2,/* NUM */
@@ -143,19 +143,6 @@ PROGMEM const unsigned char light_addr[LED_NUM] =
31 - PROBE_E1 + PROBE_E2,/* SCROLL */
19 - PROBE_E1 + PROBE_E2 /* BAT */
};
-PROGMEM const unsigned char unused_columns[UNUSED_COLUMNS] =
-{
- 17 - PROBE_E1 + PROBE_E2,
- 18 - PROBE_E1 + PROBE_E2,
- 20 - PROBE_E1 + PROBE_E2,
- 21 - PROBE_E1 + PROBE_E2,
- 22 - PROBE_E1 + PROBE_E2,
- 25 - PROBE_E1 + PROBE_E2,
- 26 - PROBE_E1 + PROBE_E2,
- 28 - PROBE_E1 + PROBE_E2,
- 29 - PROBE_E1 + PROBE_E2,
- 30 - PROBE_E1 + PROBE_E2
-};
static unsigned char failure = 1;
static unsigned char extra_led_value;
static unsigned char lights;
@@ -316,10 +303,13 @@ phase_probe (void)
static void
init_probe_seq (void)
{
- unsigned char i, j, la[LED_NUM], u[UNUSED_COLUMNS], v;
+ unsigned char i, j, la[LED_NUM], v;
+#if UNUSED_COLUMNS && !RAW_SCANCODES
+ unsigned char u[UNUSED_COLUMNS];
- memcpy_P (la, light_addr, sizeof (la));
memcpy_P (u, unused_columns, sizeof (u));
+#endif
+ memcpy_P (la, light_addr, sizeof (la));
for (i = 0; i < 16; i++)
probe_seq[i] = i + PROBE_E1;
@@ -337,12 +327,14 @@ init_probe_seq (void)
}
if (v)
continue;
+#if UNUSED_COLUMNS && !RAW_SCANCODES
for (j = 0; j < sizeof (u); j++)
if (u[j] == probe_seq[i])
{
probe_seq[i] = LED_NUM + PROBE_LED;
break;
}
+#endif
}
memmove (next_probe_seq, probe_seq, PROBE_SIZE);
}
diff --git a/firmware/keytab-gb.h b/firmware/keytab-gb.h
index 90699b3..934cb9b 100644
--- a/firmware/keytab-gb.h
+++ b/firmware/keytab-gb.h
@@ -52,3 +52,17 @@ scan_to_code (unsigned char x)
x = 0x03;
return x;
}
+#define UNUSED_COLUMNS (10)
+PROGMEM const unsigned char unused_columns[UNUSED_COLUMNS] =
+{
+ 17 - PROBE_E1 + PROBE_E2,
+ 18 - PROBE_E1 + PROBE_E2,
+ 20 - PROBE_E1 + PROBE_E2,
+ 21 - PROBE_E1 + PROBE_E2,
+ 22 - PROBE_E1 + PROBE_E2,
+ 25 - PROBE_E1 + PROBE_E2,
+ 26 - PROBE_E1 + PROBE_E2,
+ 28 - PROBE_E1 + PROBE_E2,
+ 29 - PROBE_E1 + PROBE_E2,
+ 30 - PROBE_E1 + PROBE_E2
+};

Return to:

Send suggestions and report system problems to the System administrator.