Skip to content

Commit ff372cb

Browse files
authored
Replace interface (#4)
1 parent aae008e commit ff372cb

File tree

11 files changed

+258
-798
lines changed

11 files changed

+258
-798
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ jobs:
2020
- name: link custom boards
2121
working-directory: ./zephyr_workspace/application/custom_boards
2222
run: |
23-
ls -lap .
2423
./link.sh
25-
- name: show boards directory
26-
working-directory: ./zephyr_workspace/application
27-
run: |
28-
ls -lap boards
2924
- name: initialize west
3025
working-directory: ./zephyr_workspace
3126
run: |
@@ -52,4 +47,4 @@ jobs:
5247
uses: actions/upload-artifact@v4
5348
with:
5449
name: signed_zephyr
55-
path: zephyr_workspace/signed_zephyr.bin
50+
path: zephyr_workspace/signed_zephyr.bin

.github/workflows/build2.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI - Fast
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
container:
8+
image: ghcr.io/jaster-prj/devcontainer-zephyr-workspace:latest
9+
outputs:
10+
artifact-url: ${{ steps.artifact-upload.outputs.artifact-url }}
11+
artifact-id: ${{ steps.artifact-upload.outputs.artifact-id }}
12+
steps:
13+
- name: link workspace
14+
run: |
15+
ln -s /workspace ./zephyr_workspace
16+
- name: Clone Application
17+
uses: actions/checkout@v4
18+
with:
19+
path: './zephyr_workspace/app'
20+
submodules: recursive
21+
- name: link custom boards
22+
working-directory: ./zephyr_workspace/app/custom_boards
23+
run: |
24+
./link.sh
25+
- name: patch git
26+
working-directory: ./zephyr_workspace/zephyr
27+
run: |
28+
git apply ../.patch/gpio_pcf857x.patch
29+
- name: save gartennode.pem
30+
working-directory: ./zephyr_workspace/bootloader/mcuboot
31+
run: |
32+
echo "$PEM" | base64 --decode > gartennode.pem
33+
shell: bash
34+
env:
35+
PEM: ${{ secrets.ZEPHYR_SIGN_KEY }}
36+
- name: build app
37+
working-directory: ./zephyr_workspace
38+
run: |
39+
west build -b gartennode app --build-dir build -- -DEXTRA_CONF_FILE=prj.conf
40+
imgtool sign --header-size 0x200 --align 8 --version 1.2 --slot-size 0x30000 --key bootloader/mcuboot/gartennode.pem --pad build/zephyr/zephyr.bin signed_zephyr.bin
41+
cp ./app/objdict/objdict.eds .
42+
tar -czf software.tar.gz signed_zephyr.bin objdict.eds
43+
- name: Publish binary
44+
id: artifact-upload
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: softwarefile
48+
path: zephyr_workspace/software.tar.gz
49+
trigger:
50+
needs: build
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Trigger Flash
54+
run: |
55+
# Set the required variables
56+
repo_owner="jaster-prj"
57+
repo_name="gartennode_updater"
58+
event_type="trigger-workflow"
59+
artifact_url=${{ needs.build.outputs.artifact-url }}
60+
artifact_id=${{ needs.build.outputs.artifact-id }}
61+
node_id=${{ vars.NODEID }}
62+
run_id=${{ github.run_id }}
63+
64+
echo $artifact_id
65+
66+
curl -L \
67+
-X POST \
68+
-H "Accept: application/vnd.github+json" \
69+
-H "Authorization: Bearer ${{ secrets.PAT }}" \
70+
-H "X-GitHub-Api-Version: 2022-11-28" \
71+
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
72+
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"repo_name\":\"jaster-prj/zephyr_gartennode_relaismodul\",\"run_id\":\"$run_id\",\"node_id\":\"$node_id\",\"artifact_id\":\"$artifact_id\",\"artifact_url\": \"$artifact_url\"}}"

boards/gartennode.overlay

Lines changed: 13 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,23 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
/ {
8-
zephyr,user {
9-
io-channels = <&adc1 8>;
10-
};
11-
12-
pressure_sw: pressure_sw {
13-
compatible = "power-switch";
14-
/* using built-in LED pin for demonstration */
15-
gpios = <&gpioa 0 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
16-
status = "okay";
17-
};
18-
19-
ultrasonic_sw: ultrasonic_sw {
20-
compatible = "power-switch";
21-
/* using built-in LED pin for demonstration */
22-
gpios = <&gpioa 1 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
23-
status = "okay";
24-
};
25-
26-
temperature_sw: temperature_sw {
27-
compatible = "power-switch";
28-
/* using built-in LED pin for demonstration */
29-
gpios = <&gpioa 2 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
30-
status = "okay";
31-
};
7+
#include <zephyr/dt-bindings/gpio/gpio.h>
8+
#include <zephyr/dt-bindings/led/led.h>
329

10+
/ {
3311
aliases {
3412
green-led = &green_led;
3513
};
36-
us0: HC-SR04 {
37-
compatible = "hc-sr04";
38-
trig-gpios = <&gpioa 4 GPIO_ACTIVE_HIGH>;
39-
echo-gpios = <&gpioa 5 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
40-
status = "okay";
41-
};
42-
w1_0: w1-zephyr-gpio-0 {
43-
compatible = "zephyr,w1-gpio";
44-
gpios = <&gpioa 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN|GPIO_PULL_UP)>;
45-
status = "okay";
46-
47-
temp_0: ds18b200 {
48-
compatible = "maxim,ds18b20";
49-
family-code = <0x28>;
50-
resolution = <12>;
51-
status = "okay";
52-
};
53-
temp_1: ds18b201 {
54-
compatible = "maxim,ds18b20";
55-
family-code = <0x28>;
56-
resolution = <12>;
57-
status = "okay";
58-
};
59-
};
6014
};
6115

62-
&adc1 {
63-
#address-cells = <1>;
64-
#size-cells = <0>;
65-
66-
/* pinctrl-0 = <&adc1_in5_pa0 &adc1_in6_pa1 &adc1_in7_pa2 &adc1_in8_pa3 &adc1_in9_pa4 &adc1_in10_pa5 &adc1_in11_pa6 &adc1_in12_pa7>; */
67-
pinctrl-0 = <&adc1_in8_pa3>;
68-
pinctrl-names = "default";
69-
st,adc-clock-source = <SYNC>;
70-
st,adc-prescaler = <4>;
71-
status = "okay";
72-
73-
channel@8 {
74-
reg = <8>;
75-
zephyr,gain = "ADC_GAIN_1";
76-
zephyr,reference = "ADC_REF_INTERNAL";
77-
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
78-
zephyr,resolution = <12>;
16+
&i2c1 {
17+
pcf8575: gpio-expander@27 {
18+
compatible = "nxp,pcf857x";
19+
reg = <0x27>;
20+
gpio-controller;
21+
#gpio-cells = <2>;
22+
ngpios = <16>;
23+
int-gpios = <&gpioa 0 0>;
24+
status = "okay";
7925
};
80-
};
26+
};

boards/nucleo_f767zi.overlay

Lines changed: 0 additions & 18 deletions
This file was deleted.

dts/bindings/power-switch.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

objdict/CO_OD.c

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ struct sCO_OD_ROM CO_OD_ROM = {
2626
/*1005*/ 0x0080L,
2727
/*1006*/ 0x0000L,
2828
/*1007*/ 0x0000L,
29-
/*1008*/ {'J', 'P', ' ', 'G', 'a', 'r', 't', 'e', 'n', 'n', 'o', 'd', 'e', ' ', '[', 'Z', 'y', 's', 't', 'e', 'r', 'n', 'e', ']'},
29+
/*1008*/ {'J', 'a', 's', 't', 'e', 'r', ' ', 'P', 'r', 'o', 'd', 'u', 'c', 't', 's', ' ', 'G', 'a', 'r', 't', 'e', 'n', 'n', 'o', 'd', 'e'},
3030
/*1009*/ {'1', '.', '0'},
31-
/*100a*/ {'0', '.', '0', '.', '1', '7'},
31+
/*100a*/ {'0', '.', '0', '.', '1'},
3232
/*1012*/ 0x0000L,
3333
/*1014*/ 0x0080L,
3434
/*1015*/ 0x64,
@@ -42,17 +42,17 @@ struct sCO_OD_ROM CO_OD_ROM = {
4242
/*1401*/ {0x2L, 0x0300L, 0xfeL},
4343
/*1402*/ {0x2L, 0x0400L, 0xfeL},
4444
/*1403*/ {0x2L, 0x0500L, 0xfeL}},
45-
/*1600*/ {{0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
45+
/*1600*/ {{0x6L, 0x21020108L, 0x21020208L, 0x21020308L, 0x21020408L, 0x21020508L, 0x21020608L, 0x0000L, 0x0000L},
4646
/*1601*/ {0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
4747
/*1602*/ {0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
4848
/*1603*/ {0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L}},
49-
/*1800*/ {{0x6L, 0x0180L, 0xfeL, 0x00, 0x0L, 0x3e8, 0x0L},
50-
/*1801*/ {0x6L, 0x0280L, 0xffL, 0x00, 0x0L, 0x3e8, 0x0L},
51-
/*1802*/ {0x6L, 0x0380L, 0xffL, 0x00, 0x0L, 0x3e8, 0x0L},
49+
/*1800*/ {{0x6L, 0x0180L, 0xfeL, 0x00, 0x0L, 0x00, 0x0L},
50+
/*1801*/ {0x6L, 0x0280L, 0xfeL, 0x00, 0x0L, 0x00, 0x0L},
51+
/*1802*/ {0x6L, 0x0380L, 0xfeL, 0x00, 0x0L, 0x00, 0x0L},
5252
/*1803*/ {0x6L, 0x0480L, 0xfeL, 0x00, 0x0L, 0x00, 0x0L}},
53-
/*1a00*/ {{0x2L, 0x21040020L, 0x21060020L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
54-
/*1a01*/ {0x1L, 0x21090020L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
55-
/*1a02*/ {0x2L, 0x21120110L, 0x21120210L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
53+
/*1a00*/ {{0x6L, 0x21020108L, 0x21020208L, 0x21020308L, 0x21020408L, 0x21020508L, 0x21020608L, 0x0000L, 0x0000L},
54+
/*1a01*/ {0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
55+
/*1a02*/ {0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L},
5656
/*1a03*/ {0x0L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L, 0x0000L}},
5757
/*1f80*/ 0x0000L,
5858

@@ -74,17 +74,7 @@ struct sCO_OD_RAM CO_OD_RAM = {
7474
/*1f56*/ {0x0000L},
7575
/*1f57*/ {0x0000L},
7676
/*2100*/ {0x0L},
77-
/*2102*/ 0x0L,
78-
/*2103*/ 0x0064L,
79-
/*2104*/ 0x0000L,
80-
/*2105*/ 0x0L,
81-
/*2106*/ 0x0000L,
82-
/*2107*/ 0x0L,
83-
/*2108*/ 0x0064L,
84-
/*2109*/ 0x0000L,
85-
/*2110*/ 0x0L,
86-
/*2111*/ 0x0064L,
87-
/*2112*/ {0x00, 0x00},
77+
/*2102*/ {0, 0, 0, 0, 0, 0},
8878

8979
CO_OD_FIRST_LAST_WORD,
9080
};
@@ -284,7 +274,7 @@ struct sCO_OD_EEPROM CO_OD_EEPROM = {
284274
/*******************************************************************************
285275
OBJECT DICTIONARY
286276
*******************************************************************************/
287-
const CO_OD_entry_t CO_OD[55] = {
277+
const CO_OD_entry_t CO_OD[45] = {
288278

289279
{0x1000, 0x00, 0x85, 4, (void*)&CO_OD_ROM.deviceType},
290280
{0x1001, 0x00, 0x26, 1, (void*)&CO_OD_RAM.errorRegister},
@@ -293,9 +283,9 @@ const CO_OD_entry_t CO_OD[55] = {
293283
{0x1005, 0x00, 0x8d, 4, (void*)&CO_OD_ROM.COB_ID_SYNCMessage},
294284
{0x1006, 0x00, 0x8d, 4, (void*)&CO_OD_ROM.communicationCyclePeriod},
295285
{0x1007, 0x00, 0x8d, 4, (void*)&CO_OD_ROM.synchronousWindowLength},
296-
{0x1008, 0x00, 0x05, 24, (void*)&CO_OD_ROM.manufacturerDeviceName},
286+
{0x1008, 0x00, 0x05, 26, (void*)&CO_OD_ROM.manufacturerDeviceName},
297287
{0x1009, 0x00, 0x05, 3, (void*)&CO_OD_ROM.manufacturerHardwareVersion},
298-
{0x100a, 0x00, 0x05, 6, (void*)&CO_OD_ROM.manufacturerSoftwareVersion},
288+
{0x100a, 0x00, 0x05, 5, (void*)&CO_OD_ROM.manufacturerSoftwareVersion},
299289
{0x1010, 0x01, 0x8e, 4, (void*)&CO_OD_RAM.storeParameters[0]},
300290
{0x1011, 0x01, 0x8e, 4, (void*)&CO_OD_RAM.restoreDefaultParameters[0]},
301291
{0x1012, 0x00, 0x85, 4, (void*)&CO_OD_ROM.COB_ID_TIME},
@@ -330,16 +320,6 @@ const CO_OD_entry_t CO_OD[55] = {
330320
{0x1f80, 0x00, 0x8d, 4, (void*)&CO_OD_ROM.NMTStartup},
331321
{0x2100, 0x00, 0x26, 10, (void*)&CO_OD_RAM.errorStatusBits},
332322
{0x2101, 0x00, 0xa7, 4, (void*)&CO_OD_EEPROM.powerOnCounter},
333-
{0x2102, 0x00, 0x3e, 1, (void*)&CO_OD_RAM.pressureEnable},
334-
{0x2103, 0x00, 0xbe, 4, (void*)&CO_OD_RAM.pressurePeriode},
335-
{0x2104, 0x00, 0xa6, 4, (void*)&CO_OD_RAM.pressureMeasurement},
336-
{0x2105, 0x00, 0x1a, 1, (void*)&CO_OD_RAM.pressureDistanceMax},
337-
{0x2106, 0x00, 0xa6, 4, (void*)&CO_OD_RAM.pressureDistance},
338-
{0x2107, 0x00, 0x3e, 1, (void*)&CO_OD_RAM.ultrasonicEnable},
339-
{0x2108, 0x00, 0xbe, 4, (void*)&CO_OD_RAM.ultrasonicPeriode},
340-
{0x2109, 0x00, 0xa6, 4, (void*)&CO_OD_RAM.ultrasonicDistance},
341-
{0x2110, 0x00, 0x3e, 1, (void*)&CO_OD_RAM.temperatureEnable},
342-
{0x2111, 0x00, 0xbe, 4, (void*)&CO_OD_RAM.temperaturePeriode},
343-
{0x2112, 0x02, 0xbe, 2, (void*)&CO_OD_RAM.temperatureValue[0]},
323+
{0x2102, 0x06, 0x3e, 1, (void*)&CO_OD_RAM.outputs[0]},
344324
};
345325
// clang-format on

0 commit comments

Comments
 (0)