Move redox_w into redox (#21448)

Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
Duncan Sutherland 2024-01-13 06:44:44 +00:00 committed by GitHub
parent ceea0d72c1
commit b1ea30ca7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 130 additions and 2809 deletions

View file

@ -0,0 +1,23 @@
/* Copyright 2017 Mattia Dal Ben
*
* 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
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 14
#define ONESHOT_TIMEOUT 500

View file

@ -0,0 +1,105 @@
{
"keyboard_name": "Redox Wireless",
"manufacturer": "Mattia Dal Ben",
"url": "",
"maintainer": "qmk",
"usb": {
"vid": "0x4D44",
"pid": "0x5257",
"device_version": "0.0.1"
},
"features":{
"bootmagic": true,
"command": true,
"console": true,
"mousekey": true,
"extrakey": true,
"nkro": true
},
"development_board": "promicro",
"layouts": {
"LAYOUT": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0.375, "w": 1.25},
{"matrix": [0, 1], "x": 1.25, "y": 0.375},
{"matrix": [0, 2], "x": 2.25, "y": 0.125},
{"matrix": [0, 3], "x": 3.25, "y": 0},
{"matrix": [0, 4], "x": 4.25, "y": 0.125},
{"matrix": [0, 5], "x": 5.25, "y": 0.25},
{"matrix": [0, 8], "x": 12.25, "y": 0.25},
{"matrix": [0, 9], "x": 13.25, "y": 0.125},
{"matrix": [0, 10], "x": 14.25, "y": 0},
{"matrix": [0, 11], "x": 15.25, "y": 0.125},
{"matrix": [0, 12], "x": 16.25, "y": 0.375},
{"matrix": [0, 13], "x": 17.25, "y": 0.375, "w": 1.25},
{"matrix": [1, 0], "x": 0, "y": 1.375, "w": 1.25},
{"matrix": [1, 1], "x": 1.25, "y": 1.375},
{"matrix": [1, 2], "x": 2.25, "y": 1.125},
{"matrix": [1, 3], "x": 3.25, "y": 1},
{"matrix": [1, 4], "x": 4.25, "y": 1.125},
{"matrix": [1, 5], "x": 5.25, "y": 1.25},
{"matrix": [0, 6], "x": 6.25, "y": 0.75},
{"matrix": [0, 7], "x": 11.25, "y": 0.75},
{"matrix": [1, 8], "x": 12.25, "y": 1.25},
{"matrix": [1, 9], "x": 13.25, "y": 1.125},
{"matrix": [1, 10], "x": 14.25, "y": 1},
{"matrix": [1, 11], "x": 15.25, "y": 1.125},
{"matrix": [1, 12], "x": 16.25, "y": 1.375},
{"matrix": [1, 13], "x": 17.25, "y": 1.375, "w": 1.25},
{"matrix": [2, 0], "x": 0, "y": 2.375, "w": 1.25},
{"matrix": [2, 1], "x": 1.25, "y": 2.375},
{"matrix": [2, 2], "x": 2.25, "y": 2.125},
{"matrix": [2, 3], "x": 3.25, "y": 2},
{"matrix": [2, 4], "x": 4.25, "y": 2.125},
{"matrix": [2, 5], "x": 5.25, "y": 2.25},
{"matrix": [1, 6], "x": 6.25, "y": 1.75, "h": 1.5},
{"matrix": [1, 7], "x": 11.25, "y": 1.75, "h": 1.5},
{"matrix": [2, 8], "x": 12.25, "y": 2.25},
{"matrix": [2, 9], "x": 13.25, "y": 2.125},
{"matrix": [2, 10], "x": 14.25, "y": 2},
{"matrix": [2, 11], "x": 15.25, "y": 2.125},
{"matrix": [2, 12], "x": 16.25, "y": 2.375},
{"matrix": [2, 13], "x": 17.25, "y": 2.375, "w": 1.25},
{"matrix": [3, 0], "x": 0, "y": 3.375, "w": 1.25},
{"matrix": [3, 1], "x": 1.25, "y": 3.375},
{"matrix": [3, 2], "x": 2.25, "y": 3.125},
{"matrix": [3, 3], "x": 3.25, "y": 3},
{"matrix": [3, 4], "x": 4.25, "y": 3.125},
{"matrix": [3, 5], "x": 5.25, "y": 3.25},
{"matrix": [2, 6], "x": 6.75, "y": 3.75},
{"matrix": [3, 6], "x": 7.75, "y": 3.75},
{"matrix": [3, 7], "x": 9.75, "y": 3.75},
{"matrix": [2, 7], "x": 10.75, "y": 3.75},
{"matrix": [3, 8], "x": 12.25, "y": 3.25},
{"matrix": [3, 9], "x": 13.25, "y": 3.125},
{"matrix": [3, 10], "x": 14.25, "y": 3},
{"matrix": [3, 11], "x": 15.25, "y": 3.125},
{"matrix": [3, 12], "x": 16.25, "y": 3.375},
{"matrix": [3, 13], "x": 17.25, "y": 3.375, "w": 1.25},
{"matrix": [4, 0], "x": 0.25, "y": 4.375},
{"matrix": [4, 1], "x": 1.25, "y": 4.375},
{"matrix": [4, 2], "x": 2.25, "y": 4.125},
{"matrix": [4, 3], "x": 3.25, "y": 4},
{"matrix": [4, 4], "x": 5.5, "y": 5.25, "w": 1.25},
{"matrix": [4, 5], "x": 6.75, "y": 4.75, "h": 1.5},
{"matrix": [4, 6], "x": 7.75, "y": 4.75, "h": 1.5},
{"matrix": [4, 7], "x": 9.75, "y": 4.75, "h": 1.5},
{"matrix": [4, 8], "x": 10.75, "y": 4.75, "h": 1.5},
{"matrix": [4, 9], "x": 11.75, "y": 5.25, "w": 1.25},
{"matrix": [4, 10], "x": 14.25, "y": 4},
{"matrix": [4, 11], "x": 15.25, "y": 4.125},
{"matrix": [4, 12], "x": 16.25, "y": 4.375},
{"matrix": [4, 13], "x": 17.25, "y": 4.375}
]
}
}
}

View file

@ -0,0 +1,70 @@
/* Copyright 2017 Mattia Dal Ben
*
* 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 "quantum.h"
#include "matrix.h"
#include "uart.h"
#define UART_MATRIX_RESPONSE_TIMEOUT 10000
void matrix_init_custom(void) {
uart_init(1000000);
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
uint32_t timeout = 0;
bool changed = false;
//the s character requests the RF slave to send the matrix
uart_write('s');
//trust the external keystates entirely, erase the last data
uint8_t uart_data[11] = {0};
//there are 10 bytes corresponding to 10 columns, and then an end byte
for (uint8_t i = 0; i < 11; i++) {
//wait for the serial data, timeout if it's been too long
//this only happened in testing with a loose wire, but does no
//harm to leave it in here
while (!uart_available()) {
timeout++;
if (timeout > UART_MATRIX_RESPONSE_TIMEOUT) {
break;
}
}
if (timeout < UART_MATRIX_RESPONSE_TIMEOUT) {
uart_data[i] = uart_read();
} else {
uart_data[i] = 0x00;
}
}
//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
if (uart_data[10] == 0xE0) {
//shifting and transferring the keystates to the QMK matrix variable
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix_row_t current_row = (uint16_t) uart_data[i * 2] | (uint16_t) uart_data[i * 2 + 1] << 7;
if (current_matrix[i] != current_row) {
changed = true;
}
current_matrix[i] = current_row;
}
}
return changed;
}

View file

@ -0,0 +1,34 @@
# Redox Wireless
=======
<p align="center">
<img src="https://github.com/mattdibi/redox-keyboard/raw/master/img/redox-logo.png" alt="Redox logo" width="600"/>
</p>
**Redox**: the **R**educed **E**rgo**dox** project. More information and building instruction [here](https://github.com/mattdibi/redox-keyboard).
A wireless version of the Redox keyboard.
- Keyboard Maintainer: [@mattdibi](https://github.com/mattdibi)
- Hardware Supported: Redox-w rev1.0W PCB
- Hardware Availability: Falbatech
Make example for this keyboard (after setting up your build environment):
```sh
make redox/wireless:default
```
Example of flashing this keyboard:
```sh
make redox/wireless:default:avrdude
```
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).
For nRF51822 firmware upload instruction and development see [the Redox wireless firmware repository](https://github.com/mattdibi/redox-w-firmware).
## Notes
These configuration files were based off the [Mitosis](https://github.com/qmk/qmk_firmware/tree/master/keyboards/mitosis) and [Atreus](https://github.com/technomancy/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

@ -0,0 +1,5 @@
CUSTOM_MATRIX = lite
# project specific files
SRC += matrix.c
UART_DRIVER_REQUIRED = yes

View file

@ -0,0 +1,49 @@
/*
Copyright 2018 Mattia Dal Ben <matthewdibi@gmail.com>
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 "wireless.h"
void led_init(void) {
setPinOutput(D0);
setPinOutput(D1);
setPinOutput(F4);
setPinOutput(F5);
writePinHigh(D0);
writePinHigh(D1);
writePinHigh(F4);
writePinHigh(F5);
}
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
led_init();
}
#ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak))
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
{{13, 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}},
{{13, 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}},
{{13, 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}},
{{13, 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}},
{{13, 4}, {12, 4}, {11, 4}, {10, 4}, {9, 4}, {8, 4}, {7, 4}, {6, 4}, {5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}},
};
#endif

View file

@ -0,0 +1,35 @@
/*
Copyright 2018 Mattia Dal Ben <matthewdibi@gmail.com>
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"
#define red_led_off writePinHigh(F5)
#define red_led_on writePinLow(F5)
#define blu_led_off writePinHigh(F4)
#define blu_led_on writePinLow(F4)
#define grn_led_off writePinHigh(D1)
#define grn_led_on writePinLow(D1)
#define wht_led_off writePinHigh(D0)
#define wht_led_on writePinLow(D0)
#define set_led_off red_led_off; grn_led_off; blu_led_off; wht_led_off
#define set_led_red red_led_on; grn_led_off; blu_led_off; wht_led_off
#define set_led_blue red_led_off; grn_led_off; blu_led_on; wht_led_off
#define set_led_green red_led_off; grn_led_on; blu_led_off; wht_led_off
#define set_led_white red_led_off; grn_led_off; blu_led_off; wht_led_on