Skip to content

Commit 08741c5

Browse files
Merge branch 'dynusb' of https://github.com/earlephilhower/arduino-pico into dynusb
2 parents 1b5582b + 2be1971 commit 08741c5

File tree

16 files changed

+95
-63
lines changed

16 files changed

+95
-63
lines changed

cores/rp2040/Arduino.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ constexpr uint64_t __bitset(const int (&a)[N], size_t i = 0U) {
170170
#define __FIRSTANALOGGPIO 26
171171
#endif
172172

173+
// For peripherals where a pin may be not used
174+
#define NOPIN ((pin_size_t) 0xff)
175+
173176
#ifdef __cplusplus
174177
using namespace arduino;
175178
#endif

cores/rp2040/RP2040Support.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class _MFIFO {
175175

176176
class RP2040;
177177
extern RP2040 rp2040;
178-
extern "C" void main1();
178+
extern void main1();
179179
extern "C" char __StackLimit;
180180
extern "C" char __bss_end__;
181181
extern "C" void setup1() __attribute__((weak));

cores/rp2040/SerialPIO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ int SerialPIO::available() {
338338
if (!_running || !m || (_rx == NOPIN)) {
339339
return 0;
340340
}
341-
return (_writer - _reader) % _fifoSize;
341+
return (_fifoSize + _writer - _reader) % _fifoSize;
342342
}
343343

344344
int SerialPIO::availableForWrite() {

cores/rp2040/SerialPIO.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ extern "C" typedef struct uart_inst uart_inst_t;
2929

3030
class SerialPIO : public arduino::HardwareSerial {
3131
public:
32-
static const pin_size_t NOPIN = 0xff; // Use in constructor to disable RX or TX unit
3332
SerialPIO(pin_size_t tx, pin_size_t rx, size_t fifoSize = 32);
3433
~SerialPIO();
3534

cores/rp2040/Tone.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static inline bool pio_sm_get_enabled(PIO pio, uint sm) {
4545
return (pio->ctrl & ~(1u << sm)) & (1 << sm);
4646
}
4747

48-
int64_t _stopTonePIO(alarm_id_t id, void *user_data) {
48+
static int64_t _stopTonePIO(alarm_id_t id, void *user_data) {
4949
(void) id;
5050
Tone *tone = (Tone *)user_data;
5151
tone->alarm = 0;

cores/rp2040/WMath.cpp

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

1919
#include <stdlib.h>
2020
#include <stdint.h>
21+
#include <Arduino.h>
2122

2223
void randomSeed(uint32_t dwSeed) {
2324
if (dwSeed != 0) {

cores/rp2040/delay.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21+
#include <Arduino.h>
2122
#include <pico.h>
2223
#include <pico/time.h>
2324

cores/rp2040/lwip_wrap.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ extern "C" {
845845
return;
846846
}
847847
#endif
848+
(void) buffer;
848849
cb(cbData);
849850
return;
850851
}

cores/rp2040/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ bool core1_separate_stack __attribute__((weak)) = false;
5555
bool core1_disable_systick __attribute__((weak)) = false;
5656
extern void setup1() __attribute__((weak));
5757
extern void loop1() __attribute__((weak));
58-
extern "C" void main1() {
58+
void __attribute__((__noreturn__)) main1() {
5959
if (!core1_disable_systick) {
6060
// Don't install the SYSTICK exception handler. rp2040.getCycleCount will not work properly on core1
6161
rp2040.begin(1);

cores/rp2040/wiring_private.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void *_gpioIrqCBParam[__GPIOCNT];
8282

8383
// Only 1 GPIO IRQ callback for all pins, so we need to look at the pin it's for and
8484
// dispatch to the real callback manually
85-
void _gpioInterruptDispatcher(uint gpio, uint32_t events) {
85+
static void _gpioInterruptDispatcher(uint gpio, uint32_t events) {
8686
(void) events;
8787
uint64_t mask = 1LL << gpio;
8888
if (_gpioIrqEnabled & mask) {

0 commit comments

Comments
 (0)