Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add esp32_ble_ota_lib_compact #18

Merged
merged 1 commit into from
May 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions esp32_ble_ota_lib_compact/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
10 changes: 10 additions & 0 deletions esp32_ble_ota_lib_compact/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
9 changes: 9 additions & 0 deletions esp32_ble_ota_lib_compact/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cSpell.words": [
"LOGD",
"LOGI",
"LOGW",
"ledc",
"LEDC",
]
}
7 changes: 7 additions & 0 deletions esp32_ble_ota_lib_compact/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Compact version of the BLE OTA example

This directory contains a PlatformIO project which implement a compact version of the OTA. It also provides a library (in the lib folder) that allows to easily port BLE OTA to your own code.

**Note:** this version of the code is not compatible with the mobile app for the moment (the update mechanism is not exactly the same).

Furthermore, to use the FFAT mode you need to use another partition table (which you must configure in `platformio.ini`).
13 changes: 13 additions & 0 deletions esp32_ble_ota_lib_compact/discover.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import asyncio
from bleak import BleakScanner


async def run():
for device in await BleakScanner.discover():
print(f'{device.name} - {device.address}')

if __name__ == '__main__':
try:
asyncio.run(run())
except KeyboardInterrupt:
pass
39 changes: 39 additions & 0 deletions esp32_ble_ota_lib_compact/include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

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
46 changes: 46 additions & 0 deletions esp32_ble_ota_lib_compact/lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

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 <Foo.h>
#include <Bar.h>

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
5 changes: 5 additions & 0 deletions esp32_ble_ota_lib_compact/lib/ble_ota_dfu/keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To be filled if you want to use it on Arduino
#FUNCTIONS COLOR #D35400 - ORANGE KEYWORD1
#FUNCTIONS COLOR #D35400 - ORANGE KEYWORD2
#STRUCTURE COLOR #728E00 - GREEN KEYWORD3
#VARIABLES COLOR #00979C - BLUE LITERAL1
14 changes: 14 additions & 0 deletions esp32_ble_ota_lib_compact/lib/ble_ota_dfu/library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "ble_ota_dfuU",
"keywords": "BLE OTA DFU",
"description": "BLE OTA DFU",
"repository":
{
"type": "email",
"url": "[email protected]"
},
"version": "1.0.0",
"exclude": "doc",
"frameworks": "arduino",
"platforms": ["esp32"]
}
9 changes: 9 additions & 0 deletions esp32_ble_ota_lib_compact/lib/ble_ota_dfu/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=ble_ota_dfu
version=1.0.0
author=Vincent STRAGIER
maintainer=Vincent STRAGIER
sentence=BLE OTA DFU
paragraph=BLE OTA DFU
category=Other
url=mailto:[email protected]
architectures=esp32
Loading