Skip to content

Commit ddd9522

Browse files
authored
Merge pull request #12 from rabbitholecomputing/master
ADBuino compiling and working again
2 parents 110d64e + 621c34e commit ddd9522

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+909
-258
lines changed

.github/workflows/adbuino_build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build ADBuino firmware
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build_adbuino:
9+
name: Build firmware on Ubuntu 22.04
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
- name: Check out code from GitHub
14+
uses: actions/checkout@v3
15+
with:
16+
path: adbuino
17+
fetch-depth: "0"
18+
- name: Install packages
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y python3-pip
22+
- name: Install platformio
23+
run: |
24+
sudo pip install platformio
25+
26+
- name: Build firmware
27+
run: |
28+
cd adbuino/src/firmware
29+
pio run -v
30+
31+
- name: Rename firmware files
32+
run: |
33+
cd adbuino/src/firmware
34+
utils/rename_adbuino_binaries.sh
35+
36+
- name: Upload binaries into build artifacts
37+
uses: actions/upload-artifact@v3
38+
with:
39+
path: adbuino/src/firmware/distrib/*
40+
name: ADBuino binaries

.github/workflows/quokkadb_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
build_firmware:
8+
build_quokkadb:
99
name: Build firmware on Ubuntu 22.04
1010
runs-on: ubuntu-22.04
1111

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ fp-info-cache
2929
.pio
3030
images/.DS_Store
3131
.DS_Store
32+
build/

LICENSE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
This project has a long history with a collection of updates from several
2-
people. This is being distributed under the GPL v2 (or later) license.
3-
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
2+
people. This is being distributed under the GPL v3 (or later) license.
3+
https://www.gnu.org/licenses/gpl-3.0.txt
44

55
The following copyright notice should be included with distributions of
66
this source code:
7-
Copyright 2021-2022 Tony Kuker
8-
Copyright 2022 Rabbit Hole Computing LLC
7+
Copyright 2021-2023 Tony Kuker
8+
Copyright 2022-2023 Rabbit Hole Computing LLC
99
Copyright 2020 Difegue
1010
Copyright 2015 Rob Braun
1111
Copyright 2011 Jun WAKO <[email protected]>

QuokkADB.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ disconnected).
7171

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

8283
Turning on the Mac:
8384
1. One blink - power on
85+
2. One blink - second core and USB up and running
8486
2. Two blinks - keyboard initialized
8587
3. Three blinks - mouse initialized
8688

src/firmware/QuokkADB-supplementary-files/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"target/rp2040.cfg"
1919
],
2020
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
21-
"runToMain": true,
21+
"runToEntryPoint": "main",
2222
// Work around for stopping at main on restart
2323
"postRestartCommands": [
2424
"break main",
@@ -27,4 +27,4 @@
2727
"searchDir": ["${env:HOME}/openocd/tcl"],
2828
}
2929
]
30-
}
30+
}

src/firmware/boards/quokkadb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
4343

4444
#ifndef PICO_FLASH_SPI_CLKDIV
45-
#define PICO_FLASH_SPI_CLKDIV 2
45+
#define PICO_FLASH_SPI_CLKDIV 4
4646
#endif
4747

4848
#ifndef PICO_FLASH_SIZE_BYTES

src/firmware/include/quokkadb_tusb_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
5252
#define CFG_TUSB_DEBUG 0
53-
// #define CFG_TUSB_DEBUG 3
53+
//#define CFG_TUSB_DEBUG 3
5454

5555

5656
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.

src/firmware/lib/QuokkADB/include/adb_platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <hardware/timer.h>
3131
#include <pico/time.h>
3232

33-
extern bool adb_collision;
33+
extern bool volatile adb_collision;
3434

3535
inline uint32_t millis()
3636
{

src/firmware/lib/QuokkADB/include/char2usbkeycode.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/firmware/lib/QuokkADB/include/quokkadb_config.h renamed to src/firmware/lib/QuokkADB/include/platform_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#pragma once
2626

2727
// Use macros for version number
28-
#define FW_VER_NUM "0.2.0"
28+
#define FW_VER_NUM "0.2.4"
2929
#define FW_VER_SUFFIX "beta"
30-
#define QUOKKADB_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
30+
#define PLATFORM_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
3131
#define PRODUCT_NAME "QuokkADB"
32-
#define QUOKKADB_FW_VER_STRING PRODUCT_NAME " firmware: " QUOKKADB_FW_VERSION " " __DATE__ " " __TIME__ " "
32+
#define PLATFORM_FW_VER_STRING PRODUCT_NAME " firmware: " PLATFORM_FW_VERSION " " __DATE__ " " __TIME__ " "
3333

src/firmware/lib/QuokkADB/include/keyboardrptparser.h renamed to src/firmware/lib/QuokkADB/include/platformkbdparser.h

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,33 @@
3333

3434
#include <stdint.h>
3535
#include "tusb.h"
36+
#include "scqueue.h"
3637

38+
using simple_circular_queue::SCQueue;
39+
40+
#define KEYBOARD_QUEUE_CAPACITY (20)
41+
42+
class KeyEvent
43+
{
44+
public:
45+
static const uint8_t NoKey = 0xFF;
46+
static const uint8_t KeyDown = 0x01;
47+
static const uint8_t KeyUp = 0x02;
48+
inline uint8_t GetKeycode() { return m_keycode; }
49+
inline bool IsKeyUp() { return m_key_updown == KeyUp; }
50+
inline bool IsKeyDown() { return m_key_updown == KeyDown; }
51+
KeyEvent(uint8_t KeyCode, uint8_t KeyUpDown, uint8_t mod)
52+
{
53+
m_key_updown = KeyUpDown;
54+
m_keycode = KeyCode;
55+
m_mod = mod;
56+
}
57+
58+
protected:
59+
uint8_t m_keycode;
60+
uint8_t m_key_updown;
61+
uint8_t m_mod;
62+
};
3763
//----------------------------------------------------------------------------
3864
// Keyboard handler
3965
//----------------------------------------------------------------------------
@@ -91,7 +117,7 @@ struct KeyboardDevices
91117
bool in_use;
92118
};
93119

94-
class KeyboardReportParser {
120+
class PlatformKbdParser {
95121

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

119145
public:
120146

121-
KeyboardReportParser();
122-
virtual ~KeyboardReportParser();
147+
PlatformKbdParser();
148+
virtual ~PlatformKbdParser();
123149
void Parse(uint8_t dev_addr, uint8_t instance, hid_keyboard_report_t const *report);
124150
bool SpecialKeyCombo(KBDINFO *cur_kbd_info);
125151
void SendString(const char* message);
126152
void AddKeyboard(uint8_t dev_addr, uint8_t instance);
127153
void RemoveKeyboard(uint8_t dev_addr, uint8_t instance);
128154
// Sets the LEDs to shared memory
129-
void SetUSBkeyboardLEDs(bool capslock, bool numlock, bool scrolllock);
155+
void SetUSBkeyboardLEDs(bool capslock, bool numlock, bool scrollock);
130156
// Executes the LED changes from shared memory (meant to be run on the same core as tuh_task)
131157
void ChangeUSBKeyboardLEDs(void);
132158

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

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

139166

140167
protected:
141-
168+
SCQueue<KeyEvent*, KEYBOARD_QUEUE_CAPACITY> m_keyboard_events;
169+
142170
uint8_t HandleLockingKeys(uint8_t dev_addr, uint8_t instance, uint8_t key) {
143171
uint8_t old_keys = kbdLockingKeys.bLeds;
144172

@@ -164,8 +192,6 @@ class KeyboardReportParser {
164192
return 0;
165193
};
166194

167-
virtual void OnModifierKeysChanged(uint8_t before __attribute__((unused)), uint8_t after __attribute__((unused))) = 0;
168-
169195

170196

171197
const uint8_t *getNumKeys() {

src/firmware/lib/QuokkADB/include/mouserptparser.h renamed to src/firmware/lib/QuokkADB/include/platformmouseparser.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#include <stdint.h>
3535
#include "tusb.h"
36-
#include "keyboardrptparser.h"
36+
#include "platformkbdparser.h"
3737

3838
//----------------------------------------------------------------------------
3939
// Mouse handler
@@ -51,7 +51,7 @@ struct MOUSEINFO {
5151
int8_t dY;
5252
};
5353

54-
class MouseReportParser {
54+
class PlatformMouseParser {
5555

5656
union {
5757
MOUSEINFO mouseInfo;
@@ -83,5 +83,5 @@ class MouseReportParser {
8383
virtual void OnMiddleButtonDown(MOUSEINFO *mi __attribute__((unused))) {
8484
};
8585

86-
KeyboardReportParser* m_keyboard;
86+
PlatformKbdParser* m_keyboard;
8787
};

src/firmware/lib/QuokkADB/src/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11

22
add_library(QuokkADB
33
adb_platform.cpp
4-
char2usbkeycode.cpp
54
flashsettings.cpp
6-
keyboardrptparser.cpp
7-
mouserptparser.cpp
5+
platformkbdparser.cpp
6+
platformmouseparser.cpp
87
quokkadb_gpio.cpp
98
quokkadb.cpp
109
rp2040_serial.cpp

src/firmware/lib/QuokkADB/src/adb_platform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ bool AdbInterfacePlatform::adb_delay_us(uint32_t delay)
4444
return collision_free;
4545
}
4646

47-
extern bool adb_collision;
48-
extern bool collision_detection;
47+
extern volatile bool adb_collision;
48+
extern volatile bool collision_detection;
4949
extern ADBKbdRptParser KeyboardPrs;
5050

5151
static void adb_in_irq_callback(uint gpio, uint32_t event_mask) {

src/firmware/lib/QuokkADB/src/flashsettings.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
//---------------------------------------------------------------------------
2+
//
3+
// QuokkaADB ADB keyboard and mouse adapter
4+
//
5+
// Copyright (C) 2017 bbraun
6+
// Copyright (C) 2021-2022 akuker
7+
// Copyright (C) 2022 Rabbit Hole Computing LLC
8+
//
9+
// This file is part of the QuokkaADB project.
10+
//
11+
// This file is free software: you can redistribute it and/or modify it under
12+
// the terms of the GNU General Public License as published by the Free
13+
// Software Foundation, either version 3 of the License, or (at your option)
14+
// any later version.
15+
//
16+
// This file is distributed in the hope that it will be useful, but WITHOUT ANY
17+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18+
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19+
// details.
20+
//
21+
// You should have received a copy of the GNU General Public License along
22+
// with the file. If not, see <https://www.gnu.org/licenses/>.
23+
//
24+
//---------------------------------------------------------------------------
125
#include "flashsettings.h"
226
#include "pico/multicore.h"
327
#include "string.h"

0 commit comments

Comments
 (0)