Skip to content

Commit

Permalink
Convert custom split transport keyboards
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlK90 committed Jul 15, 2022
1 parent ab71953 commit d8563e1
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 396 deletions.
3 changes: 3 additions & 0 deletions keyboards/handwired/lagrange/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@

#define LED_CAPS_LOCK_PIN D1
#define LED_SCROLL_LOCK_PIN D2

/* Split communication */
#define SOFT_SERIAL_PIN B0
42 changes: 0 additions & 42 deletions keyboards/handwired/lagrange/lagrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,4 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <LUFA/Drivers/USB/USB.h>

#include "lagrange.h"

#ifndef SPLIT_USB_TIMEOUT_POLL
# define SPLIT_USB_TIMEOUT_POLL 10
#endif

/* Instead of timing out, the slave waits indefinitely for the other
* side to signal that it has become master. This avoids both sides
* assuming the slave role when the USB port is powered but not
* otherwise active (e.g. when the host is turned off, or suspended).
* The SPI SS line is used for signaling. On power-up it is
* configured as input with pull-up enabled. When one side assumes
* the master role, it reconfigures the line for SPI, and pulls it low
* to select the slave, which doubles as the signal. */

bool is_keyboard_master(void) {
static int8_t is_master = -1;

if (is_master < 0) {
while (readPin(SPI_SS_PIN)) {
if (USB_Device_IsAddressSet()) {
is_master = 1;
return is_master;
}
wait_ms(SPLIT_USB_TIMEOUT_POLL);
}

is_master = 0;

USB_Disable();
USB_DeviceState = DEVICE_STATE_Unattached;
}

return is_master;
}

void keyboard_pre_init_kb(void) {
setPinInputHigh(SPI_SS_PIN);

keyboard_pre_init_user();
}
8 changes: 0 additions & 8 deletions keyboards/handwired/lagrange/lagrange.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@

#include "quantum.h"

#if !defined(SPI_SS_PIN)
# define SPI_SS_PIN B0
#endif

#define SPI_SCK_PIN B1
#define SPI_MOSI_PIN B2
#define SPI_MISO_PIN B3

#define LAYOUT( \
l00, l01, l02, l03, l04, l05, r05, r04, r03, r02, r01, r00, \
l10, l11, l12, l13, l14, l15, r15, r14, r13, r12, r11, r10, \
Expand Down
3 changes: 0 additions & 3 deletions keyboards/handwired/lagrange/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
UNICODE_ENABLE = yes
SPLIT_KEYBOARD = yes
SPLIT_TRANSPORT = custom

SRC += transport.c spi_master.c
208 changes: 0 additions & 208 deletions keyboards/handwired/lagrange/transport.c

This file was deleted.

3 changes: 3 additions & 0 deletions keyboards/whale/sk/v3/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 3

/* Split communication */
#define SOFT_SERIAL_PIN D3
1 change: 0 additions & 1 deletion keyboards/whale/sk/v3/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output

SPLIT_KEYBOARD = yes
SPLIT_TRANSPORT = custom
Loading

0 comments on commit d8563e1

Please sign in to comment.