Skip to content

Commit 122f2b3

Browse files
authored
CIの設定を追加 (#1)
* CIの設定を追加 * 依存パッケージのインストールを追記 * 依存パッケージの追加方法を修正 * clang-formatのシンボリックリンクを作成 * clang-formatで体裁を整える * 一箇所だけ自動でフォッマートされなかったので手動で修正 * 余計なファイルを削除 * add .gitignore * Actionのstatus badgeをREADMEに追加
1 parent ed4c968 commit 122f2b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+763
-459
lines changed

.DS_Store

-10 KB
Binary file not shown.

.clang-format

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Language: Cpp
2+
BasedOnStyle: Google
3+
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: AlwaysBreak
6+
BraceWrapping:
7+
AfterClass: true
8+
AfterFunction: true
9+
AfterNamespace: true
10+
AfterStruct: true
11+
BreakBeforeBraces: Custom
12+
ColumnLimit: 100
13+
ConstructorInitializerIndentWidth: 0
14+
ContinuationIndentWidth: 2
15+
DerivePointerAlignment: false
16+
PointerAlignment: Middle
17+
ReflowComments: false
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Compile Sketches
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**.md'
7+
pull_request:
8+
paths-ignore:
9+
- '**.md'
10+
workflow_dispatch:
11+
12+
env:
13+
# It's convenient to set variables for values used multiple times in the workflow
14+
SKETCHES_REPORTS_PATH: sketches-reports
15+
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
16+
17+
jobs:
18+
compile-sketches:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: arduino/compile-sketches@v1
23+
with:
24+
enable-deltas-report: true
25+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
fqbn: esp32:esp32:esp32s3
28+
platforms: | # ESP32公式のpackage indexを使用する
29+
- name: esp32:esp32
30+
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
31+
version: 3.1.3
32+
libraries: | # 依存パッケージを指定
33+
- name: AsyncTCP
34+
source-url: https://github.com/ESP32Async/AsyncTCP.git
35+
- name: ESPAsyncWebServer
36+
source-url: https://github.com/ESP32Async/ESPAsyncWebServer.git
37+
sketch-paths: |
38+
- pico_classic_v4_STEP1_LED
39+
- pico_classic_v4_STEP2_SWITCH
40+
- pico_classic_v4_STEP3_Buzzer
41+
- pico_classic_v4_STEP4_Sensor
42+
- pico_classic_v4_STEP5_Straight
43+
- pico_classic_v4_STEP6_rotate
44+
- pico_classic_v4_STEP7_P_control
45+
- pico_classic_v4_STEP8_micromouse
46+
47+
# This step is needed to pass the size data to the report job
48+
- name: Upload sketches report to workflow artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
52+
path: ${{ env.SKETCHES_REPORTS_PATH }}
53+
54+
report:
55+
needs: compile-sketches # Wait for the compile job to finish to get the data for the report
56+
if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request
57+
runs-on: ubuntu-latest
58+
steps:
59+
# This step is needed to get the size data produced by the compile jobs
60+
- name: Download sketches reports artifact
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
64+
path: ${{ env.SKETCHES_REPORTS_PATH }}
65+
continue-on-error: true
66+
67+
- uses: arduino/report-size-deltas@v1
68+
with:
69+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
70+
github-token: ${{ secrets.GITHUB_TOKEN }}
71+
continue-on-error: true

.github/workflows/lint.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**.md'
7+
pull_request:
8+
paths-ignore:
9+
- '**.md'
10+
workflow_dispatch:
11+
12+
jobs:
13+
arduino-lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: arduino/arduino-lint-action@v2
18+
with:
19+
recursive: true
20+
compliance: specification
21+
clang-format:
22+
needs: arduino-lint
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
# 各スケッチファイルの.ino、.hファイルに対してclang-formatによる整形が必要か判定する
27+
# 正規表現を簡単にするためzshを使用する
28+
- run: sudo apt install -y clang-format zsh
29+
- run: clang-format --dry-run -Werror pico_classic_v4_STEP*/*.(ino|h)
30+
shell: zsh {0}

.gitignore

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Ref: https://github.com/arduino/Arduino/blob/master/.gitignore
2+
3+
app/bin/
4+
app/pde.jar
5+
build/macosx/work/
6+
arduino-core/bin/
7+
arduino-core/arduino-core.jar
8+
hardware/arduino/bootloaders/caterina_LUFA/Descriptors.o
9+
hardware/arduino/bootloaders/caterina_LUFA/Descriptors.lst
10+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.sym
11+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.o
12+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.map
13+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.lst
14+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.lss
15+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.elf
16+
hardware/arduino/bootloaders/caterina_LUFA/Caterina.eep
17+
hardware/arduino/bootloaders/caterina_LUFA/.dep/
18+
build/*.zip
19+
build/*.tar.bz2
20+
build/windows/work/
21+
build/windows/*.zip
22+
build/windows/*.tgz
23+
build/windows/*.tar.bz2
24+
build/windows/libastylej*
25+
build/windows/liblistSerials*
26+
build/windows/arduino-*.zip
27+
build/windows/dist/*.tar.gz
28+
build/windows/dist/*.tar.bz2
29+
build/windows/launch4j-*.tgz
30+
build/windows/launch4j-*.zip
31+
build/windows/launcher/launch4j
32+
build/windows/WinAVR-*.zip
33+
build/macosx/arduino-*.zip
34+
build/macosx/dist/*.tar.gz
35+
build/macosx/dist/*.tar.bz2
36+
build/macosx/*.tar.bz2
37+
build/macosx/libastylej*
38+
build/macosx/appbundler*.jar
39+
build/macosx/appbundler*.zip
40+
build/macosx/appbundler
41+
build/macosx/appbundler-1.0ea-arduino?
42+
build/macosx/appbundler-1.0ea-arduino*.zip
43+
build/macosx/appbundler-1.0ea-upstream*.zip
44+
build/linux/work/
45+
build/linux/dist/*.tar.gz
46+
build/linux/dist/*.tar.bz2
47+
build/linux/*.tgz
48+
build/linux/*.tar.xz
49+
build/linux/*.tar.bz2
50+
build/linux/*.zip
51+
build/linux/libastylej*
52+
build/linux/liblistSerials*
53+
build/shared/arduino-examples*
54+
build/shared/reference*.zip
55+
build/shared/Edison*.zip
56+
build/shared/Galileo*.zip
57+
build/shared/WiFi101-Updater-ArduinoIDE-Plugin*.zip
58+
test-bin
59+
*.iml
60+
.idea
61+
.DS_Store
62+
.directory
63+
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h
64+
avr-toolchain-*.zip
65+
/app/nbproject/private/
66+
/arduino-core/nbproject/private/
67+
/app/build/
68+
/arduino-core/build/
69+
70+
manifest.mf
71+
nbbuild.xml
72+
nbproject
73+
74+
# Ref: https://github.com/espressif/arduino-esp32/blob/master/.gitignore
75+
tools/xtensa-esp32-elf
76+
tools/xtensa-esp32s2-elf
77+
tools/xtensa-esp32s3-elf
78+
tools/riscv32-esp-elf
79+
tools/dist
80+
tools/esptool
81+
tools/esptool.exe
82+
tools/mkspiffs
83+
tools/mklittlefs
84+
tools/mkfatfs.exe
85+
tools/openocd-esp32
86+
87+
# Ignore editor backup files and macOS system metadata
88+
.DS_Store
89+
.*.swp
90+
.*.swo
91+
*~
92+
93+
# Ignore build folder
94+
/build
95+
96+
# Ignore files built by Visual Studio/Visual Micro
97+
[Dd]ebug/
98+
[Rr]elease/
99+
.vs/
100+
__vm/
101+
*.vcxproj*
102+
.vscode/
103+
platform.sloeber.txt
104+
boards.sloeber.txt
105+
106+
# Ignore docs build (Sphinx)
107+
docs/build
108+
docs/source/_build
109+
__pycache__/
110+
_build/
111+
112+
# Test log files
113+
*.log
114+
debug.cfg
115+
debug.svd
116+
debug_custom.json

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# pico_classic4_arduino_examples
2+
3+
[![Compile Sketches](https://github.com/rt-net/pico_classic_v4_arduino_examples/actions/workflows/compile-sketches.yaml/badge.svg)](https://github.com/rt-net/pico_classic_v4_arduino_examples/actions/workflows/compile-sketches.yaml)
4+
[![Lint](https://github.com/rt-net/pico_classic_v4_arduino_examples/actions/workflows/lint.yaml/badge.svg)](https://github.com/rt-net/pico_classic_v4_arduino_examples/actions/workflows/lint.yaml)
5+
26
![pico_classic4](images/PiCo_Classic4_image.jpg)
37

48
Pi:Co Classic4用 Arduino サンプルスケッチ集です。
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clang-format

pico_classic_v4_STEP1_LED/pico_classic_v4_STEP1_LED.ino

100755100644
-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
1615
#define LED0 13
1716
#define LED1 14
1817
#define LED2 47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clang-format

pico_classic_v4_STEP2_SWITCH/pico_classic_v4_STEP2_SWITCH.ino

100755100644
+1-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
1615
#define LED0 13
1716
#define LED1 14
1817
#define LED2 47
@@ -37,7 +36,6 @@ void setup()
3736
pinMode(SW_R, INPUT_PULLUP);
3837

3938
g_state_r = g_state_c = g_state_l = 0;
40-
4139
}
4240

4341
void loop()
@@ -51,7 +49,7 @@ void loop()
5149
}
5250
if (digitalRead(SW_C) == 0) {
5351
digitalWrite(LED1, (++g_state_c) & 0x01);
54-
digitalWrite(LED2, (g_state_c)&0x01);
52+
digitalWrite(LED2, (g_state_c) & 0x01);
5553
}
5654
if (digitalRead(SW_L) == 0) {
5755
digitalWrite(LED3, (++g_state_l) & 0x01);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clang-format

pico_classic_v4_STEP3_Buzzer/pico_classic_v4_STEP3_Buzzer.ino

100755100644
-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
1615
#define LED0 13
1716
#define LED1 14
1817
#define LED2 47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clang-format

pico_classic_v4_STEP4_Sensor/pico_classic_v4_STEP4_Sensor.ino

100755100644
+7-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
1615
#define SLED_FR 9
1716
#define SLED_FL 10
1817
#define SLED_R 11
@@ -30,10 +29,11 @@ volatile short g_sensor_value_r;
3029
volatile short g_sensor_value_l;
3130
volatile short g_battery_value;
3231

33-
hw_timer_t* g_timer1 = NULL;
32+
hw_timer_t * g_timer1 = NULL;
3433
portMUX_TYPE g_timer_mux = portMUX_INITIALIZER_UNLOCKED;
3534

36-
void IRAM_ATTR onTimer1(void) {
35+
void IRAM_ATTR onTimer1(void)
36+
{
3737
static char cnt = 0;
3838
portENTER_CRITICAL_ISR(&g_timer_mux);
3939
switch (cnt) {
@@ -79,7 +79,8 @@ void IRAM_ATTR onTimer1(void) {
7979
portEXIT_CRITICAL_ISR(&g_timer_mux);
8080
}
8181

82-
void setup() {
82+
void setup()
83+
{
8384
// put your setup code here, to run once:
8485
//Sensor 発光off
8586
pinMode(SLED_FR, OUTPUT);
@@ -99,7 +100,8 @@ void setup() {
99100
timerStart(g_timer1);
100101
}
101102

102-
void loop() {
103+
void loop()
104+
{
103105
// put your main code here, to run repeatedly:
104106
Serial.printf("r_sen is %d\n\r", g_sensor_value_r);
105107
Serial.printf("fr_sen is %d\n\r", g_sensor_value_fr);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clang-format

pico_classic_v4_STEP5_Straight/TMC5240.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,15 @@
104104
#define TMC5240_PULSE (TIRE_DIAMETER * PI / (200.0 * microstep))
105105
#define TMC5240_VELOCITY (TMC5240_PULSE * 0.787) //13200000/2/2^23=0.787 +50c
106106

107-
108-
class TMC5240 {
107+
class TMC5240
108+
{
109109
private:
110-
111110
public:
112111
unsigned int readXactual(void);
113112
void write(unsigned char add, unsigned int data_l, unsigned int data_r);
114113
void init(void);
115114
};
116115

117-
118116
extern TMC5240 g_tmc5240;
119117

120-
121-
122118
#endif // TMC5240_H_

0 commit comments

Comments
 (0)