diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 5631d924..d8b6046c 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -17,9 +17,6 @@ jobs: - "examples/mbed-rtos-ble-thermometer" - "examples/mbed-rtos-blink-baremetal" - "examples/mbed-rtos-nfc" - - "examples/mbed-legacy-examples/mbed-ble-thermometer" - - "examples/mbed-legacy-examples/mbed-nfc" - - "examples/mbed-legacy-examples/mbed-rtos" - "examples/zephyr-ble-beacon" - "examples/zephyr-blink" - "examples/zephyr-net-echo-client" diff --git a/boards/delta_dfbm_nq620.json b/boards/delta_dfbm_nq620.json index ef2de079..989b5ec8 100644 --- a/boards/delta_dfbm_nq620.json +++ b/boards/delta_dfbm_nq620.json @@ -21,8 +21,7 @@ "svd_path": "nrf52.svd" }, "frameworks": [ - "arduino", - "mbed" + "arduino" ], "name": "Delta DFBM-NQ620", "upload": { diff --git a/boards/redbear_blenano2.json b/boards/redbear_blenano2.json index 8460cd8b..51e30fca 100644 --- a/boards/redbear_blenano2.json +++ b/boards/redbear_blenano2.json @@ -25,7 +25,6 @@ }, "frameworks": [ "arduino", - "mbed", "zephyr" ], "name": "RedBearLab BLE Nano 2", diff --git a/boards/ublox_evk_nina_b1.json b/boards/ublox_evk_nina_b1.json index bbebbb80..8b934119 100644 --- a/boards/ublox_evk_nina_b1.json +++ b/boards/ublox_evk_nina_b1.json @@ -22,8 +22,7 @@ "svd_path": "nrf52.svd" }, "frameworks": [ - "arduino", - "mbed" + "arduino" ], "name": "u-blox EVK-NINA-B1", "upload": { diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/.gitignore b/examples/mbed-legacy-examples/mbed-ble-thermometer/.gitignore deleted file mode 100644 index 03f4a3c1..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pio diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/README.md b/examples/mbed-legacy-examples/mbed-ble-thermometer/README.md deleted file mode 100644 index 587ef83f..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/README.md +++ /dev/null @@ -1,27 +0,0 @@ -How to build PlatformIO based project -===================================== - -1. [Install PlatformIO Core](https://docs.platformio.org/page/core.html) -2. Download [development platform with examples](https://github.com/platformio/platform-nordicnrf52/archive/develop.zip) -3. Extract ZIP archive -4. Run these commands: - -```shell -# Change directory to example -$ cd platform-nordicnrf52/examples/mbed-legacy-examples/mbed-ble-thermometer - -# Build project -$ pio run - -# Upload firmware -$ pio run --target upload - -# Build specific environment -$ pio run -e nrf52_dk - -# Upload firmware for the specific environment -$ pio run -e nrf52_dk --target upload - -# Clean build files -$ pio run --target clean -``` diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/include/README b/examples/mbed-legacy-examples/mbed-ble-thermometer/include/README deleted file mode 100644 index 194dcd43..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/lib/README b/examples/mbed-legacy-examples/mbed-ble-thermometer/lib/README deleted file mode 100644 index 6debab1e..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/platformio.ini b/examples/mbed-legacy-examples/mbed-ble-thermometer/platformio.ini deleted file mode 100644 index cb6a474f..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/platformio.ini +++ /dev/null @@ -1,22 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter, extra scripting -; Upload options: custom port, speed and extra flags -; Library options: dependencies, extra library storages -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:nrf52_dk] -platform = nordicnrf52 -framework = mbed -board = nrf52_dk -build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT -platform_packages = - framework-mbed @ ~6.51506.0 - -[env:delta_dfbm_nq620] -platform = nordicnrf52 -framework = mbed -board = delta_dfbm_nq620 -build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/src/main.cpp b/examples/mbed-legacy-examples/mbed-ble-thermometer/src/main.cpp deleted file mode 100644 index 48c3b760..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/src/main.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include "mbed.h" -#include "ble/BLE.h" -#include "ble/services/HealthThermometerService.h" - -DigitalOut led1(LED1, 1); - -const static char DEVICE_NAME[] = "PIOTherm"; -static const uint16_t uuid16_list[] = {GattService::UUID_HEALTH_THERMOMETER_SERVICE}; - -static float currentTemperature = 39.6; -static HealthThermometerService *thermometerServicePtr; - -static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE); - -/* Restart Advertising on disconnection*/ -void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *) -{ - BLE::Instance().gap().startAdvertising(); -} - -void updateSensorValue(void) { - /* Do blocking calls or whatever is necessary for sensor polling. - In our case, we simply update the Temperature measurement. */ - currentTemperature = (currentTemperature + 0.1 > 43.0) ? 39.6 : currentTemperature + 0.1; - thermometerServicePtr->updateTemperature(currentTemperature); -} - -void periodicCallback(void) -{ - led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */ - - if (BLE::Instance().gap().getState().connected) { - eventQueue.call(updateSensorValue); - } -} - -void onBleInitError(BLE &ble, ble_error_t error) -{ - /* Initialization error handling should go here */ -} - -void bleInitComplete(BLE::InitializationCompleteCallbackContext *params) -{ - BLE& ble = params->ble; - ble_error_t error = params->error; - - if (error != BLE_ERROR_NONE) { - onBleInitError(ble, error); - return; - } - - if (ble.getInstanceID() != BLE::DEFAULT_INSTANCE) { - return; - } - - ble.gap().onDisconnection(disconnectionCallback); - - /* Setup primary service. */ - thermometerServicePtr = new HealthThermometerService(ble, currentTemperature, HealthThermometerService::LOCATION_EAR); - - /* setup advertising */ - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::THERMOMETER_EAR); - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); - ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.gap().setAdvertisingInterval(1000); /* 1000ms */ - ble.gap().startAdvertising(); -} - -void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) { - BLE &ble = BLE::Instance(); - eventQueue.call(Callback(&ble, &BLE::processEvents)); -} - -int main() -{ - eventQueue.call_every(500, periodicCallback); - - BLE &ble = BLE::Instance(); - ble.onEventsToProcess(scheduleBleEventsProcessing); - ble.init(bleInitComplete); - - eventQueue.dispatch_forever(); - - return 0; -} diff --git a/examples/mbed-legacy-examples/mbed-ble-thermometer/test/README b/examples/mbed-legacy-examples/mbed-ble-thermometer/test/README deleted file mode 100644 index df5066e6..00000000 --- a/examples/mbed-legacy-examples/mbed-ble-thermometer/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html diff --git a/examples/mbed-legacy-examples/mbed-nfc/.gitignore b/examples/mbed-legacy-examples/mbed-nfc/.gitignore deleted file mode 100644 index 03f4a3c1..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pio diff --git a/examples/mbed-legacy-examples/mbed-nfc/README.md b/examples/mbed-legacy-examples/mbed-nfc/README.md deleted file mode 100644 index 7b60cd39..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/README.md +++ /dev/null @@ -1,21 +0,0 @@ -How to build PlatformIO based project -===================================== - -1. [Install PlatformIO Core](https://docs.platformio.org/page/core.html) -2. Download [development platform with examples](https://github.com/platformio/platform-nordicnrf52/archive/develop.zip) -3. Extract ZIP archive -4. Run these commands: - -```shell -# Change directory to example -$ cd platform-nordicnrf52/examples/mbed-legacy-examples/mbed-nfc - -# Build project -$ pio run - -# Upload firmware -$ pio run --target upload - -# Clean build files -$ pio run --target clean -``` diff --git a/examples/mbed-legacy-examples/mbed-nfc/include/README b/examples/mbed-legacy-examples/mbed-nfc/include/README deleted file mode 100644 index 194dcd43..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/examples/mbed-legacy-examples/mbed-nfc/lib/README b/examples/mbed-legacy-examples/mbed-nfc/lib/README deleted file mode 100644 index 6debab1e..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/examples/mbed-legacy-examples/mbed-nfc/platformio.ini b/examples/mbed-legacy-examples/mbed-nfc/platformio.ini deleted file mode 100644 index 5acd8eee..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/platformio.ini +++ /dev/null @@ -1,16 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter, extra scripting -; Upload options: custom port, speed and extra flags -; Library options: dependencies, extra library storages -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:nrf52_dk] -platform = nordicnrf52 -framework = mbed -board = nrf52_dk -build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT -platform_packages = - framework-mbed @ ~6.51506.0 diff --git a/examples/mbed-legacy-examples/mbed-nfc/src/SmartPoster.cpp b/examples/mbed-legacy-examples/mbed-nfc/src/SmartPoster.cpp deleted file mode 100644 index 5aaa8351..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/src/SmartPoster.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2018-2018 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "SmartPoster.h" - -#include "nfc/ndef/common/Text.h" -#include "nfc/ndef/common/URI.h" -#include "nfc/ndef/common/Mime.h" -#include "nfc/ndef/MessageBuilder.h" -#include "nfc/ndef/common/util.h" - -using mbed::Span; - -using mbed::nfc::ndef::MessageBuilder; -using mbed::nfc::ndef::RecordType; -using mbed::nfc::ndef::Record; -using mbed::nfc::ndef::RecordID; -using mbed::nfc::ndef::RecordPayload; -using mbed::nfc::ndef::common::span_from_cstr; -using mbed::nfc::ndef::common::Mime; -using mbed::nfc::ndef::common::Text; -using mbed::nfc::ndef::common::URI; - -namespace { -static RecordType smart_poster_record_type() -{ - return RecordType( - RecordType::well_known_type, - span_from_cstr("Sp") - ); -} - -static RecordType action_record_type() { - return RecordType( - RecordType::well_known_type, - span_from_cstr("act") - ); -} - -static RecordType size_record_type() { - return RecordType( - RecordType::well_known_type, - span_from_cstr("s") - ); -} - -static RecordType type_record_type() { - return RecordType( - RecordType::well_known_type, - span_from_cstr("T") - ); -} - -static size_t compute_record_size(const RecordType& type, const RecordPayload& payload) -{ - return MessageBuilder::compute_record_size( - Record( - type, - payload, - RecordID(), - false, - false - ) - ); -} - -} // end of anonymous namespace - - -SmartPoster::SmartPoster(const URI &uri) : - _uri(uri), - _action(), - _resource_size(0), - _action_set(false), - _resource_size_set(false) -{ } - -void SmartPoster::set_title(const Text &text) -{ - _title = text; -} - -void SmartPoster::set_icon(const Mime &icon) -{ - _icon = icon; -} - -void SmartPoster::set_action(action_t action) -{ - _action = action; - _action_set = true; -} - -void SmartPoster::set_resource_size(uint32_t size) -{ - _resource_size = size; - _resource_size_set = true; -} - -void SmartPoster::set_resource_type(Span &type) -{ - _type.set_text(Text::UTF8, Span(), type); -} - -bool SmartPoster::append_record(MessageBuilder &ndef_builder, bool is_last_record) const -{ - if (_uri.get_uri_field().empty()) { - return false; - } - - struct PayloadBuilder : MessageBuilder::PayloadBuilder { - PayloadBuilder(const SmartPoster &sp) : sp(sp) { } - - virtual size_t size() const - { - return sp.get_uri_record_size() + - sp.get_title_record_size() + - sp.get_icon_record_size() + - sp.get_action_record_size() + - sp.get_resource_size_record_size() + - sp.get_type_record_size(); - } - - virtual void build(const Span &buffer) const - { - MessageBuilder smart_poster_builder(buffer); - sp.append_title(smart_poster_builder); - sp.append_icon(smart_poster_builder); - sp.append_resource_size(smart_poster_builder); - sp.append_type(smart_poster_builder); - sp.append_action(smart_poster_builder); - sp.append_uri(smart_poster_builder); - } - - const SmartPoster &sp; - }; - - bool result = ndef_builder.append_record( - smart_poster_record_type(), - PayloadBuilder(*this), - is_last_record - ); - return result; -} - -void SmartPoster::append_uri(MessageBuilder& builder) const -{ - _uri.append_as_record(builder, true); -} - -size_t SmartPoster::get_uri_record_size() const -{ - return _uri.get_record_size(); -} - -void SmartPoster::append_title(MessageBuilder& builder) const -{ - if (_title.get_text().empty()) { - return; - } - _title.append_as_record(builder); -} - -size_t SmartPoster::get_title_record_size() const -{ - if (_title.get_text().empty()) { - return 0; - } - - return _title.get_record_size(); -} - -void SmartPoster::append_icon(MessageBuilder& builder) const -{ - if (_icon.get_mime_content().empty()) { - return; - } - _icon.append_as_record(builder); -} - -size_t SmartPoster::get_icon_record_size() const -{ - if (_icon.get_mime_content().empty()) { - return 0; - } - - return _icon.get_record_size(); -} - -void SmartPoster::append_action(MessageBuilder& builder) const -{ - if (!_action_set) { - return; - } - - const uint8_t action_value[1] = { _action }; - builder.append_record( - action_record_type(), - action_value - ); -} - -size_t SmartPoster::get_action_record_size() const -{ - if (!_action_set) { - return 0; - } - - const uint8_t action_value[1] = { _action }; - - return compute_record_size( - action_record_type(), - action_value - ); -} - -void SmartPoster::append_resource_size(MessageBuilder& builder) const -{ - if (!_resource_size_set) { - return; - } - - uint8_t value[4]; - std::reverse_copy(&_resource_size, &_resource_size + 4, value); - - builder.append_record( - size_record_type(), - value - ); -} - -size_t SmartPoster::get_resource_size_record_size() const -{ - if (!_resource_size_set) { - return 0; - } - - uint8_t value[4]; - - return compute_record_size( - size_record_type(), - value - ); -} - -void SmartPoster::append_type(MessageBuilder& builder) const -{ - if (_type.get_text().empty()) { - return; - } - - builder.append_record( - type_record_type(), - _type.get_text() - ); -} - -size_t SmartPoster::get_type_record_size() const -{ - if (_type.get_text().empty()) { - return 0; - } - - return compute_record_size( - type_record_type(), - _type.get_text() - ); -} \ No newline at end of file diff --git a/examples/mbed-legacy-examples/mbed-nfc/src/SmartPoster.h b/examples/mbed-legacy-examples/mbed-nfc/src/SmartPoster.h deleted file mode 100644 index ae5b1759..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/src/SmartPoster.h +++ /dev/null @@ -1,141 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2018-2018 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SMARTPOSTER_H_ -#define SMARTPOSTER_H_ - -#include "nfc/ndef/common/Text.h" -#include "nfc/ndef/common/URI.h" -#include "nfc/ndef/common/Mime.h" -#include "nfc/ndef/MessageBuilder.h" - -/** - * Smart poster object. - * - * A smart poster is one of the basic use case of NFC. It encapsulates a URI to - * a resource and meta-data of the resource. - * - * Meta-data are optional, they can be: - * - title: name of the resource - * - icon: image/media associated to the resource - * - action: Action the peer should execute upon reception of the smart poster - * - size: The size of the resource. - * - type: Mime type of the resource. - * - * @note It obeys to value semantic and can be copied around. - */ -class SmartPoster { -public: - typedef mbed::nfc::ndef::common::Mime Mime; - typedef mbed::nfc::ndef::common::Text Text; - typedef mbed::nfc::ndef::common::URI URI; - typedef mbed::nfc::ndef::MessageBuilder MessageBuilder; - - /** - * Type of actions that should be executed upon smart poster reception. - */ - enum action_t { - EXECUTE,//!< EXECUTE - SAVE, //!< SAVE - EDIT //!< EDIT - }; - - /** - * Construct a smart poster. - * - * @param uri The URI to the resource. - */ - SmartPoster(const URI &uri); - - /** - * Set the title of the resource. - * - * @param text The title of the resource to set. - */ - void set_title(const Text &text); - - /** - * Set the icon of the resource. - * - * @param icon The icon to set. - */ - void set_icon(const Mime &icon); - - /** - * Set the action to trigger upon smart poster reception. - * - * @param action The action to do upon reception. - */ - void set_action(action_t action); - - /** - * Set the size of the resource. - * - * @param size The size of the resource. - */ - void set_resource_size(uint32_t size); - - /** - * Set the type of the resource. - * - * @param resource_type The type of the resource pointed by the URI. - */ - void set_resource_type(mbed::Span &resource_type); - - /** - * Append the smart poster as a ndef record. - * - * @param ndef_builder The message builder where the record is appended. - * @param is_last_record Indicates if this message is the last one. - * - * @return true if the message has been appended to the builder or false - * otherwise. - */ - bool append_record(MessageBuilder &ndef_builder, bool is_last_record) const; - -private: - void append_uri(MessageBuilder &builder) const; - size_t get_uri_record_size() const; - - void append_title(MessageBuilder &builder) const; - size_t get_title_record_size() const; - - void append_icon(MessageBuilder &builder) const; - size_t get_icon_record_size() const; - - void append_action(MessageBuilder &builder) const; - size_t get_action_record_size() const; - - void append_resource_size(MessageBuilder &builder) const; - size_t get_resource_size_record_size() const; - - void append_type(MessageBuilder &builder) const; - size_t get_type_record_size() const; - - URI _uri; - Text _title; - Mime _icon; - action_t _action; - uint32_t _resource_size; - Text _type; - - bool _action_set:1; - bool _resource_size_set:1; -}; - - -#endif /* SMARTPOSTER_H_ */ - \ No newline at end of file diff --git a/examples/mbed-legacy-examples/mbed-nfc/src/main.cpp b/examples/mbed-legacy-examples/mbed-nfc/src/main.cpp deleted file mode 100644 index c12df907..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/src/main.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2018-2018 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "events/EventQueue.h" - -#include "nfc/controllers/PN512Driver.h" -#include "nfc/controllers/PN512SPITransportDriver.h" -#include "nfc/NFCRemoteInitiator.h" -#include "nfc/NFCController.h" - -#include "nfc/ndef/MessageBuilder.h" -#include "nfc/ndef/common/util.h" - -#include "SmartPoster.h" - -using events::EventQueue; - -using mbed::Span; -using mbed::nfc::NFCRemoteInitiator; -using mbed::nfc::NFCController; -using mbed::nfc::nfc_rf_protocols_bitmask_t; -using mbed::nfc::ndef::MessageBuilder; -using mbed::nfc::ndef::common::Text; -using mbed::nfc::ndef::common::URI; -using mbed::nfc::ndef::common::span_from_cstr; - -/** - * Manage the NFC discovery process and the local device operating in target mode. - * - * When a remote initiator has been discovered, it connects to it then reply - * to its ndef message request with a smart poster message that contains: - * - A URI: https://www.mbed.com - * - A title: mbed website - * - An action: EXECUTE which opens the browser of the peer with the URI - * transmitted. - */ -class NFCProcess : NFCRemoteInitiator::Delegate, NFCController::Delegate { -public: - /** - * Construct a new NFCProcess objects. - * - * This function construct the NFC controller and wires it with the PN512 - * driver. - * - * @param queue The event queue that will be used by the NFCController. - */ - NFCProcess(events::EventQueue &queue) : - _pn512_transport(D11, D12, D13, D10, A1, A0), - _pn512_driver(&_pn512_transport), - _queue(queue), - _ndef_buffer(), - _nfc_controller(&_pn512_driver, &queue, _ndef_buffer) - { } - - /** - * Initialise and configure the NFC controller. - * - * @return NFC_OK in case of success or a meaningful error code in case of - * failure. - */ - nfc_err_t init() - { - nfc_err_t err = _nfc_controller.initialize(); - if (err) { - return err; - } - - // register callbacks - _nfc_controller.set_delegate(this); - - nfc_rf_protocols_bitmask_t protocols = { 0 }; - protocols.target_iso_dep = 1; - return _nfc_controller.configure_rf_protocols(protocols); - } - - /** - * Start the discovery of peers. - * - * @return NFC_OK in case of success or a meaningful error code in case of - * failure. - */ - nfc_err_t start_discovery() - { - return _nfc_controller.start_discovery(); - } - -private: - /* ------------------------------------------------------------------------ - * Implementation of NFCRemoteInitiator::Delegate - */ - virtual void on_connected() { } - - virtual void on_disconnected() - { - // reset the state of the remote initiator - _nfc_remote_initiator->set_delegate(NULL); - _nfc_remote_initiator.reset(); - - // restart peer discovery - _nfc_controller.start_discovery(); - } - - virtual void parse_ndef_message(const Span &buffer) { } - - virtual size_t build_ndef_message(const Span &buffer) - { - // build the smart poster object we want to send - SmartPoster smart_poster( - URI(URI::HTTPS_WWW, span_from_cstr("mbed.com")) - ); - smart_poster.set_title( - Text(Text::UTF8, span_from_cstr("en-US"), span_from_cstr("mbed website")) - ); - smart_poster.set_action(SmartPoster::EXECUTE); - - // serialize the smart poster into an ndef message operating on the - // buffer in input. - MessageBuilder builder(buffer); - smart_poster.append_record(builder, /* last ? */ true); - - return builder.get_message().size(); - } - - /* ------------------------------------------------------------------------ - * Implementation of NFCController::Delegate - */ - virtual void on_discovery_terminated(nfc_discovery_terminated_reason_t reason) - { - if(reason != nfc_discovery_terminated_completed) { - _nfc_controller.start_discovery(); - } - } - - virtual void on_nfc_initiator_discovered(const SharedPtr &nfc_initiator) - { - // setup the local remote initiator - _nfc_remote_initiator = nfc_initiator; - _nfc_remote_initiator->set_delegate(this); - _nfc_remote_initiator->connect(); - } - - mbed::nfc::PN512SPITransportDriver _pn512_transport; - mbed::nfc::PN512Driver _pn512_driver; - EventQueue& _queue; - uint8_t _ndef_buffer[1024]; - NFCController _nfc_controller; - SharedPtr _nfc_remote_initiator; -}; - -int main() -{ - events::EventQueue queue; - NFCProcess nfc_process(queue); - - nfc_err_t ret = nfc_process.init(); - printf("Initialize: ret = %u\r\n", ret); - - ret = nfc_process.start_discovery(); - printf("Start Discovery: ret = %u\r\n", ret); - - queue.dispatch_forever(); - - return 0; -} \ No newline at end of file diff --git a/examples/mbed-legacy-examples/mbed-nfc/test/README b/examples/mbed-legacy-examples/mbed-nfc/test/README deleted file mode 100644 index df5066e6..00000000 --- a/examples/mbed-legacy-examples/mbed-nfc/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html diff --git a/examples/mbed-legacy-examples/mbed-rtos/.gitignore b/examples/mbed-legacy-examples/mbed-rtos/.gitignore deleted file mode 100644 index 03f4a3c1..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pio diff --git a/examples/mbed-legacy-examples/mbed-rtos/README.md b/examples/mbed-legacy-examples/mbed-rtos/README.md deleted file mode 100644 index 2db75741..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/README.md +++ /dev/null @@ -1,27 +0,0 @@ -How to build PlatformIO based project -==================================== - -1. [Install PlatformIO Core](https://docs.platformio.org/page/core.html) -2. Download [development platform with examples](https://github.com/platformio/platform-nordicnrf52/archive/develop.zip) -3. Extract ZIP archive -4. Run these commands: - -```shell -# Change directory to example -$ cd platform-nordicnrf52/examples/mbed-legacy-examples/mbed-rtos - -# Build project -$ pio run - -# Upload firmware -$ pio run --target upload - -# Build specific environment -$ pio run -e nrf52_dk - -# Upload firmware for the specific environment -$ pio run -e nrf52_dk --target upload - -# Clean build files -$ pio run --target clean -``` diff --git a/examples/mbed-legacy-examples/mbed-rtos/include/README b/examples/mbed-legacy-examples/mbed-rtos/include/README deleted file mode 100644 index 194dcd43..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/examples/mbed-legacy-examples/mbed-rtos/lib/README b/examples/mbed-legacy-examples/mbed-rtos/lib/README deleted file mode 100644 index 6debab1e..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/examples/mbed-legacy-examples/mbed-rtos/platformio.ini b/examples/mbed-legacy-examples/mbed-rtos/platformio.ini deleted file mode 100644 index d39d8eb4..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/platformio.ini +++ /dev/null @@ -1,22 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter, extra scripting -; Upload options: custom port, speed and extra flags -; Library options: dependencies, extra library storages -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:nrf52840_dk] -platform = nordicnrf52 -framework = mbed -board = nrf52840_dk -build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT -platform_packages = - framework-mbed @ ~6.51506.0 - -[env:delta_dfbm_nq620] -platform = nordicnrf52 -framework = mbed -board = delta_dfbm_nq620 -build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT diff --git a/examples/mbed-legacy-examples/mbed-rtos/src/main.cpp b/examples/mbed-legacy-examples/mbed-rtos/src/main.cpp deleted file mode 100644 index 7b19f21b..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/src/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "mbed.h" -#include "rtos.h" - -Thread thread; -DigitalOut led1(LED1); -volatile bool running = true; - -void blink(DigitalOut *led) { - while (running) { - *led = !*led; - wait(1); - } -} - -int main() { - thread.start(callback(blink, &led1)); - wait(5); - running = false; - thread.join(); -} \ No newline at end of file diff --git a/examples/mbed-legacy-examples/mbed-rtos/test/README b/examples/mbed-legacy-examples/mbed-rtos/test/README deleted file mode 100644 index df5066e6..00000000 --- a/examples/mbed-legacy-examples/mbed-rtos/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html diff --git a/misc/mbed_deprecated_boards.json b/misc/mbed_deprecated_boards.json deleted file mode 100644 index 724b6ef1..00000000 --- a/misc/mbed_deprecated_boards.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "delta_dfbm_nq620", - "redbear_blenano2", - "ublox_evk_nina_b1" -] diff --git a/platform.json b/platform.json index 803f33f8..9bd15621 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/platformio/platform-nordicnrf52.git" }, - "version": "9.6.0", + "version": "10.0.0", "frameworks": { "arduino": { "package": "framework-arduinonordicnrf5", @@ -47,16 +47,13 @@ "type": "framework", "optional": true, "owner": "platformio", - "version": "~6.60900.0", - "optionalVersions": [ - "~6.51506.0" - ] + "version": "~6.60900.0" }, "framework-arduinoadafruitnrf52": { "type": "framework", "optional": true, "owner": "platformio", - "version": "~1.10300.0" + "version": "~1.10500.0" }, "framework-arduinonordicnrf5": { "type": "framework", @@ -95,7 +92,7 @@ "type": "uploader", "optional": true, "owner": "platformio", - "version": "~2.1100.0" + "version": "~3.1200.0" }, "tool-nrfjprog": { "type": "uploader", diff --git a/platform.py b/platform.py index 6763fb1c..e4776960 100644 --- a/platform.py +++ b/platform.py @@ -43,12 +43,6 @@ def configure_default_packages(self, variables, targets): self.packages["tool-adafruit-nrfutil"]["optional"] = False if "mbed" in frameworks: - deprecated_boards_file = os.path.join( - self.get_dir(), "misc", "mbed_deprecated_boards.json") - if os.path.isfile(deprecated_boards_file): - with open(deprecated_boards_file) as fp: - if board in json.load(fp): - self.packages["framework-mbed"]["version"] = "~6.51506.0" self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.90201.0" if "zephyr" in frameworks: @@ -139,7 +133,7 @@ def _add_default_debug_tools(self, board): else: server_args = [ - "-s", "$PACKAGE_DIR/scripts", + "-s", "$PACKAGE_DIR/openocd/scripts", "-f", "interface/%s.cfg" % link ] if link == "stlink":