Skip to content

CIの設定を追加 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Language: Cpp
BasedOnStyle: Google

AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
BraceWrapping:
AfterClass: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
BreakBeforeBraces: Custom
ColumnLimit: 100
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
ReflowComments: false
71 changes: 71 additions & 0 deletions .github/workflows/compile-sketches.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Compile Sketches

on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:

env:
# It's convenient to set variables for values used multiple times in the workflow
SKETCHES_REPORTS_PATH: sketches-reports
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports

jobs:
compile-sketches:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/compile-sketches@v1
with:
enable-deltas-report: true
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
github-token: ${{ secrets.GITHUB_TOKEN }}
fqbn: esp32:esp32:esp32s3
platforms: | # ESP32公式のpackage indexを使用する
- name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
version: 3.1.3
libraries: | # 依存パッケージを指定
- name: AsyncTCP
source-url: https://github.com/ESP32Async/AsyncTCP.git
- name: ESPAsyncWebServer
source-url: https://github.com/ESP32Async/ESPAsyncWebServer.git
sketch-paths: |
- pico_classic_v4_STEP1_LED
- pico_classic_v4_STEP2_SWITCH
- pico_classic_v4_STEP3_Buzzer
- pico_classic_v4_STEP4_Sensor
- pico_classic_v4_STEP5_Straight
- pico_classic_v4_STEP6_rotate
- pico_classic_v4_STEP7_P_control
- pico_classic_v4_STEP8_micromouse

# This step is needed to pass the size data to the report job
- name: Upload sketches report to workflow artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

report:
needs: compile-sketches # Wait for the compile job to finish to get the data for the report
if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request
runs-on: ubuntu-latest
steps:
# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}
continue-on-error: true

- uses: arduino/report-size-deltas@v1
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
30 changes: 30 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint

on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:

jobs:
arduino-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v2
with:
recursive: true
compliance: specification
clang-format:
needs: arduino-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 各スケッチファイルの.ino、.hファイルに対してclang-formatによる整形が必要か判定する
# 正規表現を簡単にするためzshを使用する
- run: sudo apt install -y clang-format zsh
- run: clang-format --dry-run -Werror pico_classic_v4_STEP*/*.(ino|h)
shell: zsh {0}
116 changes: 116 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Ref: https://github.com/arduino/Arduino/blob/master/.gitignore

app/bin/
app/pde.jar
build/macosx/work/
arduino-core/bin/
arduino-core/arduino-core.jar
hardware/arduino/bootloaders/caterina_LUFA/Descriptors.o
hardware/arduino/bootloaders/caterina_LUFA/Descriptors.lst
hardware/arduino/bootloaders/caterina_LUFA/Caterina.sym
hardware/arduino/bootloaders/caterina_LUFA/Caterina.o
hardware/arduino/bootloaders/caterina_LUFA/Caterina.map
hardware/arduino/bootloaders/caterina_LUFA/Caterina.lst
hardware/arduino/bootloaders/caterina_LUFA/Caterina.lss
hardware/arduino/bootloaders/caterina_LUFA/Caterina.elf
hardware/arduino/bootloaders/caterina_LUFA/Caterina.eep
hardware/arduino/bootloaders/caterina_LUFA/.dep/
build/*.zip
build/*.tar.bz2
build/windows/work/
build/windows/*.zip
build/windows/*.tgz
build/windows/*.tar.bz2
build/windows/libastylej*
build/windows/liblistSerials*
build/windows/arduino-*.zip
build/windows/dist/*.tar.gz
build/windows/dist/*.tar.bz2
build/windows/launch4j-*.tgz
build/windows/launch4j-*.zip
build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
build/macosx/arduino-*.zip
build/macosx/dist/*.tar.gz
build/macosx/dist/*.tar.bz2
build/macosx/*.tar.bz2
build/macosx/libastylej*
build/macosx/appbundler*.jar
build/macosx/appbundler*.zip
build/macosx/appbundler
build/macosx/appbundler-1.0ea-arduino?
build/macosx/appbundler-1.0ea-arduino*.zip
build/macosx/appbundler-1.0ea-upstream*.zip
build/linux/work/
build/linux/dist/*.tar.gz
build/linux/dist/*.tar.bz2
build/linux/*.tgz
build/linux/*.tar.xz
build/linux/*.tar.bz2
build/linux/*.zip
build/linux/libastylej*
build/linux/liblistSerials*
build/shared/arduino-examples*
build/shared/reference*.zip
build/shared/Edison*.zip
build/shared/Galileo*.zip
build/shared/WiFi101-Updater-ArduinoIDE-Plugin*.zip
test-bin
*.iml
.idea
.DS_Store
.directory
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h
avr-toolchain-*.zip
/app/nbproject/private/
/arduino-core/nbproject/private/
/app/build/
/arduino-core/build/

manifest.mf
nbbuild.xml
nbproject

# Ref: https://github.com/espressif/arduino-esp32/blob/master/.gitignore
tools/xtensa-esp32-elf
tools/xtensa-esp32s2-elf
tools/xtensa-esp32s3-elf
tools/riscv32-esp-elf
tools/dist
tools/esptool
tools/esptool.exe
tools/mkspiffs
tools/mklittlefs
tools/mkfatfs.exe
tools/openocd-esp32

# Ignore editor backup files and macOS system metadata
.DS_Store
.*.swp
.*.swo
*~

# Ignore build folder
/build

# Ignore files built by Visual Studio/Visual Micro
[Dd]ebug/
[Rr]elease/
.vs/
__vm/
*.vcxproj*
.vscode/
platform.sloeber.txt
boards.sloeber.txt

# Ignore docs build (Sphinx)
docs/build
docs/source/_build
__pycache__/
_build/

# Test log files
*.log
debug.cfg
debug.svd
debug_custom.json
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# pico_classic4_arduino_examples

[![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)
[![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)

![pico_classic4](images/PiCo_Classic4_image.jpg)

Pi:Co Classic4用 Arduino サンプルスケッチ集です。
Expand Down
1 change: 1 addition & 0 deletions pico_classic_v4_STEP1_LED/.clang-format
1 change: 0 additions & 1 deletion pico_classic_v4_STEP1_LED/pico_classic_v4_STEP1_LED.ino
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#define LED0 13
#define LED1 14
#define LED2 47
Expand Down
1 change: 1 addition & 0 deletions pico_classic_v4_STEP2_SWITCH/.clang-format
4 changes: 1 addition & 3 deletions pico_classic_v4_STEP2_SWITCH/pico_classic_v4_STEP2_SWITCH.ino
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#define LED0 13
#define LED1 14
#define LED2 47
Expand All @@ -37,7 +36,6 @@ void setup()
pinMode(SW_R, INPUT_PULLUP);

g_state_r = g_state_c = g_state_l = 0;

}

void loop()
Expand All @@ -51,7 +49,7 @@ void loop()
}
if (digitalRead(SW_C) == 0) {
digitalWrite(LED1, (++g_state_c) & 0x01);
digitalWrite(LED2, (g_state_c)&0x01);
digitalWrite(LED2, (g_state_c) & 0x01);
}
if (digitalRead(SW_L) == 0) {
digitalWrite(LED3, (++g_state_l) & 0x01);
Expand Down
1 change: 1 addition & 0 deletions pico_classic_v4_STEP3_Buzzer/.clang-format
1 change: 0 additions & 1 deletion pico_classic_v4_STEP3_Buzzer/pico_classic_v4_STEP3_Buzzer.ino
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#define LED0 13
#define LED1 14
#define LED2 47
Expand Down
1 change: 1 addition & 0 deletions pico_classic_v4_STEP4_Sensor/.clang-format
12 changes: 7 additions & 5 deletions pico_classic_v4_STEP4_Sensor/pico_classic_v4_STEP4_Sensor.ino
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#define SLED_FR 9
#define SLED_FL 10
#define SLED_R 11
Expand All @@ -30,10 +29,11 @@ volatile short g_sensor_value_r;
volatile short g_sensor_value_l;
volatile short g_battery_value;

hw_timer_t* g_timer1 = NULL;
hw_timer_t * g_timer1 = NULL;
portMUX_TYPE g_timer_mux = portMUX_INITIALIZER_UNLOCKED;

void IRAM_ATTR onTimer1(void) {
void IRAM_ATTR onTimer1(void)
{
static char cnt = 0;
portENTER_CRITICAL_ISR(&g_timer_mux);
switch (cnt) {
Expand Down Expand Up @@ -79,7 +79,8 @@ void IRAM_ATTR onTimer1(void) {
portEXIT_CRITICAL_ISR(&g_timer_mux);
}

void setup() {
void setup()
{
// put your setup code here, to run once:
//Sensor 発光off
pinMode(SLED_FR, OUTPUT);
Expand All @@ -99,7 +100,8 @@ void setup() {
timerStart(g_timer1);
}

void loop() {
void loop()
{
// put your main code here, to run repeatedly:
Serial.printf("r_sen is %d\n\r", g_sensor_value_r);
Serial.printf("fr_sen is %d\n\r", g_sensor_value_fr);
Expand Down
1 change: 1 addition & 0 deletions pico_classic_v4_STEP5_Straight/.clang-format
8 changes: 2 additions & 6 deletions pico_classic_v4_STEP5_Straight/TMC5240.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,15 @@
#define TMC5240_PULSE (TIRE_DIAMETER * PI / (200.0 * microstep))
#define TMC5240_VELOCITY (TMC5240_PULSE * 0.787) //13200000/2/2^23=0.787 +50c


class TMC5240 {
class TMC5240
{
private:

public:
unsigned int readXactual(void);
void write(unsigned char add, unsigned int data_l, unsigned int data_r);
void init(void);
};


extern TMC5240 g_tmc5240;



#endif // TMC5240_H_
Loading