Skip to content

Commit a98dc7b

Browse files
authored
Merge branch 'openwch:main' into Interrupt-driven-Serial1
2 parents 966b15c + 3c6bf0a commit a98dc7b

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

cores/arduino/Print.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,12 @@ size_t Print::printULLNumber(unsigned long long n64, uint8_t base)
356356
uint8_t i = 0;
357357
uint8_t innerLoops = 0;
358358

359+
// Special case workaround https://github.com/arduino/ArduinoCore-API/issues/178
360+
if (n64 == 0) {
361+
write('0');
362+
return 1;
363+
}
364+
359365
// prevent crash if called with base == 1
360366
if (base < 2) {
361367
base = 10;

libraries/USBPD_SINK/examples/usbpd_sink_request_voltage/usbpd_sink_request_voltage.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ void loop() {
2020

2121
if(usbpd_sink_get_ready())
2222
{
23-
usbpd_sink_set_request_fixed_voltage(setVoltage);
23+
if(usbpd_sink_set_request_fixed_voltage(setVoltage) == false)
24+
{
25+
Serial.printf("unsupported voltage\r\n");
26+
}
2427
}
2528

2629
// button, myIndex++

libraries/USBPD_SINK/src/usbpd_sink.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void usbpd_sink_clear_ready(void)
3838
pdControl_g.cc_USBPD_READY = 0;
3939
}
4040

41-
void usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage)
41+
bool usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage)
4242
{
4343
uint16_t targetVoltage;
4444
switch (requestVoltage)
@@ -73,11 +73,12 @@ void usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage)
7373
if(pdControl_g.cc_FixedSourceCap[i].Voltage == targetVoltage)
7474
{
7575
pdControl_g.cc_SetPDONum = i+1;
76-
return;
76+
return true;
7777
}
7878
}
79-
pdControl_g.cc_SetPDONum = (pdControl_g.cc_SourcePDONum - pdControl_g.cc_SourcePPSNum);
8079

80+
// unsupported voltage
81+
return false;
8182
}
8283

8384
void timer3_init(uint16_t arr, uint16_t psc)

libraries/USBPD_SINK/src/usbpd_sink.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
extern "C" {
66
#endif /* end of __cplusplus */
77

8+
#include <stdbool.h>
89
#include "usbpd_def.h"
910

1011
// Register Bit Definition
@@ -201,7 +202,7 @@ void usbpd_sink_process(void);
201202
uint8_t usbpd_sink_get_ready(void);
202203
void usbpd_sink_clear_ready(void);
203204

204-
void usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage);
205+
bool usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage);
205206

206207

207208
#ifdef __cplusplus

variants/CH32V00x/CH32V003F4/PeripheralPins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ WEAK const PinMap PinMap_ADC[] = {
3434
{PD_2, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 3)}, // ADC1_IN3
3535
{PD_3, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 4)}, // ADC1_IN4
3636
{PD_5, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 5)}, // ADC1_IN5
37-
{PA_6, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 6)}, // ADC1_IN6
38-
{PA_4, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 7)}, // ADC1_IN7
37+
{PD_6, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 6)}, // ADC1_IN6
38+
{PD_4, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 7)}, // ADC1_IN7
3939
{NC, NP, 0}
4040
};
4141
#endif

0 commit comments

Comments
 (0)