-
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.
Merge pull request #3 from dojyorin/dev
Improve code and add actions workflow.
- Loading branch information
Showing
13 changed files
with
287 additions
and
138 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Release | ||
"on": | ||
push: | ||
tags: v[0-9]+.[0-9]+.[0-9]+ | ||
jobs: | ||
release: | ||
name: 'Release: ${{github.ref_name}}' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: clone repository | ||
uses: actions/checkout@v3 | ||
- name: dispatch release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
generate_release_notes: true |
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,54 @@ | ||
name: Test | ||
"on": | ||
push: | ||
branches: | ||
- dev | ||
paths-ignore: | ||
- .git* | ||
- '**.md' | ||
- '*.properties' | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
paths-ignore: | ||
- .git* | ||
- '**.md' | ||
- '*.properties' | ||
jobs: | ||
test: | ||
name: 'Test: ${{matrix.board.name}}' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
board: | ||
- vendor: arduino | ||
arch: samd | ||
name: arduino_zero_native | ||
- vendor: adafruit | ||
arch: samd | ||
name: adafruit_trinket_m0 | ||
- vendor: teensy | ||
arch: avr | ||
name: teensy41 | ||
include: | ||
- index: https://downloads.arduino.cc/packages/package_index.json | ||
board: | ||
vendor: arduino | ||
- index: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json | ||
board: | ||
vendor: adafruit | ||
- index: https://www.pjrc.com/teensy/package_teensy_index.json | ||
board: | ||
vendor: teensy | ||
steps: | ||
- name: clone repository | ||
uses: actions/checkout@v3 | ||
- name: install arduino and run test | ||
uses: arduino/compile-sketches@v1 | ||
with: | ||
fqbn: ${{matrix.board.vendor}}:${{matrix.board.arch}}:${{matrix.board.name}} | ||
platforms: |- | ||
- name: ${{matrix.board.vendor}}:${{matrix.board.arch}} | ||
source-url: ${{matrix.index}} |
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,24 @@ | ||
{ | ||
"name": "Release", | ||
"on": { | ||
"push": { | ||
"tags": "v[0-9]+.[0-9]+.[0-9]+" | ||
} | ||
}, | ||
"jobs": { | ||
"release": { | ||
"name": "Release: ${{github.ref_name}}", | ||
"runs-on": "ubuntu-latest", | ||
"steps": [{ | ||
"name": "clone repository", | ||
"uses": "actions/checkout@v3" | ||
}, { | ||
"name": "dispatch release", | ||
"uses": "softprops/action-gh-release@v1", | ||
"with": { | ||
"generate_release_notes": true | ||
} | ||
}] | ||
} | ||
} | ||
} |
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,77 @@ | ||
{ | ||
"name": "Test", | ||
"on": { | ||
"push": { | ||
"branches": [ | ||
"dev" | ||
], | ||
"paths-ignore": [ | ||
".git*", | ||
"**.md", | ||
"*.properties" | ||
] | ||
}, | ||
"pull_request": { | ||
"branches": [ | ||
"master", | ||
"dev" | ||
], | ||
"paths-ignore": [ | ||
".git*", | ||
"**.md", | ||
"*.properties" | ||
] | ||
} | ||
}, | ||
"jobs": { | ||
"test": { | ||
"name": "Test: ${{matrix.board.name}}", | ||
"runs-on": "ubuntu-latest", | ||
"strategy": { | ||
"fail-fast": true, | ||
"matrix": { | ||
"board": [{ | ||
"vendor": "arduino", | ||
"arch": "samd", | ||
"name": "arduino_zero_native" | ||
}, { | ||
"vendor": "adafruit", | ||
"arch": "samd", | ||
"name": "adafruit_trinket_m0" | ||
}, { | ||
"vendor": "teensy", | ||
"arch": "avr", | ||
"name": "teensy41" | ||
}], | ||
"include": [{ | ||
"index": "https://downloads.arduino.cc/packages/package_index.json", | ||
"board": { | ||
"vendor": "arduino" | ||
} | ||
}, { | ||
"index": "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json", | ||
"board": { | ||
"vendor": "adafruit" | ||
} | ||
}, { | ||
"index": "https://www.pjrc.com/teensy/package_teensy_index.json", | ||
"board": { | ||
"vendor": "teensy" | ||
} | ||
}] | ||
} | ||
}, | ||
"steps": [{ | ||
"name": "clone repository", | ||
"uses": "actions/checkout@v3" | ||
}, { | ||
"name": "install arduino and run test", | ||
"uses": "arduino/compile-sketches@v1", | ||
"with": { | ||
"fqbn": "${{matrix.board.vendor}}:${{matrix.board.arch}}:${{matrix.board.name}}", | ||
"platforms": "- name: ${{matrix.board.vendor}}:${{matrix.board.arch}}\n source-url: ${{matrix.index}}" | ||
} | ||
}] | ||
} | ||
} | ||
} |
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 @@ | ||
set -uC | ||
cd ${0%/*} | ||
|
||
yq -P -I 4 ./${1}.json | head -c -1 | tee ../workflows/${1}.yaml &> /dev/null |
Empty file.
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 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 |
---|---|---|
@@ -1,65 +1,55 @@ | ||
# Arduino Base64 Codec | ||
Binary based simple Base64 Codec for Arduino. | ||
# **Arduino BASE64 Codec** | ||
Binary based simple BASE64 Codec for Arduino. | ||
|
||
# Example | ||
## Encode | ||
```c++ | ||
const char* rawData = "foobar"; | ||
size_t rawLength = strlen(rawData); | ||
const char data[] = "foobar"; | ||
size_t dataLength = strlen(data); | ||
char result[BASE64::encodeLength(dataLength)]; | ||
|
||
char encoded[BASE64::encodeLength(rawLength)]; | ||
BASE64::encode((const uint8_t*)rawData, rawLength, encoded); | ||
|
||
Serial.println(encoded); | ||
BASE64::encode((const uint8_t*)data, dataLength, result); | ||
``` | ||
## Decode | ||
```c++ | ||
const char* encoded = "Zm9vYmFy"; | ||
uint8_t raw[BASE64::decodeLength(encoded)]; | ||
BASE64::decode(encoded, raw); | ||
const char data[] = "Zm9vYmFy"; | ||
uint8_t result[BASE64::decodeLength(data)]; | ||
Serial.println((char*)raw); | ||
BASE64::decode(data, result); | ||
``` | ||
|
||
# API | ||
## void BASE64::encode(const uint8_t* input, size_t inputLength, char* output) | ||
**Arguments** | ||
- `input`: Receives raw binary data as a byte array. | ||
- `inputLength`: Number of bytes of input data. | ||
- `output`: Base64 encoded string. | ||
|
||
**Return** | ||
- Nothing. | ||
|
||
**Note** | ||
- If the input data is `char*` string, cast it to `uint8_t*`. | ||
|
||
## size_t BASE64::encodeLength(size_t inputLength) | ||
**Arguments** | ||
- `inputLength`: Number of bytes of input data. | ||
|
||
**Return** | ||
- Number of characters after Base64 encoding. | ||
|
||
## void BASE64::decode(const char* input, uint8_t* output) | ||
**Arguments** | ||
- `input`: Receives string data as a base64 encoded. | ||
- `output`: Raw binary data. | ||
|
||
**Return** | ||
- Nothing. | ||
|
||
**Note** | ||
- If the output data is string, you can cast it to `char*`. | ||
|
||
## size_t BASE64::decodeLength(const char* input) | ||
**Arguments** | ||
- `input`: Receives string data as a base64 encoded. | ||
|
||
**Return** | ||
- Number of bytes after Base64 decoding. | ||
## `BASE64::encode()` | ||
- Arguments | ||
- `input` : `const uint8_t*` ... Binary data. | ||
- `inputLength` : `size_t` ... Number of bytes of input data. | ||
- `output` : `char*` ... BASE64 encoded string. | ||
- Result | ||
- `void` | ||
|
||
If the input data is string such as `char*`, cast it to `uint8_t*`. | ||
|
||
## `BASE64::encodeLength()` | ||
- Arguments | ||
- `inputLength` : `size_t` ... Number of bytes of input data. | ||
- Result | ||
- `size_t` ... Number of characters after BASE64 encoding. | ||
|
||
## `BASE64::decode()` | ||
- Arguments | ||
- `input` : `const char*` ... BASE64 encoded string. | ||
- `output` : `uint8_t*` ... Binary data. | ||
- Result | ||
- `void` | ||
|
||
If the output data is string, you can cast it to `char*`. | ||
|
||
## `BASE64::decodeLength()` | ||
- Arguments | ||
- `input` : `const char*` ... BASE64 encoded string. | ||
- Result | ||
- `size_t` ... Number of bytes after BASE64 decoding. | ||
|
||
# Disclaimer | ||
According to MIT License. |
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 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 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name=Base64_Codec | ||
version=1.0.6 | ||
name=BASE64_Codec | ||
version=1.0.7 | ||
author=dojyorin | ||
maintainer=https://github.com/dojyorin | ||
sentence=Base64 codec | ||
paragraph=Binary based simple Base64 codec. | ||
sentence=BASE64 Codec | ||
paragraph=Binary based simple BASE64 codec. | ||
category=Other | ||
url=https://github.com/dojyorin/arduino_base64.git | ||
architectures=* |
Oops, something went wrong.