From 30680c6eb396a2bb06928afd69edae9908ac84fb Mon Sep 17 00:00:00 2001 From: patrickmt <40182064+patrickmt@users.noreply.github.com> Date: Wed, 29 Aug 2018 15:07:52 -0400 Subject: Massdrop keyboard support (#3780) * Massdrop SAMD51 Massdrop SAMD51 keyboards initial project upload * Removing relocated files Removing files that were relocated and not deleted from previous location * LED queue fix and cleaning Cleaned some white space or comments. Fix for LED I2C command queue. Cleaned up interrupts. Added debug function for printing numbers to scope through m15 line. * Factory programmed serial usage Ability to use factory programmed serial in hub and keyboard usb descriptors * USB serial number and bugfix Added support for factory programmed serial and usage. Incorporated bootloader's conditional compiling to align project closer. Fixed issue when USB device attempted to send before enabled. General white space and comment cleanup. * Project cleanup Cleaned up project in terms of white space, commented code, and unecessary files. NKRO keyboard is now using correct setreport although KBD was fine to use. Fixed broken linkage to __xprintf for serial debug statements. * Fix for extra keys Fixed possible USB hang on extra keys report set missing * I2C cleanup I2C cleanup and file renames necessary for master branch merge * Boot tracing and clocks cleanup Added optional boot debug trace mode through debug LED codes. General clock code cleanup. * Relocate ARM/Atmel headers Moved ARM/Atmel header folder from drivers to lib and made necessary makefile changes. * Pull request changes Pull request changes * Keymap and compile flag fix Keymap fix for momentary layer. Potential compile flag fix for Travis CI failure. * va_list include fix Fix for va_list compile failure * Include file case fixes Fixes for include files with incorrect case * ctrl and alt67 keyboard readme Added ctrl and alt67 keyboard readme files --- tmk_core/protocol/arm_atsam/usb/ui.c | 106 +++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tmk_core/protocol/arm_atsam/usb/ui.c (limited to 'tmk_core/protocol/arm_atsam/usb/ui.c') diff --git a/tmk_core/protocol/arm_atsam/usb/ui.c b/tmk_core/protocol/arm_atsam/usb/ui.c new file mode 100644 index 000000000..031678b64 --- /dev/null +++ b/tmk_core/protocol/arm_atsam/usb/ui.c @@ -0,0 +1,106 @@ +/** + * \file + * + * \brief User Interface + * + * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * \asf_license_stop + * + */ +/* + * Support and FAQ: visit Atmel Support + */ + +#ifndef ARM_MATH_CM4 + #define ARM_MATH_CM4 +#endif + +#undef LITTLE_ENDIAN //redefined in samd51j18a.h +#include "samd51j18a.h" +#include "ui.h" + +volatile uint8_t usb_state; + +//! Sequence process running each \c SEQUENCE_PERIOD ms +#define SEQUENCE_PERIOD 150 + +#if 0 +/* Interrupt on "pin change" from push button to do wakeup on USB + * Note: + * This interrupt is enable when the USB host enable remote wakeup feature + * This interrupt wakeup the CPU if this one is in idle mode + */ +static void ui_wakeup_handler(void) +{ + /* It is a wakeup then send wakeup USB */ + udc_remotewakeup(); +} +#endif + +void ui_init(void) +{ + usb_state = USB_STATE_POWERUP; +} + +void ui_powerdown(void) +{ + usb_state = USB_STATE_POWERDOWN; +} + +void ui_wakeup_enable(void) +{ + +} + +void ui_wakeup_disable(void) +{ + +} + +void ui_wakeup(void) +{ + usb_state = USB_STATE_POWERUP; +} + +void ui_process(uint16_t framenumber) +{ + +} + +void ui_kbd_led(uint8_t value) +{ + +} -- cgit v1.2.3-24-g4f1b From cec203ea80c8e9365bb5f43418fba5971dd4091f Mon Sep 17 00:00:00 2001 From: patrickmt <40182064+patrickmt@users.noreply.github.com> Date: Fri, 2 Nov 2018 15:30:51 -0400 Subject: USB Suspend for arm_atsam protocol Rewrote USB state tracking for implementation of suspend state. Updated suspend.c in entirety. Main subtasks (generally hardware related) are now run prior to keyboard task. --- tmk_core/protocol/arm_atsam/usb/ui.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tmk_core/protocol/arm_atsam/usb/ui.c') diff --git a/tmk_core/protocol/arm_atsam/usb/ui.c b/tmk_core/protocol/arm_atsam/usb/ui.c index 031678b64..70a619109 100644 --- a/tmk_core/protocol/arm_atsam/usb/ui.c +++ b/tmk_core/protocol/arm_atsam/usb/ui.c @@ -52,8 +52,6 @@ #include "samd51j18a.h" #include "ui.h" -volatile uint8_t usb_state; - //! Sequence process running each \c SEQUENCE_PERIOD ms #define SEQUENCE_PERIOD 150 @@ -72,12 +70,12 @@ static void ui_wakeup_handler(void) void ui_init(void) { - usb_state = USB_STATE_POWERUP; + } void ui_powerdown(void) { - usb_state = USB_STATE_POWERDOWN; + } void ui_wakeup_enable(void) @@ -92,7 +90,7 @@ void ui_wakeup_disable(void) void ui_wakeup(void) { - usb_state = USB_STATE_POWERUP; + } void ui_process(uint16_t framenumber) -- cgit v1.2.3-24-g4f1b