Telophase cleanup (#13225)

master
Ryan 2021-06-20 12:03:11 +10:00 committed by GitHub
parent 11f66c317a
commit 4dddcb4f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 177 additions and 310 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2012 Jun Wako <wakojun@gmail.com> Copyright 2021
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -15,13 +15,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef CONFIG_H #pragma once
#define CONFIG_H
#include "config_common.h" #include "config_common.h"
/* USB Device descriptor parameter */ /* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED #define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060 #define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001 #define DEVICE_VER 0x0001
@ -32,14 +30,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 4 #define MATRIX_ROWS 4
#define MATRIX_COLS 12 #define MATRIX_COLS 12
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
//#define BACKLIGHT_LEVELS 3
#define ONESHOT_TIMEOUT 500 #define ONESHOT_TIMEOUT 500
/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO
/* /*
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.
@ -55,8 +68,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_LAYER //#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING //#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT //#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION /* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
// UART settings for communication with the RF microcontroller // UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 1000000 #define SERIAL_UART_BAUD 1000000
@ -66,5 +81,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
/* 8-bit data */ \ /* 8-bit data */ \
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
#endif

View File

@ -1,99 +1,55 @@
// this is the style you want to emulate. /*
// This is the canonical layout file for the Quantum project. If you want to add another keyboard, Copyright 2021
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, 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
// Each layer gets a name for readability, which is then used in the keymap matrix below. enum layer_names {
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum telophase_layers
{
_QWERTY, _QWERTY,
_LOWER, _LOWER,
_RAISE, _RAISE,
_ADJUST, _ADJUST
};
enum telophase_keycodes
{
LOWER = SAFE_RANGE,
RAISE,
ADJUST
}; };
#define LONGPRESS_DELAY 150 #define LONGPRESS_DELAY 150
#define LAYER_TOGGLE_DELAY 300 #define LAYER_TOGGLE_DELAY 300
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = { /*QWERTY*/ [_QWERTY] = LAYOUT_ortho_4x12(
{KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC }, KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
{KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT }, KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
{KC_LCTL, KC_LGUI, KC_LALT, ADJUST, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT } KC_LCTL, KC_LGUI, KC_LALT, MO(_ADJUST), MO(_LOWER), KC_SPC, KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
}, ),
[_LOWER] = LAYOUT_ortho_4x12(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
[_LOWER] = { /*Lower*/ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL }, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), _______, _______, _______,
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE }, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______ }, ),
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY } [_RAISE] = LAYOUT_ortho_4x12(
}, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
[_RAISE] = { /*Raise*/ ),
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL }, [_ADJUST] = LAYOUT_ortho_4x12(
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS }, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______ }, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY } _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
}, )
[_ADJUST] = { /*Adjust*/
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }
},
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
} else {
layer_off(_LOWER);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
} else {
layer_off(_RAISE);
}
return false;
break;
case ADJUST:
if (record->event.pressed) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
return false;
break;
}
return true;
}
void matrix_scan_user(void) {
return;
}; };

View File

@ -15,86 +15,18 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <stdbool.h> #include "quantum.h"
#if defined(__AVR__)
#include <avr/io.h>
#endif
#include "wait.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h" #include "matrix.h"
#include "timer.h"
#include "protocol/serial.h" #include "protocol/serial.h"
#if (MATRIX_COLS <= 8) void matrix_init_custom(void) {
# define print_matrix_header() print("\nr/c 01234567\n")
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
# define matrix_bitpop(i) bitpop(matrix[i])
# define ROW_SHIFTER ((uint8_t)1)
#elif (MATRIX_COLS <= 16)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
# define matrix_bitpop(i) bitpop16(matrix[i])
# define ROW_SHIFTER ((uint16_t)1)
#elif (MATRIX_COLS <= 32)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
# define matrix_bitpop(i) bitpop32(matrix[i])
# define ROW_SHIFTER ((uint32_t)1)
#endif
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
void matrix_init(void) {
matrix_init_quantum();
serial_init(); serial_init();
} }
uint8_t matrix_scan(void) bool matrix_scan_custom(matrix_row_t current_matrix[]) {
{
uint32_t timeout = 0; uint32_t timeout = 0;
bool changed = false;
//the s character requests the RF slave to send the matrix //the s character requests the RF slave to send the matrix
SERIAL_UART_DATA = 's'; SERIAL_UART_DATA = 's';
@ -118,47 +50,16 @@ uint8_t matrix_scan(void)
//check for the end packet, the key state bytes use the LSBs, so 0xE0 //check for the end packet, the key state bytes use the LSBs, so 0xE0
//will only show up here if the correct bytes were recieved //will only show up here if the correct bytes were recieved
if (uart_data[11] == 0xE0) if (uart_data[11] == 0xE0) {
{
//shifting and transferring the keystates to the QMK matrix variable //shifting and transferring the keystates to the QMK matrix variable
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 6; matrix_row_t current_row = (uint16_t) uart_data[i * 2] | (uint16_t) uart_data[i * 2 + 1] << 6;
if (current_matrix[i] != current_row) {
changed = true;
}
current_matrix[i] = current_row;
} }
} }
return changed;
matrix_scan_quantum();
return 1;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
void matrix_print(void)
{
print_matrix_header();
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
print_hex8(row); print(": ");
print_matrix_row(row);
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += matrix_bitpop(i);
}
return count;
} }

View File

@ -1,16 +1,13 @@
Telophase # Telophase
=========
A wireless split compact keyboard. A wireless split compact keyboard.
Hardware Supported: Telophase PCB This keyboard uses a completely different 'matrix scan' system to other keyboards, it relies on an external nRF51822 microcontroller maintaining a matrix of keystates received from the keyboard halves. The matrix.c file contains the code to poll the external microcontroller for the key matrix. As long as this file is not changed, all other QMK features are supported.
* Hardware Supported: Telophase PCB
Make example for this keyboard (after setting up your build environment): Make example for this keyboard (after setting up your build environment):
make telophase:default make telophase:default
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
## Mitosis Notes
These configuration files were based off the Atreus keyboard. It assumes a Pro Micro is being used, however retains the 'make upload' feature from the Atreus branch. This keyboard uses a completely different 'matrix scan' system to other keyboards, it relies on an external nRF51822 microcontroller maintaining a matrix of keystates received from the keyboard halves. The matrix.c file contains the code to poll the external microcontroller for the key matrix. As long as this file is not changed, all other QMK features are supported.

View File

@ -2,34 +2,27 @@
MCU = atmega32u4 MCU = atmega32u4
# Bootloader selection # Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = caterina BOOTLOADER = caterina
# Build Options # Build Options
# comment out to disable the options. # change yes to no to disable
# #
#BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = yes # Commands for debug and configuration
CUSTOM_MATRIX = yes # Remote matrix from the wireless bridge SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
# MIDI_ENABLE = YES # MIDI controls BLUETOOTH_ENABLE = no # Enable Bluetooth
UNICODE_ENABLE = YES # Unicode AUDIO_ENABLE = no # Audio output
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID CUSTOM_MATRIX = lite
# # project specific files # project specific files
SRC = matrix.c serial_uart.c SRC += matrix.c serial_uart.c
# Disable unsupported hardware # Disable unsupported hardware
RGBLIGHT_SUPPORTED = no RGBLIGHT_SUPPORTED = no

View File

@ -1,13 +1,31 @@
/*
Copyright 2021
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, 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "telophase.h" #include "telophase.h"
void led_init(void) { void led_init(void) {
DDRD |= (1<<1); setPinOutput(D1);
PORTD |= (1<<1); setPinOutput(F4);
DDRF |= (1<<4) | (1<<5); setPinOutput(F5);
PORTF |= (1<<4) | (1<<5); writePinHigh(D1);
writePinHigh(F4);
writePinHigh(F5);
} }
void matrix_init_kb(void) { void matrix_init_kb(void) {
// put your keyboard start-up code here // put your keyboard start-up code here
// runs once when the firmware starts up // runs once when the firmware starts up
@ -21,6 +39,6 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
{{12, 0}, {11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, {{12, 0}, {11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}},
{{12, 1}, {11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, {{12, 1}, {11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}},
{{12, 2}, {11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, {{12, 2}, {11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},
{{12, 3}, {11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, {{12, 3}, {11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}
}; };
#endif #endif

View File

@ -1,14 +1,30 @@
#ifndef TELOPHASE_H /*
#define TELOPHASE_H Copyright 2021
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, 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h" #include "quantum.h"
#define red_led_off PORTF |= (1<<5) #define red_led_off writePinHigh(F5)
#define red_led_on PORTF &= ~(1<<5) #define red_led_on writePinLow(F5)
#define blu_led_off PORTF |= (1<<4) #define blu_led_off writePinHigh(F4)
#define blu_led_on PORTF &= ~(1<<4) #define blu_led_on writePinLow(F4)
#define grn_led_off PORTD |= (1<<1) #define grn_led_off writePinHigh(D1)
#define grn_led_on PORTD &= ~(1<<1) #define grn_led_on writePinLow(D1)
#define set_led_off red_led_off; grn_led_off; blu_led_off #define set_led_off red_led_off; grn_led_off; blu_led_off
#define set_led_red red_led_on; grn_led_off; blu_led_off #define set_led_red red_led_on; grn_led_off; blu_led_off
@ -19,46 +35,19 @@
#define set_led_cyan red_led_off; grn_led_on; blu_led_on #define set_led_cyan red_led_off; grn_led_on; blu_led_on
#define set_led_white red_led_on; grn_led_on; blu_led_on #define set_led_white red_led_on; grn_led_on; blu_led_on
/*
#define LED_B 5
#define LED_R 6
#define LED_G 7
#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
#define red_led_on PORTF |= (1<<LED_R)
#define red_led_off PORTF &= ~(1<<LED_R)
#define grn_led_on PORTF |= (1<<LED_G)
#define grn_led_off PORTF &= ~(1<<LED_G)
#define blu_led_on PORTF |= (1<<LED_B)
#define blu_led_off PORTF &= ~(1<<LED_B)
#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
*/
// This a shortcut to help you visually see your layout. // This a shortcut to help you visually see your layout.
// The first section contains all of the arguements // The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array // The second converts the arguments into a two-dimensional array
#define LAYOUT_ortho_4x12( \ #define LAYOUT_ortho_4x12( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, \ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, \
k12, k13, k14, k15, k16, k17, k18, k19, k20, k21, k22, k23, \ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, \
k24, k25, k26, k27, k28, k29, k30, k31, k32, k33, k34, k35, \ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, \
k36, k37, k38, k39, k40, k41, k42, k43, k44, k45, k46, k47 \ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B \
) \ ) { \
{ \ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B }, \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11 }, \ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B }, \
{ k12, k13, k14, k15, k16, k17, k18, k19, k20, k21, k22, k23 }, \ { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B }, \
{ k24, k25, k26, k27, k28, k29, k30, k31, k32, k33, k34, k35 }, \ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B } \
{ k36, k37, k38, k39, k40, k41, k42, k43, k44, k45, k46, k47 }, \
} }
#define LAYOUT LAYOUT_ortho_4x12 #define LAYOUT LAYOUT_ortho_4x12
#endif