-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e92cae9
commit ea37c38
Showing
45 changed files
with
844 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.19) | ||
|
||
set(EXTRA_COMPONENT_DIRS | ||
${CMAKE_SOURCE_DIR}/../../packages/atclient # match this to be the path to the root CMakeLists.txt of atclient package | ||
${CMAKE_SOURCE_DIR}/../../packages/atchops # match this to be the path to the root CMakeLists.txt of atchops package | ||
) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
||
project(atclient_esp32_source) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# atclient_esp32_source | ||
|
||
This example shows you how to use atclient/atchops in your own ESP-IDF project by providing the path to the source code. | ||
|
||
## How to Consume Via Source Code | ||
|
||
In `make/CMakeLists.txt`, be sure to add the atclient and atchops components to the REQUIRES list: | ||
|
||
```cmake | ||
idf_component_register( | ||
SRCS "main.c" | ||
REQUIRES mbedtls atclient atchops | ||
) | ||
``` | ||
|
||
In `./CMakeLists.txt`, add the path to the atclient and atchops source code via the EXTRA_COMPONENT_DIRS variable: | ||
|
||
```cmake | ||
set(EXTRA_COMPONENT_DIRS | ||
${CMAKE_SOURCE_DIR}/../../packages/atclient # match this to be the path to the root CMakeLists.txt of atclient package | ||
${CMAKE_SOURCE_DIR}/../../packages/atchops # match this to be the path to the root CMakeLists.txt of atchops package | ||
) | ||
``` | ||
|
||
## Running the Example | ||
|
||
To run the example, you will need the ESP-IDF toolchain installed. See [ESP-IDF's Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) for more information. Ensure that your ESP32 is plugged into your computer with a micro USB data cable. | ||
|
||
Running the example via `get_idf && idf.py build && idf.py flash monitor` will give you something similar to: | ||
|
||
```sh | ||
atchops_base64_encode: 0 | ||
src: Lemonade! | ||
dst: TGVtb25hZGUh | ||
dst bytes: | ||
54 47 56 74 62 32 35 68 5a 47 55 68 | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
idf_component_register( | ||
SRCS "main.c" | ||
REQUIRES mbedtls atclient atchops | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include "atchops/base64.h" | ||
|
||
void app_main(void) | ||
{ | ||
const char *src = "Lemonade!"; | ||
unsigned long srclen = strlen(src); | ||
|
||
const unsigned long dstlen = 2048; | ||
const unsigned char *dst = malloc(sizeof(unsigned char) * dstlen); | ||
memset(dst, 0, dstlen); | ||
unsigned long dstolen = 0; // written length | ||
|
||
int ret = atchops_base64_encode((const unsigned char *) src, srclen, dst, dstlen, &dstolen); | ||
|
||
printf("atchops_base64_encode: %d\n", ret); | ||
|
||
printf("src: %s\n", src); | ||
printf("dst: %.*s\n", (int) dstolen, dst); | ||
printf("dst bytes: \n"); | ||
for(int i = 0; i < dstolen; i++) | ||
{ | ||
printf("%02x ", *(dst + i)); | ||
} | ||
printf("\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cmake_minimum_required(VERSION 3.19) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
||
project(atclient_esp32_static_components) |
Oops, something went wrong.