summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/arm_atsam
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2021-06-29 12:23:03 -0700
committerDrashna Jael're <drashna@live.com>2021-06-29 12:24:07 -0700
commitacf2c323e2927f6007b17ded577cf49fd86fec6c (patch)
tree8334dc5c71e6ab9bf33c76143eac7bb0e60159b0 /tmk_core/protocol/arm_atsam
parentec7a7beeed3046e9144d4c4ce0ef3b2c4f9e4341 (diff)
parentf55e39e8a2246f6f96fd5d4a84a866e2615cde7b (diff)
Merge upstream QMK Firmware at '0.12.52~1'
Diffstat (limited to 'tmk_core/protocol/arm_atsam')
-rw-r--r--tmk_core/protocol/arm_atsam/i2c_master.c3
-rw-r--r--tmk_core/protocol/arm_atsam/i2c_master.h4
-rw-r--r--tmk_core/protocol/arm_atsam/main_arm_atsam.c6
-rw-r--r--tmk_core/protocol/arm_atsam/md_rgb_matrix.c94
-rw-r--r--tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c8
-rw-r--r--tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c42
-rw-r--r--tmk_core/protocol/arm_atsam/usb/usb_protocol_hid.h7
7 files changed, 81 insertions, 83 deletions
diff --git a/tmk_core/protocol/arm_atsam/i2c_master.c b/tmk_core/protocol/arm_atsam/i2c_master.c
index d3319ab447..dda2f85b00 100644
--- a/tmk_core/protocol/arm_atsam/i2c_master.c
+++ b/tmk_core/protocol/arm_atsam/i2c_master.c
@@ -28,6 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define I2C_LED_USE_DMA 1 // Set 1 to use background DMA transfers for leds, Set 0 to use inline software transfers
+DmacDescriptor dmac_desc;
+DmacDescriptor dmac_desc_wb;
+
static uint8_t i2c_led_q[I2C_Q_SIZE]; // I2C queue circular buffer
static uint8_t i2c_led_q_s; // Start of circular buffer
static uint8_t i2c_led_q_e; // End of circular buffer
diff --git a/tmk_core/protocol/arm_atsam/i2c_master.h b/tmk_core/protocol/arm_atsam/i2c_master.h
index 44dbdfbffa..68773f213f 100644
--- a/tmk_core/protocol/arm_atsam/i2c_master.h
+++ b/tmk_core/protocol/arm_atsam/i2c_master.h
@@ -24,8 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "issi3733_driver.h"
# include "config.h"
-__attribute__((__aligned__(16))) DmacDescriptor dmac_desc;
-__attribute__((__aligned__(16))) DmacDescriptor dmac_desc_wb;
+extern __attribute__((__aligned__(16))) DmacDescriptor dmac_desc;
+extern __attribute__((__aligned__(16))) DmacDescriptor dmac_desc_wb;
uint8_t I2C3733_Init_Control(void);
uint8_t I2C3733_Init_Drivers(void);
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
index e10be52fb8..ab5e9a9852 100644
--- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c
+++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
@@ -305,11 +305,5 @@ int main(void) {
// dprintf("5v=%u 5vu=%u dlow=%u dhi=%u gca=%u gcd=%u\r\n", v_5v, v_5v_avg, v_5v_avg - V5_LOW, v_5v_avg - V5_HIGH, gcr_actual, gcr_desired);
}
#endif // CONSOLE_ENABLE
-
- // Run housekeeping
- housekeeping_task_kb();
- housekeeping_task_user();
- }
-
return 1;
}
diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c
index b337df7627..2b0805dc86 100644
--- a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c
+++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c
@@ -15,16 +15,17 @@ 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 "arm_atsam_protocol.h"
-#include "tmk_core/common/led.h"
-#include "rgb_matrix.h"
-#include <string.h>
-#include <math.h>
-
-#ifdef USE_MASSDROP_CONFIGURATOR
+#ifdef RGB_MATRIX_ENABLE
+# include "arm_atsam_protocol.h"
+# include "led.h"
+# include "rgb_matrix.h"
+# include <string.h>
+# include <math.h>
+
+# ifdef USE_MASSDROP_CONFIGURATOR
__attribute__((weak)) led_instruction_t led_instructions[] = {{.end = 1}};
static void md_rgb_matrix_config_override(int i);
-#endif // USE_MASSDROP_CONFIGURATOR
+# endif // USE_MASSDROP_CONFIGURATOR
void SERCOM1_0_Handler(void) {
if (SERCOM1->I2CM.INTFLAG.bit.ERROR) {
@@ -58,17 +59,17 @@ RGB led_buffer[ISSI3733_LED_COUNT];
uint8_t gcr_desired;
uint8_t gcr_actual;
uint8_t gcr_actual_last;
-#ifdef USE_MASSDROP_CONFIGURATOR
+# ifdef USE_MASSDROP_CONFIGURATOR
uint8_t gcr_breathe;
float breathe_mult;
float pomod;
-#endif
+# endif
-#define ACT_GCR_NONE 0
-#define ACT_GCR_INC 1
-#define ACT_GCR_DEC 2
+# define ACT_GCR_NONE 0
+# define ACT_GCR_INC 1
+# define ACT_GCR_DEC 2
-#define LED_GCR_STEP_AUTO 2
+# define LED_GCR_STEP_AUTO 2
static uint8_t gcr_min_counter;
static uint8_t v_5v_cat_hit;
@@ -78,11 +79,11 @@ void gcr_compute(void) {
uint8_t action = ACT_GCR_NONE;
uint8_t gcr_use = gcr_desired;
-#ifdef USE_MASSDROP_CONFIGURATOR
+# ifdef USE_MASSDROP_CONFIGURATOR
if (led_animation_breathing) {
gcr_use = gcr_breathe;
}
-#endif
+# endif
// If the 5v takes a catastrophic hit, disable the LED drivers briefly, assert auto gcr mode, min gcr and let the auto take over
if (v_5v < V5_CAT) {
@@ -150,7 +151,7 @@ void gcr_compute(void) {
gcr_actual -= LED_GCR_STEP_AUTO;
gcr_min_counter = 0;
-#ifdef USE_MASSDROP_CONFIGURATOR
+# ifdef USE_MASSDROP_CONFIGURATOR
// If breathe mode is active, the top end can fluctuate if the host can not supply enough current
// So set the breathe GCR to where it becomes stable
if (led_animation_breathing == 1) {
@@ -159,7 +160,7 @@ void gcr_compute(void) {
// and the same would happen maybe one or two more times. Therefore I'm favoring
// powering through one full breathe and letting gcr settle completely
}
-#endif
+# endif
}
}
}
@@ -196,25 +197,25 @@ void md_rgb_matrix_prepare(void) {
}
}
-void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) {
+static void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) {
if (i < ISSI3733_LED_COUNT) {
-#ifdef USE_MASSDROP_CONFIGURATOR
+# ifdef USE_MASSDROP_CONFIGURATOR
md_rgb_matrix_config_override(i);
-#else
+# else
led_buffer[i].r = r;
led_buffer[i].g = g;
led_buffer[i].b = b;
-#endif
+# endif
}
}
-void led_set_all(uint8_t r, uint8_t g, uint8_t b) {
+static void led_set_all(uint8_t r, uint8_t g, uint8_t b) {
for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) {
led_set_one(i, r, g, b);
}
}
-void init(void) {
+static void init(void) {
DBGC(DC_LED_MATRIX_INIT_BEGIN);
issi3733_prepare_arrays();
@@ -227,16 +228,16 @@ void init(void) {
DBGC(DC_LED_MATRIX_INIT_COMPLETE);
}
-void flush(void) {
-#ifdef USE_MASSDROP_CONFIGURATOR
+static void flush(void) {
+# ifdef USE_MASSDROP_CONFIGURATOR
if (!led_enabled) {
return;
} // Prevent calculations and I2C traffic if LED drivers are not enabled
-#else
+# else
if (!sr_exp_data.bit.SDB_N) {
return;
} // Prevent calculations and I2C traffic if LED drivers are not enabled
-#endif
+# endif
// Wait for previous transfer to complete
while (i2c_led_q_running) {
@@ -249,7 +250,7 @@ void flush(void) {
*led_map[i].rgb.b = led_buffer[i].b;
}
-#ifdef USE_MASSDROP_CONFIGURATOR
+# ifdef USE_MASSDROP_CONFIGURATOR
breathe_mult = 1;
if (led_animation_breathing) {
@@ -275,7 +276,7 @@ void flush(void) {
pomod = (uint32_t)pomod % 10000;
pomod /= 100.0f;
-#endif // USE_MASSDROP_CONFIGURATOR
+# endif // USE_MASSDROP_CONFIGURATOR
uint8_t drvid;
@@ -295,25 +296,27 @@ void md_rgb_matrix_indicators(void) {
if (kbled && rgb_matrix_config.enable) {
for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) {
if (
-#if USB_LED_NUM_LOCK_SCANCODE != 255
+# if USB_LED_NUM_LOCK_SCANCODE != 255
(led_map[i].scan == USB_LED_NUM_LOCK_SCANCODE && (kbled & (1 << USB_LED_NUM_LOCK))) ||
-#endif // NUM LOCK
-#if USB_LED_CAPS_LOCK_SCANCODE != 255
+# endif // NUM LOCK
+# if USB_LED_CAPS_LOCK_SCANCODE != 255
(led_map[i].scan == USB_LED_CAPS_LOCK_SCANCODE && (kbled & (1 << USB_LED_CAPS_LOCK))) ||
-#endif // CAPS LOCK
-#if USB_LED_SCROLL_LOCK_SCANCODE != 255
+# endif // CAPS LOCK
+# if USB_LED_SCROLL_LOCK_SCANCODE != 255
(led_map[i].scan == USB_LED_SCROLL_LOCK_SCANCODE && (kbled & (1 << USB_LED_SCROLL_LOCK))) ||
-#endif // SCROLL LOCK
-#if USB_LED_COMPOSE_SCANCODE != 255
+# endif // SCROLL LOCK
+# if USB_LED_COMPOSE_SCANCODE != 255
(led_map[i].scan == USB_LED_COMPOSE_SCANCODE && (kbled & (1 << USB_LED_COMPOSE))) ||
-#endif // COMPOSE
-#if USB_LED_KANA_SCANCODE != 255
+# endif // COMPOSE
+# if USB_LED_KANA_SCANCODE != 255
(led_map[i].scan == USB_LED_KANA_SCANCODE && (kbled & (1 << USB_LED_KANA))) ||
-#endif // KANA
+# endif // KANA
(0)) {
- led_buffer[i].r = 255 - led_buffer[i].r;
- led_buffer[i].g = 255 - led_buffer[i].g;
- led_buffer[i].b = 255 - led_buffer[i].b;
+ if (rgb_matrix_get_flags() & LED_FLAG_INDICATOR) {
+ led_buffer[i].r = 255 - led_buffer[i].r;
+ led_buffer[i].g = 255 - led_buffer[i].g;
+ led_buffer[i].b = 255 - led_buffer[i].b;
+ }
}
}
}
@@ -325,7 +328,7 @@ const rgb_matrix_driver_t rgb_matrix_driver = {.init = init, .flush = flush, .se
= Legacy Lighting Support =
==============================================================================*/
-#ifdef USE_MASSDROP_CONFIGURATOR
+# ifdef USE_MASSDROP_CONFIGURATOR
// Ported from Massdrop QMK GitHub Repo
// TODO?: wire these up to keymap.c
@@ -467,4 +470,5 @@ static void md_rgb_matrix_config_override(int i) {
led_buffer[i].b = (uint8_t)bo;
}
-#endif // USE_MASSDROP_CONFIGURATOR
+# endif // USE_MASSDROP_CONFIGURATOR
+#endif // RGB_MATRIX_ENABLE
diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c
index b43008cc5b..fce225a6c4 100644
--- a/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c
+++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c
@@ -15,9 +15,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef USE_MASSDROP_CONFIGURATOR
+#ifdef RGB_MATRIX_ENABLE
+# ifdef USE_MASSDROP_CONFIGURATOR
-# include "md_rgb_matrix.h"
+# include "md_rgb_matrix.h"
// Teal <-> Salmon
led_setup_t leds_teal_salmon[] = {
@@ -96,4 +97,5 @@ void *led_setups[] = {leds_rainbow_s, leds_rainbow_ns, leds_teal_salmon, leds_ye
const uint8_t led_setups_count = sizeof(led_setups) / sizeof(led_setups[0]);
-#endif
+# endif // USE_MASSDROP_CONFIGURATOR
+#endif // RGB_MATRIX_ENABLE
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c
index e3fa65574e..9ea4addcfc 100644
--- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c
+++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c
@@ -374,39 +374,33 @@ static uint8_t udi_hid_exk_report_trans[UDI_HID_EXK_REPORT_SIZE];
COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_exk_report_desc_t udi_hid_exk_report_desc = {{
+ // clang-format off
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x80, // Usage (System Control)
0xA1, 0x01, // Collection (Application)
0x85, REPORT_ID_SYSTEM, // Report ID
- 0x1A, 0x81,
- 0x00, // Usage Minimum (81) (System Power Down)
- 0x2A, 0x83,
- 0x00, // Usage Maximum (83) (System Wake Up)
- 0x16, 0x01,
- 0x00, // Logical Minimum (1)
- 0x26, 0x03,
- 0x00, // Logical Maximum (3)
- 0x95, 0x01, // Report Count (1)
- 0x75, 0x10, // Report Size (16)
- 0x81, 0x00, // Input (Data, Array, Absolute)
- 0xC0, // End Collection
+ 0x19, 0x01, // Usage Minimum (Pointer)
+ 0x2A, 0xB7, 0x00, // Usage Maximum (System Display LCD Autoscale)
+ 0x15, 0x01, // Logical Minimum
+ 0x26, 0xB7, 0x00, // Logical Maximum
+ 0x95, 0x01, // Report Count (1)
+ 0x75, 0x10, // Report Size (16)
+ 0x81, 0x00, // Input (Data, Array, Absolute)
+ 0xC0, // End Collection
0x05, 0x0C, // Usage Page (Consumer)
0x09, 0x01, // Usage (Consumer Control)
0xA1, 0x01, // Collection (Application)
0x85, REPORT_ID_CONSUMER, // Report ID
- 0x1A, 0x01,
- 0x00, // Usage Minimum (Consumer Control)
- 0x2A, 0x9C,
- 0x02, // Usage Maximum (AC Distribute Vertically)
- 0x16, 0x01,
- 0x00, // Logical Minimum
- 0x26, 0x9C,
- 0x02, // Logical Maximum
- 0x95, 0x01, // Report Count (1)
- 0x75, 0x10, // Report Size (16)
- 0x81, 0x00, // Input (Data, Array, Absolute)
- 0xC0 // End Collection
+ 0x19, 0x01, // Usage Minimum (Consumer Control)
+ 0x2A, 0xA0, 0x02, // Usage Maximum (AC Desktop Show All Applications)
+ 0x15, 0x01, // Logical Minimum
+ 0x26, 0xA0, 0x02, // Logical Maximum
+ 0x95, 0x01, // Report Count (1)
+ 0x75, 0x10, // Report Size (16)
+ 0x81, 0x00, // Input (Data, Array, Absolute)
+ 0xC0 // End Collection
+ //clang-format on
}};
static bool udi_hid_exk_setreport(void);
diff --git a/tmk_core/protocol/arm_atsam/usb/usb_protocol_hid.h b/tmk_core/protocol/arm_atsam/usb/usb_protocol_hid.h
index 2f8a39bdd8..fb97f63cef 100644
--- a/tmk_core/protocol/arm_atsam/usb/usb_protocol_hid.h
+++ b/tmk_core/protocol/arm_atsam/usb/usb_protocol_hid.h
@@ -186,9 +186,10 @@ COMPILER_PACK_RESET()
#define USB_HID_COUNTRY_UK 32 // UK
#define USB_HID_COUNTRY_US 33 // US
#define USB_HID_COUNTRY_YUGOSLAVIA 34 // Yugoslavia
-#define USB_HID_COUNTRY_TURKISH_F 35 // Turkish-F
- //! @}
- //! @}
+#define USB_HID_COUNTRY_TURKISH_F \
+ 35 // Turkish-F
+ //! @}
+ //! @}
//! @}
//! \name HID KEYS values