Skip to content

Commit

Permalink
Merge pull request #12 from rabbitholecomputing/master
Browse files Browse the repository at this point in the history
ADBuino compiling and working again
  • Loading branch information
morio authored May 12, 2023
2 parents 110d64e + 621c34e commit ddd9522
Show file tree
Hide file tree
Showing 45 changed files with 909 additions and 258 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/adbuino_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build ADBuino firmware

on:
push:
workflow_dispatch:

jobs:
build_adbuino:
name: Build firmware on Ubuntu 22.04
runs-on: ubuntu-22.04

steps:
- name: Check out code from GitHub
uses: actions/checkout@v3
with:
path: adbuino
fetch-depth: "0"
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
- name: Install platformio
run: |
sudo pip install platformio
- name: Build firmware
run: |
cd adbuino/src/firmware
pio run -v
- name: Rename firmware files
run: |
cd adbuino/src/firmware
utils/rename_adbuino_binaries.sh
- name: Upload binaries into build artifacts
uses: actions/upload-artifact@v3
with:
path: adbuino/src/firmware/distrib/*
name: ADBuino binaries
2 changes: 1 addition & 1 deletion .github/workflows/quokkadb_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:

jobs:
build_firmware:
build_quokkadb:
name: Build firmware on Ubuntu 22.04
runs-on: ubuntu-22.04

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ fp-info-cache
.pio
images/.DS_Store
.DS_Store
build/
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
This project has a long history with a collection of updates from several
people. This is being distributed under the GPL v2 (or later) license.
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
people. This is being distributed under the GPL v3 (or later) license.
https://www.gnu.org/licenses/gpl-3.0.txt

The following copyright notice should be included with distributions of
this source code:
Copyright 2021-2022 Tony Kuker
Copyright 2022 Rabbit Hole Computing LLC
Copyright 2021-2023 Tony Kuker
Copyright 2022-2023 Rabbit Hole Computing LLC
Copyright 2020 Difegue
Copyright 2015 Rob Braun
Copyright 2011 Jun WAKO <[email protected]>
Expand Down
2 changes: 2 additions & 0 deletions QuokkADB.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ disconnected).

## QuokkADB LED blink meanings
- On boot - one blink
- On second core and USB host driver loaded - one blink
- On keyboard mount (connected to usb) - two blinks
- On mouse mount (connected to usb)- three blinks
- On device unmount (disconnected to usb) - one blink
Expand All @@ -81,6 +82,7 @@ If both a mouse and keyboard are connected to the QuokkADB:

Turning on the Mac:
1. One blink - power on
2. One blink - second core and USB up and running
2. Two blinks - keyboard initialized
3. Three blinks - mouse initialized

Expand Down
4 changes: 2 additions & 2 deletions src/firmware/QuokkADB-supplementary-files/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"target/rp2040.cfg"
],
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
"runToMain": true,
"runToEntryPoint": "main",
// Work around for stopping at main on restart
"postRestartCommands": [
"break main",
Expand All @@ -27,4 +27,4 @@
"searchDir": ["${env:HOME}/openocd/tcl"],
}
]
}
}
2 changes: 1 addition & 1 deletion src/firmware/boards/quokkadb.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#define PICO_FLASH_SPI_CLKDIV 4
#endif

#ifndef PICO_FLASH_SIZE_BYTES
Expand Down
2 changes: 1 addition & 1 deletion src/firmware/include/quokkadb_tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
#define CFG_TUSB_DEBUG 0
// #define CFG_TUSB_DEBUG 3
//#define CFG_TUSB_DEBUG 3


/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
Expand Down
2 changes: 1 addition & 1 deletion src/firmware/lib/QuokkADB/include/adb_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <hardware/timer.h>
#include <pico/time.h>

extern bool adb_collision;
extern bool volatile adb_collision;

inline uint32_t millis()
{
Expand Down
11 changes: 0 additions & 11 deletions src/firmware/lib/QuokkADB/include/char2usbkeycode.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#pragma once

// Use macros for version number
#define FW_VER_NUM "0.2.0"
#define FW_VER_NUM "0.2.4"
#define FW_VER_SUFFIX "beta"
#define QUOKKADB_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
#define PLATFORM_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
#define PRODUCT_NAME "QuokkADB"
#define QUOKKADB_FW_VER_STRING PRODUCT_NAME " firmware: " QUOKKADB_FW_VERSION " " __DATE__ " " __TIME__ " "
#define PLATFORM_FW_VER_STRING PRODUCT_NAME " firmware: " PLATFORM_FW_VERSION " " __DATE__ " " __TIME__ " "

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,33 @@

#include <stdint.h>
#include "tusb.h"
#include "scqueue.h"

using simple_circular_queue::SCQueue;

#define KEYBOARD_QUEUE_CAPACITY (20)

class KeyEvent
{
public:
static const uint8_t NoKey = 0xFF;
static const uint8_t KeyDown = 0x01;
static const uint8_t KeyUp = 0x02;
inline uint8_t GetKeycode() { return m_keycode; }
inline bool IsKeyUp() { return m_key_updown == KeyUp; }
inline bool IsKeyDown() { return m_key_updown == KeyDown; }
KeyEvent(uint8_t KeyCode, uint8_t KeyUpDown, uint8_t mod)
{
m_key_updown = KeyUpDown;
m_keycode = KeyCode;
m_mod = mod;
}

protected:
uint8_t m_keycode;
uint8_t m_key_updown;
uint8_t m_mod;
};
//----------------------------------------------------------------------------
// Keyboard handler
//----------------------------------------------------------------------------
Expand Down Expand Up @@ -91,7 +117,7 @@ struct KeyboardDevices
bool in_use;
};

class KeyboardReportParser {
class PlatformKbdParser {

static const uint8_t numKeys[10];
static const uint8_t symKeysUp[12];
Expand All @@ -118,15 +144,15 @@ class KeyboardReportParser {

public:

KeyboardReportParser();
virtual ~KeyboardReportParser();
PlatformKbdParser();
virtual ~PlatformKbdParser();
void Parse(uint8_t dev_addr, uint8_t instance, hid_keyboard_report_t const *report);
bool SpecialKeyCombo(KBDINFO *cur_kbd_info);
void SendString(const char* message);
void AddKeyboard(uint8_t dev_addr, uint8_t instance);
void RemoveKeyboard(uint8_t dev_addr, uint8_t instance);
// Sets the LEDs to shared memory
void SetUSBkeyboardLEDs(bool capslock, bool numlock, bool scrolllock);
void SetUSBkeyboardLEDs(bool capslock, bool numlock, bool scrollock);
// Executes the LED changes from shared memory (meant to be run on the same core as tuh_task)
void ChangeUSBKeyboardLEDs(void);

Expand All @@ -135,10 +161,12 @@ class KeyboardReportParser {
virtual void OnKeyDown(uint8_t mod __attribute__((unused)), uint8_t key __attribute__((unused))) = 0;

virtual void OnKeyUp(uint8_t mod __attribute__((unused)), uint8_t key __attribute__((unused))) = 0;
virtual void OnControlKeysChanged(uint8_t before __attribute__((unused)), uint8_t after __attribute__((unused))) = 0;


protected:

SCQueue<KeyEvent*, KEYBOARD_QUEUE_CAPACITY> m_keyboard_events;

uint8_t HandleLockingKeys(uint8_t dev_addr, uint8_t instance, uint8_t key) {
uint8_t old_keys = kbdLockingKeys.bLeds;

Expand All @@ -164,8 +192,6 @@ class KeyboardReportParser {
return 0;
};

virtual void OnModifierKeysChanged(uint8_t before __attribute__((unused)), uint8_t after __attribute__((unused))) = 0;



const uint8_t *getNumKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include <stdint.h>
#include "tusb.h"
#include "keyboardrptparser.h"
#include "platformkbdparser.h"

//----------------------------------------------------------------------------
// Mouse handler
Expand All @@ -51,7 +51,7 @@ struct MOUSEINFO {
int8_t dY;
};

class MouseReportParser {
class PlatformMouseParser {

union {
MOUSEINFO mouseInfo;
Expand Down Expand Up @@ -83,5 +83,5 @@ class MouseReportParser {
virtual void OnMiddleButtonDown(MOUSEINFO *mi __attribute__((unused))) {
};

KeyboardReportParser* m_keyboard;
PlatformKbdParser* m_keyboard;
};
5 changes: 2 additions & 3 deletions src/firmware/lib/QuokkADB/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

add_library(QuokkADB
adb_platform.cpp
char2usbkeycode.cpp
flashsettings.cpp
keyboardrptparser.cpp
mouserptparser.cpp
platformkbdparser.cpp
platformmouseparser.cpp
quokkadb_gpio.cpp
quokkadb.cpp
rp2040_serial.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/firmware/lib/QuokkADB/src/adb_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ bool AdbInterfacePlatform::adb_delay_us(uint32_t delay)
return collision_free;
}

extern bool adb_collision;
extern bool collision_detection;
extern volatile bool adb_collision;
extern volatile bool collision_detection;
extern ADBKbdRptParser KeyboardPrs;

static void adb_in_irq_callback(uint gpio, uint32_t event_mask) {
Expand Down
24 changes: 24 additions & 0 deletions src/firmware/lib/QuokkADB/src/flashsettings.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
//---------------------------------------------------------------------------
//
// QuokkaADB ADB keyboard and mouse adapter
//
// Copyright (C) 2017 bbraun
// Copyright (C) 2021-2022 akuker
// Copyright (C) 2022 Rabbit Hole Computing LLC
//
// This file is part of the QuokkaADB project.
//
// This file is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This file is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along
// with the file. If not, see <https://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "flashsettings.h"
#include "pico/multicore.h"
#include "string.h"
Expand Down
Loading

0 comments on commit ddd9522

Please sign in to comment.