Skip to content

Commit

Permalink
Fix for disabled remote wakeup failure in ch9 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pschmuckal authored and Gentoli committed Jul 23, 2020
1 parent 409b028 commit 1a106ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
18 changes: 11 additions & 7 deletions tmk_core/common/arm_atsam/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#include "i2c_master.h"
#include "led_matrix.h"
#include "suspend.h"
#include "./usb/ui.h"

/** \brief Suspend idle
*
* FIXME: needs doc
*/
void suspend_idle(uint8_t time) { /* Note: Not used anywhere currently */
}
void suspend_idle(uint8_t time) { /* Note: Not used anywhere currently */ }

/** \brief Run user level Power down
*
Expand Down Expand Up @@ -37,11 +37,15 @@ void suspend_power_down(void) {
__attribute__((weak)) void matrix_power_up(void) {}
__attribute__((weak)) void matrix_power_down(void) {}
bool suspend_wakeup_condition(void) {
matrix_power_up();
matrix_scan();
matrix_power_down();
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
if (matrix_get_row(r)) return true;
if (ui_is_remotewakeup_enabled()) {
matrix_power_up();
matrix_scan();
matrix_power_down();
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
if (matrix_get_row(r)) return true;
}
} else {
matrix_power_down();
}
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions tmk_core/protocol/arm_atsam/usb/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
//! Sequence process running each \c SEQUENCE_PERIOD ms
#define SEQUENCE_PERIOD 150

static bool _isWakeupEnabled = true;
#if 0
/* Interrupt on "pin change" from push button to do wakeup on USB
* Note:
Expand All @@ -68,16 +69,18 @@ static void ui_wakeup_handler(void)
}
#endif

void ui_init(void) {}
void ui_init(void) { _isWakeupEnabled = true; }

void ui_powerdown(void) {}

void ui_wakeup_enable(void) {}
void ui_wakeup_enable(void) { _isWakeupEnabled = true; }

void ui_wakeup_disable(void) {}
void ui_wakeup_disable(void) { _isWakeupEnabled = false; }

void ui_wakeup(void) {}

void ui_process(uint16_t framenumber) {}

void ui_kbd_led(uint8_t value) {}

bool ui_is_remotewakeup_enabled(void) { return (_isWakeupEnabled); }
5 changes: 5 additions & 0 deletions tmk_core/protocol/arm_atsam/usb/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#ifndef _UI_H_
#define _UI_H_

#include <stdbool.h>

//! \brief Initializes the user interface
void ui_init(void);

Expand All @@ -59,6 +61,9 @@ void ui_wakeup_enable(void);
//! \brief Disables the asynchronous interrupts of the user interface
void ui_wakeup_disable(void);

//! \brief Returns Remote Wakeup State
bool ui_is_remotewakeup_enabled(void);

//! \brief Exits the user interface of power down mode
void ui_wakeup(void);

Expand Down

0 comments on commit 1a106ef

Please sign in to comment.