Merge ChibiOS and LUFA descriptor support (#2362)
* Move lufa descriptor to protocol/usb_descriptor * Try to compile usb_descriptor on ChibiOS * Add lufa_utils for ChibiOS Lufa USB descriptors for ChibiOS * More lufa_util compatibility fixes * First compiling version of shared USB descriptor * Send the usb descriptors * Fix the CONSOLE output on ChibiOS * Add errors for unsupported interfaces * Enable support for vitual serial port USB descriptors * Implement virtual serial port for ChibiOS * Cleanup the lufa_utils Use the default lufa header files * Add raw hid support for ChibiOS This is completely untested * Enable midi compilation on ChibiOS * Move midi functionality out of lufa.c * Don't register sysex callback when not needed * ChibiOS compilation fixes * Update ChibiOS submodule * Fix the Midi USB descriptor It didn't work properly when both Midi and Virtual serial port was enabled. * Add MIDI support for ChibiOS * Fix USB descriptor strings on ChibiOS * Use serial usb driver for raw hid * Generalize the ChibiOS stream like drivers This makes the initialization much more simple and eliminates a lot of the code duplication. * Convert console output to chibios stream driver * Fixes for ChibiOS update * Update the ChibiOS contrib submodule To include the usb data toggle synchronization fixes * Fix duplicate reset enumeration on ChibiOS * Add missing include * Add number of endpoints check for ChibiOS * Enable serial USB driver on all keyboards * Add missing includes when API is enabled withot midi * Add another missing inlcude
This commit is contained in:
parent
63c16f4b63
commit
53ff8a31b6
38 changed files with 752 additions and 1228 deletions
|
|
@ -121,7 +121,6 @@ else
|
|||
endif
|
||||
|
||||
ifeq ($(PLATFORM),CHIBIOS)
|
||||
include $(TMK_PATH)/protocol/chibios.mk
|
||||
include $(TMK_PATH)/chibios.mk
|
||||
OPT_OS = chibios
|
||||
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
|
||||
|
|
@ -197,7 +196,7 @@ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
|
|||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
|
||||
else ifneq ($(LAYOUTS),)
|
||||
include build_layout.mk
|
||||
else
|
||||
else
|
||||
$(error Could not find keymap)
|
||||
# this state should never be reached
|
||||
endif
|
||||
|
|
@ -247,6 +246,10 @@ endif
|
|||
include $(TMK_PATH)/avr.mk
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),CHIBIOS)
|
||||
include $(TMK_PATH)/protocol/chibios.mk
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
||||
VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
|
||||
VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
|
||||
|
|
|
|||
|
|
@ -24,11 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER "QMK"
|
||||
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00'
|
||||
#define PRODUCT "ChibiOS QMK test"
|
||||
#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
|
||||
#define DESCRIPTION "QMK keyboard firmware test for ChibiOS"
|
||||
#define MANUFACTURER QMK
|
||||
#define PRODUCT ChibiOS QMK test
|
||||
#define DESCRIPTION QMK keyboard firmware test for ChibiOS
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 1
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB FALSE
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB FALSE
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB FALSE
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,11 +22,9 @@
|
|||
#define VENDOR_ID 0xC1ED
|
||||
#define PRODUCT_ID 0x2350
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER "Clueboard"
|
||||
#define USBSTR_MANUFACTURER 'C', '\x00', 'l', '\x00', 'u', '\x00', 'e', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00'
|
||||
#define PRODUCT "Clueboard60"
|
||||
#define USBSTR_PRODUCT 'C', '\x00', 'l', '\x00', 'u', '\x00', 'e', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', ' ', '\x00', '6', '\x00', '0', '\x00', '%', '\x00'
|
||||
#define DESCRIPTION "Clueboard 60%"
|
||||
#define MANUFACTURER Clueboard
|
||||
#define PRODUCT Clueboard 60%
|
||||
#define DESCRIPTION Clueboard 60%
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
|
|
|
|||
|
|
@ -23,12 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6464
|
||||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER "TMK"
|
||||
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00'
|
||||
#define PRODUCT "Infinity keyboard/TMK"
|
||||
#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00'
|
||||
#define MANUFACTURER Input Club
|
||||
#define PRODUCT Ergodox Infinity (QMK)
|
||||
|
||||
#define MOUSEKEY_INTERVAL 20
|
||||
#define MOUSEKEY_DELAY 0
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER "Input Club"
|
||||
#define USBSTR_MANUFACTURER 'I', '\x00', 'n', '\x00', 'p', '\x00', 'u', '\x00', 't', '\x00', ' ', '\x00', 'C', '\x00', 'l', '\x00', 'u', '\x00', 'b', '\x00'
|
||||
#define PRODUCT "Infinity keyboard/QMK"
|
||||
#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00'
|
||||
#define MANUFACTURER Input Club
|
||||
#define PRODUCT Infinity 60% keyboard (QMK)
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 9
|
||||
#define MATRIX_COLS 7
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB FALSE
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER "JMWS"
|
||||
#define USBSTR_MANUFACTURER 'J', '\x00', 'M', '\x00', 'W', '\x00', 'S', '\x00'
|
||||
#define PRODUCT "JM60 RGB Keyboard(QMK)"
|
||||
#define USBSTR_PRODUCT 'J', '\x00', 'M', '\x00', '6', '\x00', '0', '\x00', ' ', '\x00', 'R', '\x00', 'G', '\x00', 'B', '\x00', ' ', '\x00', 'K', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '(', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00', ')', '\x00'
|
||||
#define DESCRIPTION "QMK keyboard firmware for JM60 RGB Keyboard"
|
||||
#define MANUFACTURER JMWS
|
||||
#define PRODUCT JM60 RGB Keyboard(QMK)
|
||||
#define DESCRIPTION QMK keyboard firmware for JM60 RGB Keyboard
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB FALSE
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER "Input Club"
|
||||
#define USBSTR_MANUFACTURER 'I', '\x00', 'n', '\x00', 'p', '\x00', 'u', '\x00', 't', '\x00', ' ', '\x00', 'C', '\x00', 'l', '\x00', 'u', '\x00', 'b', '\x00'
|
||||
#define PRODUCT "WhiteFox/QMK"
|
||||
#define USBSTR_PRODUCT 'W', '\x00', 'h', '\x00', 'i', '\x00', 't', '\x00', 'e', '\x00', 'F', '\x00', 'o', '\x00', 'x', '\x00', ' ', '\x00'
|
||||
#define MANUFACTURER Input Club
|
||||
#define PRODUCT WhiteFox (QMK)
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 9
|
||||
|
|
@ -81,4 +79,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e26cb16a7296a196d7c74eae22cbee00989cb7b6
|
||||
Subproject commit 587968d6cbc2b0e1c7147540872f2a67e59ca18b
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 432bc1762f17eb7b506e8fbca8ec30a3d61629b8
|
||||
Subproject commit ede48346eee4b8d6847c19bc01420bee76a5e486
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
#include "api_sysex.h"
|
||||
#include "sysex_tools.h"
|
||||
#include "print.h"
|
||||
#include "qmk_midi.h"
|
||||
|
||||
void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) {
|
||||
// SEND_STRING("\nTX: ");
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "action.h"
|
||||
#if defined(__AVR__)
|
||||
#include <avr/pgmspace.h>
|
||||
#elif defined PROTOCOL_CHIBIOS
|
||||
//We need to ensure that chibios is include before redefining reset
|
||||
#include "ch.h"
|
||||
#endif
|
||||
#include "keycode.h"
|
||||
#include "action_macro.h"
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@
|
|||
#include "process_midi.h"
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
#include "midi.h"
|
||||
#include "qmk_midi.h"
|
||||
|
||||
#ifdef MIDI_BASIC
|
||||
|
||||
void process_midi_basic_noteon(uint8_t note)
|
||||
void process_midi_basic_noteon(uint8_t note)
|
||||
{
|
||||
midi_send_noteon(&midi_device, 0, note, 128);
|
||||
}
|
||||
|
|
@ -46,6 +48,7 @@ static uint8_t tone_status[MIDI_TONE_COUNT];
|
|||
static uint8_t midi_modulation;
|
||||
static int8_t midi_modulation_step;
|
||||
static uint16_t midi_modulation_timer;
|
||||
midi_config_t midi_config;
|
||||
|
||||
inline uint8_t compute_velocity(uint8_t setting)
|
||||
{
|
||||
|
|
@ -70,30 +73,6 @@ void midi_init(void)
|
|||
midi_modulation_timer = 0;
|
||||
}
|
||||
|
||||
void midi_task(void)
|
||||
{
|
||||
if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval)
|
||||
return;
|
||||
midi_modulation_timer = timer_read();
|
||||
|
||||
if (midi_modulation_step != 0)
|
||||
{
|
||||
dprintf("midi modulation %d\n", midi_modulation);
|
||||
midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation);
|
||||
|
||||
if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) {
|
||||
midi_modulation = 0;
|
||||
midi_modulation_step = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
midi_modulation += midi_modulation_step;
|
||||
|
||||
if (midi_modulation > 127)
|
||||
midi_modulation = 127;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t midi_compute_note(uint16_t keycode)
|
||||
{
|
||||
return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose;
|
||||
|
|
@ -250,4 +229,33 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
|
|||
|
||||
#endif // MIDI_ADVANCED
|
||||
|
||||
void midi_task(void)
|
||||
{
|
||||
midi_device_process(&midi_device);
|
||||
#ifdef MIDI_ADVANCED
|
||||
if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval)
|
||||
return;
|
||||
midi_modulation_timer = timer_read();
|
||||
|
||||
if (midi_modulation_step != 0)
|
||||
{
|
||||
dprintf("midi modulation %d\n", midi_modulation);
|
||||
midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation);
|
||||
|
||||
if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) {
|
||||
midi_modulation = 0;
|
||||
midi_modulation_step = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
midi_modulation += midi_modulation_step;
|
||||
|
||||
if (midi_modulation > 127)
|
||||
midi_modulation = 127;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // MIDI_ENABLE
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ void process_midi_basic_noteoff(uint8_t note);
|
|||
void process_midi_all_notes_off(void);
|
||||
#endif
|
||||
|
||||
void midi_task(void);
|
||||
|
||||
#ifdef MIDI_ADVANCED
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
|
|
@ -39,10 +41,9 @@ typedef union {
|
|||
};
|
||||
} midi_config_t;
|
||||
|
||||
midi_config_t midi_config;
|
||||
extern midi_config_t midi_config;
|
||||
|
||||
void midi_init(void);
|
||||
void midi_task(void);
|
||||
bool process_midi(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
#define MIDI_INVALID_NOTE 0xFF
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@ extern backlight_config_t backlight_config;
|
|||
#include "fauxclicky.h"
|
||||
#endif
|
||||
|
||||
#ifdef API_ENABLE
|
||||
#include "api.h"
|
||||
#endif
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
#include "process_midi.h"
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
#ifndef GOODBYE_SONG
|
||||
#define GOODBYE_SONG SONG(GOODBYE_SOUND)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ extern uint32_t default_layer_state;
|
|||
#endif
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
#include <lufa.h>
|
||||
#ifdef MIDI_ADVANCED
|
||||
#include "process_midi.h"
|
||||
#endif
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue