Skip to content

Commit

Permalink
Merge pull request #127 from adafruit/json-repo-updates
Browse files Browse the repository at this point in the history
Magic Config updates
  • Loading branch information
lorennorman committed Nov 29, 2023
2 parents 214b91e + 26136ef commit 49425a7
Show file tree
Hide file tree
Showing 51 changed files with 1,554 additions and 56 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@ on: [pull_request]

jobs:
validate-definition-files:
name: Validate Definition Files
name: Validate JSON Schemas
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Schema Docs: https://ajv.js.org/json-schema.html#json-data-type
- name: Validate Board JSON
uses: lorennorman/validate-json-action@master
with:
# Schema Docs: https://ajv.js.org/json-schema.html#json-data-type
schema: /boards/schema.json
jsons: boards/*/definition.json

- name: Validate Magic JSON
uses: lorennorman/validate-json-action@master
with:
schema: /boards/magic_schema.json
jsons: boards/*/magic.json

check-user-permissions:
name: Check Write Permission
runs-on: ubuntu-latest
Expand All @@ -29,6 +35,7 @@ jobs:
route: GET /repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- id: set-permission
if: fromJson(steps.fetch-permissions.outputs.data).permission == 'admin' || fromJson(steps.fetch-permissions.outputs.data).permission == 'write'
run: echo "has-permission=true" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -65,10 +72,10 @@ jobs:
# TODO: break these regexes up into modular chunks that check specific things for readability and composability
# external contributors can modify some files
EXTERNAL_REGEX="^boards\/.*\/(definition\.json|((image|images\/(boot-(drive|loader)|drag-drop|reset|usb))\.(png|jpe?g|gif|svg)))$"
EXTERNAL_REGEX="^boards\/.*\/(definition\.json|magic\.json|((image|images\/(boot-(drive|loader)|drag-drop|reset|usb))\.(png|jpe?g|gif|svg)))$"
# folks with write access to the repo (Adafruit team) can change more sensitive files
INTERNAL_REGEX="^(\.github\/.*|boards\/(schema.json|.*\/(definition\.json|((image|images\/(boot-(drive|loader)|drag-drop|reset|usb))\.(png|jpe?g|gif|svg)))))$"
INTERNAL_REGEX="^(README.md|\.github\/.*|boards\/(schema.json|magic_schema.json|.*\/(definition\.json|magic\.json|((image|images\/(boot-(drive|loader)|drag-drop|reset|usb))\.(png|jpe?g|gif|svg)))))$"
# apply the appropriate regex based on permissions of the user
if [[ $CAN_WRITE_TO_REPO ]]; then
Expand Down Expand Up @@ -104,7 +111,7 @@ jobs:
EXIT_VALUE=0
for FILE in $FILES; do
if ! [[ $FILE =~ "\.(svg|jpe?g|png)$" ]]; then
if ! [[ $FILE =~ \.(svg|jpe?g|png)$ ]]; then
continue # non-image file
fi
Expand Down Expand Up @@ -164,7 +171,7 @@ jobs:
MAX_HEIGHT=2000
for FILE in $FILES; do
if ! [[ $FILE =~ "\.(svg|jpe?g|png)$" ]]; then
if ! [[ $FILE =~ \.(svg|jpe?g|png)$ ]]; then
continue # non-image file
fi
Expand Down Expand Up @@ -223,7 +230,7 @@ jobs:
MAX_ANIGIF_FILESIZE=$((1000*1024)) # 1MB
for FILE in $FILES; do
if ! [[ $FILE =~ "\.(svg|jpe?g|png)$" ]]; then
if ! [[ $FILE =~ \.(svg|jpe?g|png)$ ]]; then
continue # non-image file
fi
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Information related to the hardware including the hardware's name, description a
| mcuRefVoltage | Yes | Float | Microcontroller's maximum voltage reference, in Volts. |
| displayName | Yes | String | Adafruit IO Device name |
| description | No | String | Device description |
| productPageURL | Yes | String | Link to board's homepage. |
| productURL | Yes | String | Link to board's homepage. |
| documentationURL | Yes | String | Link to board's documentation. |


Expand Down Expand Up @@ -79,4 +79,4 @@ The following HDM snippet defines an I2C interface on port 0 with a `SDA` GPIO p
Example hardware descriptions can be found in the `boards/` directory.

# Limitations
* The Adafruit IO WipperSnapper Firmware currently supports the following microcontrollers with a WiFi network interface: ESP8266, ESP32, ESP32-S2, ESP32-S3, SAMD51, SAMD21.
* The Adafruit IO WipperSnapper Firmware currently supports the following microcontrollers with a WiFi network interface: ESP8266, ESP32, ESP32-S2, ESP32-S3, SAMD51, SAMD21.
6 changes: 3 additions & 3 deletions boards/feather-esp32-v2/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"mcuRefVoltage": 3.3,
"displayName":"Adafruit Feather ESP32 V2",
"vendor":"Adafruit",
"productPageURL":"https://www.adafruit.com/product/5400",
"productURL":"https://www.adafruit.com/product/5400",
"documentationURL":"https://learn.adafruit.com/adafruit-esp32-feather-v2",
"installMethod":"web",
"esptool": {
Expand Down Expand Up @@ -197,8 +197,8 @@
"hasServo":true
},
{
"name":"A13",
"displayName":"A13 (VBat Monitor)",
"name":"A35",
"displayName":"VBat Monitor",
"dataType":"int16"
}
],
Expand Down
51 changes: 51 additions & 0 deletions boards/feather-esp32-v2/magic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"exportVersion": "1.0.0",
"exportedBy": "Adafruit",
"exportedAt": "2023-11-13T19:41:29.465Z",
"exportedFromDevice": {
"board": "feather-esp32-v2",
"firmwareVersion": "1.0.0-beta.73"
},
"components": [
{
"name": "Button (D0/Boot)",
"pinName": "D38",
"type": "push_button",
"mode": "DIGITAL",
"direction": "INPUT",
"period": 0,
"isPin": true,
"pull": "UP"
},
{
"name": "Dimmable LED",
"type": "dimmable_led",
"pwmSetting": "fixedFrequency",
"frequency": 5000,
"resolution": 12,
"pinName": "D13",
"isPWM": true,
"selected": false
},
{
"name": "NeoPixel",
"pixelNumber": 1,
"pixelsOrder": "GRB",
"pixelBrightness": 255,
"pinName": "D0",
"type": "neopixel",
"pixelsType": "NEOPIXEL",
"isPixel": true
},
{
"name": "Battery ADC",
"pinName": "A35",
"type": "analog_pin",
"mode": "ANALOG",
"direction": "INPUT",
"analogReadMode": "PIN_VOLTAGE",
"period": 30,
"isPin": true
}
]
}
4 changes: 2 additions & 2 deletions boards/feather-esp32/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"mcuRefVoltage": 3.3,
"displayName":"Adafruit Feather HUZZAH ESP32",
"vendor":"Adafruit",
"productPageURL":"https://www.adafruit.com/product/3405",
"productURL":"https://www.adafruit.com/product/3405",
"documentationURL":"https://learn.adafruit.com/adafruit-huzzah32-esp32-feather",
"installMethod":"web",
"esptool": {
Expand Down Expand Up @@ -209,7 +209,7 @@
},
{
"name":"A35",
"displayName":"VBAT",
"displayName":"A13 (VBAT)",
"dataType":"int16"
}
],
Expand Down
31 changes: 31 additions & 0 deletions boards/feather-esp32/magic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"exportVersion": "1.0.0",
"exportedBy": "Adafruit",
"exportedAt": "2023-11-13T19:41:29.465Z",
"exportedFromDevice": {
"board": "feather-esp32",
"firmwareVersion": "1.0.0-beta.73"
},
"components": [
{
"name": "Dimmable LED",
"type": "dimmable_led",
"pwmSetting": "fixedFrequency",
"frequency": 5000,
"resolution": 12,
"pinName": "D13",
"isPWM": true,
"selected": false
},
{
"name": "Battery ADC",
"pinName": "A35",
"type": "analog_pin",
"mode": "ANALOG",
"direction": "INPUT",
"analogReadMode": "PIN_VOLTAGE",
"period": 30,
"isPin": true
}
]
}
7 changes: 4 additions & 3 deletions boards/feather-esp32s2-reverse-tft/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
"mcuRefVoltage":2.6,
"displayName":"ESP32-S2 Reverse TFT Feather",
"vendor":"Adafruit",
"productPageURL":"https://www.adafruit.com/product/5345",
"productURL":"https://www.adafruit.com/product/5345",
"documentationURL":"https://learn.adafruit.com/esp32-s2-reverse-tft-feather",
"installMethod":"uf2",
"components":{
"digitalPins":[
{
"name":"D0",
"displayName":"D0 Push Button",
"dataType":"bool"
"displayName":"D0 (Boot Push Button)",
"dataType":"bool",
"direction":"INPUT"
},
{
"name":"D1",
Expand Down
93 changes: 93 additions & 0 deletions boards/feather-esp32s2-reverse-tft/magic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"exportVersion": "1.0.0",
"exportedBy": "Adafruit",
"exportedAt": "2023-11-15T19:21:27.557Z",
"exportedFromDevice": {
"board": "feather-esp32s2-reverse-tft",
"firmwareVersion": "1.0.0-beta.73"
},
"components": [
{
"name": "Button D0",
"pinName": "D0",
"type": "push_button",
"mode": "DIGITAL",
"direction": "INPUT",
"period": 0,
"pull": "UP",
"isPin": true
},
{
"name": "Button D1",
"pinName": "D1",
"type": "push_button",
"mode": "DIGITAL",
"direction": "INPUT",
"period": 0,
"pull": "DOWN",
"isPin": true
},
{
"name": "Button D2",
"pinName": "D2",
"type": "push_button",
"mode": "DIGITAL",
"direction": "INPUT",
"period": 0,
"pull": "DOWN",
"isPin": true
},
{
"name": "Dimmable LED",
"type": "dimmable_led",
"pwmSetting": "fixedFrequency",
"frequency": 5000,
"resolution": 12,
"pinName": "D13",
"isPWM": true,
"selected": false
},
{
"name": "NeoPixel",
"pixelNumber": 1,
"pixelsOrder": "GRB",
"pixelBrightness": 255,
"pinName": "D33",
"type": "neopixel",
"pixelsType": "NEOPIXEL",
"isPixel": true
},
{
"name": "LC709203F: Battery Cell Percent",
"isI2C": true,
"type": "lc709203f:unitless-percent",
"period": 30,
"i2cAddress": 11,
"sensorType": "unitless-percent"
},
{
"name": "LC709203F: Battery Cell Voltage",
"isI2C": true,
"type": "lc709203f:voltage",
"period": 30,
"i2cAddress": 11,
"sensorType": "voltage"
},
{
"name": "MAX17048/MAX17049: Battery Cell Percent",
"isI2C": true,
"type": "max17048:unitless-percent",
"period": 30,
"i2cAddress": 54,
"sensorType": "unitless-percent"
},
{
"name": "MAX17048/MAX17049: Battery Cell Voltage",
"isI2C": true,
"type": "max17048:voltage",
"period": 30,
"i2cAddress": 54,
"sensorType": "voltage"
}
]
}
7 changes: 4 additions & 3 deletions boards/feather-esp32s2-tft/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
"mcuRefVoltage": 2.6,
"displayName": "Adafruit ESP32-S2 TFT Feather",
"vendor": "Adafruit",
"productPageURL": "https://www.adafruit.com/product/5300",
"productURL": "https://www.adafruit.com/product/5300",
"documentationURL": "https://learn.adafruit.com/adafruit-esp32-s2-tft-feather",
"installMethod": "uf2",
"components": {
"digitalPins": [
{
"name": "D0",
"displayName": "D0 (Boot Btn)",
"dataType": "bool"
"displayName": "D0 (Boot Push Button)",
"dataType": "bool",
"direction":"INPUT"
},
{
"name": "D1",
Expand Down

0 comments on commit 49425a7

Please sign in to comment.