Skip to content

Commit 57f3700

Browse files
Merge branch 'master' into usb_ncm_new
2 parents 5aa6573 + 30aead9 commit 57f3700

File tree

12 files changed

+361
-18
lines changed

12 files changed

+361
-18
lines changed

boards.txt

Lines changed: 234 additions & 0 deletions
Large diffs are not rendered by default.

cores/rp2040/RP2040Support.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ extern RP2040 rp2040;
276276
extern void main1();
277277
extern "C" char __StackLimit;
278278
extern "C" char __bss_end__;
279+
extern "C" uint32_t __scratch_x_start__;
280+
extern "C" uint32_t __scratch_y_start__;
279281
extern "C" void setup1() __attribute__((weak));
280282
extern "C" void loop1() __attribute__((weak));
281283
extern "C" bool core1_separate_stack;
@@ -477,12 +479,12 @@ class RP2040 {
477479
*/
478480
inline int getFreeStack() {
479481
const unsigned int sp = getStackPointer();
480-
uint32_t ref = 0x20040000;
482+
uint32_t ref = (uint32_t)&__scratch_x_start__;
481483
if (setup1 || loop1) {
482484
if (core1_separate_stack) {
483-
ref = cpuid() ? (unsigned int)core1_separate_stack_address : 0x20040000;
485+
ref = (uint32_t)(cpuid() ? core1_separate_stack_address : &__scratch_x_start__);
484486
} else {
485-
ref = cpuid() ? 0x20040000 : 0x20041000;
487+
ref = (uint32_t)(cpuid() ? &__scratch_x_start__ : &__scratch_y_start__);
486488
}
487489
}
488490
return sp - ref;

cores/rp2040/SerialPIO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ void SerialPIO::flush() {
355355
return;
356356
}
357357
while (!pio_sm_is_tx_fifo_empty(_txPIO, _txSM)) {
358-
delay(1); // Wait for all FIFO to be read
358+
/* noop */ // Busy wait for all FIFO to be read
359359
}
360360
// Could have 1 byte being transmitted, so wait for bit times
361-
delay((1000 * (_txBits + 1)) / _baud);
361+
delayMicroseconds((1000000 * (_txBits + 3 /* start + stop + parity */)) / _baud);
362362
}
363363

364364
size_t SerialPIO::write(uint8_t c) {

cores/rp2040/sdkoverride/tusb_gamepad16.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,4 @@
6262
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
6363
HID_COLLECTION_END \
6464

65-
// HID Gamepad Protocol Report.
66-
typedef struct TU_ATTR_PACKED {
67-
int16_t x; ///< Delta x movement of left analog-stick
68-
int16_t y; ///< Delta y movement of left analog-stick
69-
int16_t z; ///< Delta z movement of right analog-joystick
70-
int16_t rz; ///< Delta Rz movement of right analog-joystick
71-
int16_t rx; ///< Delta Rx movement of analog left trigger
72-
int16_t ry; ///< Delta Ry movement of analog right trigger
73-
uint8_t hat; ///< Buttons mask for currently pressed buttons in the DPad/hat
74-
uint32_t buttons; ///< Buttons mask for currently pressed buttons
75-
} hid_gamepad16_report_t;
65+
#include "tusb_gamepad16_report.h"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include <stdint.h>
4+
5+
// HID Gamepad Protocol Report.
6+
typedef struct TU_ATTR_PACKED {
7+
int16_t x; ///< Delta x movement of left analog-stick
8+
int16_t y; ///< Delta y movement of left analog-stick
9+
int16_t z; ///< Delta z movement of right analog-joystick
10+
int16_t rz; ///< Delta Rz movement of right analog-joystick
11+
int16_t rx; ///< Delta Rx movement of analog left trigger
12+
int16_t ry; ///< Delta Ry movement of analog right trigger
13+
uint8_t hat; ///< Buttons mask for currently pressed buttons in the DPad/hat
14+
uint32_t buttons; ///< Buttons mask for currently pressed buttons
15+
} hid_gamepad16_report_t;

libraries/Joystick/src/Joystick.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "tusb.h"
2929
#include "class/hid/hid_device.h"
30+
#include <sdkoverride/tusb_gamepad16.h>
3031

3132
static const uint8_t desc_hid_report_joystick[] = { TUD_HID_REPORT_DESC_GAMEPAD16(HID_REPORT_ID(1)) };
3233

libraries/Joystick/src/Joystick.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#endif
2626

2727
#include <HID_Joystick.h>
28-
#include <class/hid/hid.h>
2928

3029
//======================================================================
3130
class Joystick_ : public HID_Joystick {

package/package_pico_index.template.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@
365365
{
366366
"name": "VCC-GND YD RP2040"
367367
},
368+
{
369+
"name": "Vicharak Shrike-Lite"
370+
},
368371
{
369372
"name": "Viyalab Mizu RP2040"
370373
},
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"earlephilhower": {
5+
"boot2_source": "boot2_generic_03h_4_padded_checksum.S",
6+
"usb_vid": "0x2E8A",
7+
"usb_pid": "0xF00A"
8+
}
9+
},
10+
"core": "earlephilhower",
11+
"cpu": "cortex-m0plus",
12+
"extra_flags": "-DARDUINO_VICHARAK_SHRIKELITE -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
13+
"f_cpu": "133000000L",
14+
"hwids": [
15+
[
16+
"0x2E8A",
17+
"0x00C0"
18+
],
19+
[
20+
"0x2E8A",
21+
"0xF00A"
22+
]
23+
],
24+
"mcu": "rp2040",
25+
"variant": "vicharak_shrike-lite"
26+
},
27+
"debug": {
28+
"jlink_device": "RP2040_M0_0",
29+
"openocd_target": "rp2040.cfg",
30+
"svd_path": "rp2040.svd"
31+
},
32+
"frameworks": [
33+
"arduino",
34+
"picosdk"
35+
],
36+
"name": "Shrike-Lite",
37+
"upload": {
38+
"maximum_ram_size": 262144,
39+
"maximum_size": 4194304,
40+
"require_upload_port": true,
41+
"native_usb": true,
42+
"use_1200bps_touch": true,
43+
"wait_for_upload_port": false,
44+
"protocol": "picotool",
45+
"protocols": [
46+
"blackmagic",
47+
"cmsis-dap",
48+
"jlink",
49+
"raspberrypi-swd",
50+
"picotool",
51+
"picoprobe"
52+
]
53+
},
54+
"url": "https://github.com/vicharak-in/shrike-lite.git",
55+
"vendor": "Vicharak"
56+
}

0 commit comments

Comments
 (0)