Merge remote-tracking branch 'upstream/develop' into xap
This commit is contained in:
commit
dcf4bf6d29
8302 changed files with 152923 additions and 60301 deletions
|
@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define _ARM_ATSAM_PROTOCOL_H_
|
||||
|
||||
#include "samd51j18a.h"
|
||||
#include "md_bootloader.h"
|
||||
|
||||
#include "timer.h"
|
||||
#include "d51_util.h"
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef _MD_BOOTLOADER_H_
|
||||
#define _MD_BOOTLOADER_H_
|
||||
|
||||
extern uint32_t _srom;
|
||||
extern uint32_t _lrom;
|
||||
extern uint32_t _erom;
|
||||
|
||||
#define BOOTLOADER_SERIAL_MAX_SIZE 20 // DO NOT MODIFY!
|
||||
|
||||
#ifdef KEYBOARD_massdrop_ctrl
|
||||
// WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
|
||||
extern uint32_t _eram;
|
||||
# define BOOTLOADER_MAGIC 0x3B9ACA00
|
||||
# define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
|
||||
#endif
|
||||
|
||||
#ifdef MD_BOOTLOADER
|
||||
|
||||
# define MCU_HZ 48000000
|
||||
# define I2C_HZ 0 // Not used
|
||||
|
||||
#endif // MD_BOOTLOADER
|
||||
|
||||
#endif //_MD_BOOTLOADER_H_
|
|
@ -28,7 +28,6 @@
|
|||
*/
|
||||
|
||||
#include "samd51.h"
|
||||
#include "md_bootloader.h"
|
||||
|
||||
/* Initialize segments */
|
||||
extern uint32_t _sfixed;
|
||||
|
@ -496,6 +495,11 @@ __attribute__((section(".vectors"))) const DeviceVectors exception_table = {
|
|||
#endif
|
||||
};
|
||||
|
||||
// WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
|
||||
extern uint32_t _eram;
|
||||
#define BOOTLOADER_MAGIC 0x3B9ACA00
|
||||
#define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
|
||||
|
||||
/**
|
||||
* \brief This is the code that gets called on processor reset.
|
||||
* To initialize the device, and call the main() routine.
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
#include "udi_device_conf.h"
|
||||
#include "udi.h"
|
||||
#include "udc.h"
|
||||
#include "md_bootloader.h"
|
||||
|
||||
#define BOOTLOADER_SERIAL_MAX_SIZE 20 // DO NOT MODIFY!
|
||||
|
||||
/**
|
||||
* \ingroup udc_group
|
||||
|
@ -122,6 +123,8 @@ static uint8_t udc_string_product_name[] = USB_DEVICE_PRODUCT_NAME;
|
|||
# define USB_DEVICE_SERIAL_NAME_SIZE 0
|
||||
#endif
|
||||
|
||||
extern uint32_t _srom;
|
||||
|
||||
uint8_t usb_device_serial_name_size = 0;
|
||||
#if defined USB_DEVICE_SERIAL_USE_BOOTLOADER_SERIAL
|
||||
uint8_t bootloader_serial_number[BOOTLOADER_SERIAL_MAX_SIZE + 1] = "";
|
||||
|
|
|
@ -734,7 +734,7 @@ void init_usb_driver(USBDriver *usbp) {
|
|||
* after a reset.
|
||||
*/
|
||||
usbDisconnectBus(usbp);
|
||||
wait_ms(1500);
|
||||
wait_ms(50);
|
||||
usbStart(usbp, &usbcfg);
|
||||
usbConnectBus(usbp);
|
||||
|
||||
|
@ -1099,6 +1099,8 @@ void midi_ep_task(void) {
|
|||
|
||||
#ifdef VIRTSER_ENABLE
|
||||
|
||||
void virtser_init(void) {}
|
||||
|
||||
void virtser_send(const uint8_t byte) { chnWrite(&drivers.serial_driver.driver, &byte, 1); }
|
||||
|
||||
__attribute__((weak)) void virtser_recv(uint8_t c) {
|
||||
|
|
|
@ -67,10 +67,10 @@ extern keymap_config_t keymap_config;
|
|||
|
||||
#ifdef BLUETOOTH_ENABLE
|
||||
# include "outputselect.h"
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
# include "adafruit_ble.h"
|
||||
# else
|
||||
# include "../serial.h"
|
||||
# ifdef BLUETOOTH_BLUEFRUIT_LE
|
||||
# include "bluefruit_le.h"
|
||||
# elif BLUETOOTH_RN42
|
||||
# include "rn42.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -94,46 +94,6 @@ extern keymap_config_t keymap_config;
|
|||
# include "joystick.h"
|
||||
#endif
|
||||
|
||||
// https://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/bluetooth_cr_UG-v1.0r.pdf#G7.663734
|
||||
static inline uint16_t CONSUMER2RN42(uint16_t usage) {
|
||||
switch (usage) {
|
||||
case AC_HOME:
|
||||
return 0x0001;
|
||||
case AL_EMAIL:
|
||||
return 0x0002;
|
||||
case AC_SEARCH:
|
||||
return 0x0004;
|
||||
case AL_KEYBOARD_LAYOUT:
|
||||
return 0x0008;
|
||||
case AUDIO_VOL_UP:
|
||||
return 0x0010;
|
||||
case AUDIO_VOL_DOWN:
|
||||
return 0x0020;
|
||||
case AUDIO_MUTE:
|
||||
return 0x0040;
|
||||
case TRANSPORT_PLAY_PAUSE:
|
||||
return 0x0080;
|
||||
case TRANSPORT_NEXT_TRACK:
|
||||
return 0x0100;
|
||||
case TRANSPORT_PREV_TRACK:
|
||||
return 0x0200;
|
||||
case TRANSPORT_STOP:
|
||||
return 0x0400;
|
||||
case TRANSPORT_EJECT:
|
||||
return 0x0800;
|
||||
case TRANSPORT_FAST_FORWARD:
|
||||
return 0x1000;
|
||||
case TRANSPORT_REWIND:
|
||||
return 0x2000;
|
||||
case TRANSPORT_STOP_EJECT:
|
||||
return 0x4000;
|
||||
case AL_LOCAL_BROWSER:
|
||||
return 0x8000;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t keyboard_idle = 0;
|
||||
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
||||
uint8_t keyboard_protocol = 1;
|
||||
|
@ -777,17 +737,10 @@ static void send_keyboard(report_keyboard_t *report) {
|
|||
|
||||
#ifdef BLUETOOTH_ENABLE
|
||||
if (where_to_send() == OUTPUT_BLUETOOTH) {
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
|
||||
# elif MODULE_RN42
|
||||
serial_send(0xFD);
|
||||
serial_send(0x09);
|
||||
serial_send(0x01);
|
||||
serial_send(report->mods);
|
||||
serial_send(report->reserved);
|
||||
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||
serial_send(report->keys[i]);
|
||||
}
|
||||
# ifdef BLUETOOTH_BLUEFRUIT_LE
|
||||
bluefruit_le_send_keys(report->mods, report->keys, sizeof(report->keys));
|
||||
# elif BLUETOOTH_RN42
|
||||
rn42_send_keyboard(report);
|
||||
# endif
|
||||
return;
|
||||
}
|
||||
|
@ -830,19 +783,11 @@ static void send_mouse(report_mouse_t *report) {
|
|||
|
||||
# ifdef BLUETOOTH_ENABLE
|
||||
if (where_to_send() == OUTPUT_BLUETOOTH) {
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
# ifdef BLUETOOTH_BLUEFRUIT_LE
|
||||
// FIXME: mouse buttons
|
||||
adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
|
||||
# else
|
||||
serial_send(0xFD);
|
||||
serial_send(0x00);
|
||||
serial_send(0x03);
|
||||
serial_send(report->buttons);
|
||||
serial_send(report->x);
|
||||
serial_send(report->y);
|
||||
serial_send(report->v); // should try sending the wheel v here
|
||||
serial_send(report->h); // should try sending the wheel h here
|
||||
serial_send(0x00);
|
||||
bluefruit_le_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
|
||||
# elif BLUETOOTH_RN42
|
||||
rn42_send_mouse(report);
|
||||
# endif
|
||||
return;
|
||||
}
|
||||
|
@ -910,18 +855,10 @@ static void send_consumer(uint16_t data) {
|
|||
#ifdef EXTRAKEY_ENABLE
|
||||
# ifdef BLUETOOTH_ENABLE
|
||||
if (where_to_send() == OUTPUT_BLUETOOTH) {
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
adafruit_ble_send_consumer_key(data);
|
||||
# elif MODULE_RN42
|
||||
static uint16_t last_data = 0;
|
||||
if (data == last_data) return;
|
||||
last_data = data;
|
||||
uint16_t bitmap = CONSUMER2RN42(data);
|
||||
serial_send(0xFD);
|
||||
serial_send(0x03);
|
||||
serial_send(0x03);
|
||||
serial_send(bitmap & 0xFF);
|
||||
serial_send((bitmap >> 8) & 0xFF);
|
||||
# ifdef BLUETOOTH_BLUEFRUIT_LE
|
||||
bluefruit_le_send_consumer_key(data);
|
||||
# elif BLUETOOTH_RN42
|
||||
rn42_send_consumer(data);
|
||||
# endif
|
||||
return;
|
||||
}
|
||||
|
@ -1168,8 +1105,8 @@ void protocol_pre_init(void) {
|
|||
setup_usb();
|
||||
sei();
|
||||
|
||||
#if defined(MODULE_RN42)
|
||||
serial_init();
|
||||
#if defined(BLUETOOTH_RN42)
|
||||
rn42_init();
|
||||
#endif
|
||||
|
||||
/* wait for USB startup & debug output */
|
||||
|
@ -1221,8 +1158,8 @@ void protocol_post_task(void) {
|
|||
MIDI_Device_USBTask(&USB_MIDI_Interface);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_ADAFRUIT_BLE
|
||||
adafruit_ble_task();
|
||||
#ifdef BLUETOOTH_BLUEFRUIT_LE
|
||||
bluefruit_le_task();
|
||||
#endif
|
||||
|
||||
#ifdef VIRTSER_ENABLE
|
||||
|
|
|
@ -474,7 +474,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = {
|
|||
#endif
|
||||
|
||||
#ifndef USB_POLLING_INTERVAL_MS
|
||||
# define USB_POLLING_INTERVAL_MS 10
|
||||
# define USB_POLLING_INTERVAL_MS 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -647,7 +647,6 @@ const PROGMEM uchar console_hid_report[] = {
|
|||
# define USB_MAX_POWER_CONSUMPTION 500
|
||||
#endif
|
||||
|
||||
// TODO: change this to 10ms to match LUFA
|
||||
#ifndef USB_POLLING_INTERVAL_MS
|
||||
# define USB_POLLING_INTERVAL_MS 1
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue