Skip to content

Commit 3cd16a3

Browse files
committed
Update patchset
1 parent 090cfaf commit 3cd16a3

File tree

33 files changed

+415079
-86
lines changed

33 files changed

+415079
-86
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From e8fe8cb5f3f0a122fd59d67175d7c58e77dc0245 Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Wed, 31 Jul 2019 12:48:04 +0200
4+
Subject: [PATCH 01/31] HACK: avoid #10862 by not firing the assert
5+
6+
---
7+
drivers/source/usb/USBDevice.cpp | 18 ++++++++++--------
8+
1 file changed, 10 insertions(+), 8 deletions(-)
9+
10+
diff --git a/drivers/source/usb/USBDevice.cpp b/drivers/source/usb/USBDevice.cpp
11+
index 6d3cfc87d4..ddeabcfa15 100644
12+
--- a/drivers/source/usb/USBDevice.cpp
13+
+++ b/drivers/source/usb/USBDevice.cpp
14+
@@ -980,10 +980,11 @@ void USBDevice::out(usb_ep_t endpoint)
15+
16+
endpoint_info_t *info = &_endpoint_info[EP_TO_INDEX(endpoint)];
17+
18+
- MBED_ASSERT(info->pending >= 1);
19+
- info->pending -= 1;
20+
- if (info->callback) {
21+
- info->callback();
22+
+ if (info->pending >= 1) {
23+
+ info->pending -= 1;
24+
+ if (info->callback) {
25+
+ info->callback();
26+
+ }
27+
}
28+
}
29+
30+
@@ -1007,10 +1008,11 @@ void USBDevice::in(usb_ep_t endpoint)
31+
32+
endpoint_info_t *info = &_endpoint_info[EP_TO_INDEX(endpoint)];
33+
34+
- MBED_ASSERT(info->pending >= 1);
35+
- info->pending -= 1;
36+
- if (info->callback) {
37+
- info->callback();
38+
+ if (info->pending >= 1) {
39+
+ info->pending -= 1;
40+
+ if (info->callback) {
41+
+ info->callback();
42+
+ }
43+
}
44+
}
45+
46+
--
47+
2.27.0
48+
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
From 28dcde0a62f98bfb7a355d620cb9f6222c4f78b8 Mon Sep 17 00:00:00 2001
1+
From 3d68eda23826f3642ca1ec685927943a472455e5 Mon Sep 17 00:00:00 2001
22
From: Martino Facchin <m.facchin@arduino.cc>
33
Date: Tue, 30 Jul 2019 11:47:04 +0200
4-
Subject: [PATCH 1/3] FlashIAPBlockDevice: add missing mbed namespace
4+
Subject: [PATCH 02/31] FlashIAPBlockDevice: add missing mbed namespace
55

66
---
77
.../blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h | 2 +-
88
1 file changed, 1 insertion(+), 1 deletion(-)
99

1010
diff --git a/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h b/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h
11-
index 4cb1486dc7..5020f183a1 100644
11+
index ae9e4cca0b..e528f14fa5 100644
1212
--- a/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h
1313
+++ b/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h
14-
@@ -133,7 +133,7 @@ public:
14+
@@ -134,7 +134,7 @@ public:
1515
* @param size Size to erase in bytes
1616
* @return True if erase is valid for underlying block device
1717
*/
@@ -21,5 +21,5 @@ index 4cb1486dc7..5020f183a1 100644
2121

2222
private:
2323
--
24-
2.23.0
24+
2.27.0
2525

patches/0002-HACK-avoid-10862-by-not-firing-the-assert.patch

-32
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 02d37a845bf14acca743256d38b6005b54ff7e1b Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Fri, 4 Oct 2019 15:52:47 +0200
4+
Subject: [PATCH 03/31] QSPIFBlockDevice: use mbed namespace
5+
6+
---
7+
.../storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h | 4 ++--
8+
1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+
diff --git a/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h b/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h
11+
index 36c677b319..cacf0bc1b8 100644
12+
--- a/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h
13+
+++ b/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h
14+
@@ -53,7 +53,7 @@
15+
*/
16+
enum qspif_bd_error {
17+
QSPIF_BD_ERROR_OK = 0, /*!< no error */
18+
- QSPIF_BD_ERROR_DEVICE_ERROR = BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
19+
+ QSPIF_BD_ERROR_DEVICE_ERROR = mbed::BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
20+
QSPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */
21+
QSPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */
22+
QSPIF_BD_ERROR_WREN_FAILED = -4004, /* Write Enable Failed */
23+
@@ -289,7 +289,7 @@ private:
24+
qspi_status_t _qspi_set_frequency(int freq);
25+
26+
// Update the 4-byte addressing extension register with the MSB of the address if it is in use
27+
- qspi_status_t _qspi_update_4byte_ext_addr_reg(bd_addr_t addr);
28+
+ qspi_status_t _qspi_update_4byte_ext_addr_reg(mbed::bd_addr_t addr);
29+
30+
/*********************************/
31+
/* Flash Configuration Functions */
32+
--
33+
2.27.0
34+

patches/0003-Revert-GCC-ARM-Increase-develop-and-release-debug-le.patch

-41
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
From ed8c98c69e1866450591532e28c1a6421a231630 Mon Sep 17 00:00:00 2001
1+
From cca40435294682c64b6932a6851f4fd9fb115f99 Mon Sep 17 00:00:00 2001
22
From: Martino Facchin <m.facchin@arduino.cc>
33
Date: Mon, 2 Dec 2019 10:55:07 +0100
4-
Subject: [PATCH] Cordio: set WSF_MS_PER_TICK default as 10
4+
Subject: [PATCH 04/31] Cordio: set WSF_MS_PER_TICK default as 10
55

66
---
77
features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json | 4 ++--
88
1 file changed, 2 insertions(+), 2 deletions(-)
99

1010
diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json b/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json
11-
index 165b63f15e..39a3ae2643 100644
11+
index 4b9234e7bd..03235e471d 100644
1212
--- a/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json
1313
+++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json
1414
@@ -1,6 +1,6 @@
1515
{
1616
"name": "cordio",
17-
- "macros": [ "WSF_MS_PER_TICK=1" ],
18-
+ "macros": [ "WSF_MS_PER_TICK=10" ],
17+
- "macros": ["WSF_MS_PER_TICK=1"],
18+
+ "macros": ["WSF_MS_PER_TICK=10"],
1919
"config": {
2020
"max-connections": {
2121
"help": "Maximum number of connections",
22-
@@ -65,4 +65,4 @@
23-
"macro_name": "SEC_CCM_CFG"
22+
@@ -78,4 +78,4 @@
23+
"macro_name": "EATT_CONN_CHAN_MAX"
2424
}
2525
}
2626
-}
2727
\ No newline at end of file
2828
+}
2929
--
30-
2.24.0
30+
2.27.0
3131

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
From 642eadbf613b36db5f5d0e0a0c1406d3cd551397 Mon Sep 17 00:00:00 2001
2+
From: Paolo Calao <paolo.calao@gmail.com>
3+
Date: Wed, 13 May 2020 11:59:46 +0200
4+
Subject: [PATCH 05/31] Add AnalogIn configure function
5+
6+
This adds a weak method to configure AnalogIn objects.
7+
Also, a strong implementation of such method for NRF5284 is provided.
8+
---
9+
drivers/AnalogIn.h | 7 ++++
10+
drivers/source/AnalogIn.cpp | 7 ++++
11+
hal/analogin_api.h | 13 +++++++
12+
.../TARGET_NRF5x/TARGET_NRF52/analogin_api.c | 34 +++++++++++++++++++
13+
.../TARGET_NRF5x/TARGET_NRF52/objects.h | 14 ++++++++
14+
5 files changed, 75 insertions(+)
15+
16+
diff --git a/drivers/AnalogIn.h b/drivers/AnalogIn.h
17+
index 38c1fc130d..9cfd6600ca 100644
18+
--- a/drivers/AnalogIn.h
19+
+++ b/drivers/AnalogIn.h
20+
@@ -88,6 +88,13 @@ public:
21+
*/
22+
AnalogIn(PinName pin, float vref = MBED_CONF_TARGET_DEFAULT_ADC_VREF);
23+
24+
+
25+
+ /** Reconfigure the adc object using the given configuration
26+
+ *
27+
+ * @param config reference to structure which holds AnalogIn configuration
28+
+ */
29+
+ void configure(const analogin_config_t &config);
30+
+
31+
/** Read the input voltage, represented as a float in the range [0.0, 1.0]
32+
*
33+
* @returns A floating-point value representing the current input voltage, measured as a percentage
34+
diff --git a/drivers/source/AnalogIn.cpp b/drivers/source/AnalogIn.cpp
35+
index 596d034f19..f9e271d5d9 100644
36+
--- a/drivers/source/AnalogIn.cpp
37+
+++ b/drivers/source/AnalogIn.cpp
38+
@@ -38,6 +38,13 @@ AnalogIn::AnalogIn(const PinMap &pinmap, float vref) : _vref(vref)
39+
unlock();
40+
}
41+
42+
+void AnalogIn::configure(const analogin_config_t &config)
43+
+{
44+
+ lock();
45+
+ analogin_configure(&_adc, &config);
46+
+ unlock();
47+
+}
48+
+
49+
float AnalogIn::read()
50+
{
51+
lock();
52+
diff --git a/hal/analogin_api.h b/hal/analogin_api.h
53+
index d172607c69..07208443f5 100644
54+
--- a/hal/analogin_api.h
55+
+++ b/hal/analogin_api.h
56+
@@ -33,6 +33,10 @@ extern "C" {
57+
*/
58+
typedef struct analogin_s analogin_t;
59+
60+
+/** Analogin configuration hal structure. analogin_config_s is declared in the target's hal
61+
+ */
62+
+typedef struct analogin_config_s analogin_config_t;
63+
+
64+
/**
65+
* \defgroup hal_analogin Analogin hal functions
66+
*
67+
@@ -77,6 +81,15 @@ void analogin_init_direct(analogin_t *obj, const PinMap *pinmap);
68+
*/
69+
void analogin_init(analogin_t *obj, PinName pin);
70+
71+
+/** Initialize the analogin peripheral
72+
+ *
73+
+ * Configures the pin used by analogin.
74+
+ * @param obj The analogin object to initialize
75+
+ * @param pin The analogin pin name
76+
+ * @param pinmap pointer to structure which holds analogin configuration
77+
+ */
78+
+void __attribute__((weak)) analogin_configure(analogin_t *obj, const analogin_config_t *config);
79+
+
80+
/** Release the analogin peripheral
81+
*
82+
* Releases the pin used by analogin.
83+
diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/analogin_api.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/analogin_api.c
84+
index e66be66f50..863c7b090d 100644
85+
--- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/analogin_api.c
86+
+++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/analogin_api.c
87+
@@ -122,6 +122,40 @@ void analogin_init(analogin_t *obj, PinName pin)
88+
ANALOGIN_INIT_DIRECT(obj, &static_pinmap);
89+
}
90+
91+
+/** Reconfigure the analogin peripheral
92+
+ *
93+
+ * Configures the pin used by analogin.
94+
+ * @param obj The analogin object to initialize
95+
+ * @param config pointer to structure which holds analogin configuration
96+
+ */
97+
+void analogin_configure(analogin_t *obj, const analogin_config_t *config)
98+
+{
99+
+ MBED_ASSERT(obj);
100+
+
101+
+ /* Get associated channel from the adc object. */
102+
+ uint32_t channel = obj->channel;
103+
+ MBED_ASSERT(channel != (uint32_t) NC);
104+
+
105+
+ /* Account for an off-by-one in Channel definition and Input definition. */
106+
+ nrf_saadc_input_t input = channel + 1;
107+
+
108+
+ /* Configure channel and pin */
109+
+ nrf_saadc_channel_config_t channel_config = {
110+
+ .resistor_p = config->resistor_p,
111+
+ .resistor_n = config->resistor_n,
112+
+ .gain = config->gain,
113+
+ .reference = config->reference,
114+
+ .acq_time = config->acq_time,
115+
+ .mode = config->mode,
116+
+ .burst = config->burst,
117+
+ .pin_p = input,
118+
+ .pin_n = config->pin_n
119+
+ };
120+
+
121+
+ ret_code_t result = nrfx_saadc_channel_init(channel, &channel_config);
122+
+ MBED_ASSERT(result == NRFX_SUCCESS);
123+
+}
124+
+
125+
/** Read the input voltage, represented as a float in the range [0.0, 1.0]
126+
*
127+
* @param obj The analogin object
128+
diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h
129+
index 916e75985d..6200030c27 100644
130+
--- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h
131+
+++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h
132+
@@ -46,6 +46,8 @@
133+
#include "nrfx_spi.h"
134+
#include "nrf_twi.h"
135+
136+
+#include "nrf_saadc.h"
137+
+
138+
#include "nrf_pwm.h"
139+
140+
#ifdef __cplusplus
141+
@@ -140,6 +142,18 @@ struct analogin_s {
142+
uint8_t channel;
143+
};
144+
145+
+struct analogin_config_s {
146+
+ nrf_saadc_resistor_t resistor_p;
147+
+ nrf_saadc_resistor_t resistor_n;
148+
+ nrf_saadc_gain_t gain;
149+
+ nrf_saadc_reference_t reference;
150+
+ nrf_saadc_acqtime_t acq_time;
151+
+ nrf_saadc_mode_t mode;
152+
+ nrf_saadc_burst_t burst;
153+
+ nrf_saadc_input_t pin_p;
154+
+ nrf_saadc_input_t pin_n;
155+
+};
156+
+
157+
struct gpio_irq_s {
158+
uint32_t ch;
159+
};
160+
--
161+
2.27.0
162+

0 commit comments

Comments
 (0)