Skip to content

Commit 391d730

Browse files
author
piclaw
committed
Fix CI: use standard Adafruit workflow, clang-format hw_tests
1 parent 7963ad9 commit 391d730

19 files changed

Lines changed: 94 additions & 114 deletions

File tree

.github/workflows/clang-format.yml

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

.github/workflows/githubci.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
name: Arduino Library CI
22

3-
on: [pull_request, push]
3+
on: [pull_request, push, repository_dispatch]
44

55
jobs:
66
build:
77
runs-on: ubuntu-latest
8+
89
steps:
9-
- uses: actions/checkout@v4
10-
- uses: actions/setup-python@v5
11-
with:
12-
python-version: '3.x'
13-
- uses: adafruit/ci-arduino@master
14-
with:
15-
arduino-platform: 'arduino:avr'
10+
- uses: actions/setup-python@v4
11+
with:
12+
python-version: '3.x'
13+
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v3
15+
with:
16+
repository: adafruit/ci-arduino
17+
path: ci
18+
19+
- name: pre-install
20+
run: bash ci/actions_install.sh
21+
22+
- name: test platforms
23+
run: python3 ci/build_platform.py main_platforms
24+
25+
- name: clang
26+
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
27+
28+
- name: doxygen
29+
env:
30+
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
31+
PRETTYNAME : "Adafruit AS7331 Library"
32+
run: bash ci/doxy_gen_and_deploy.sh

hw_tests/begin_test/begin_test.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ void setup() {
1515
}
1616
}
1717

18-
void loop() {
19-
delay(1000);
20-
}
18+
void loop() { delay(1000); }

hw_tests/break_time_test/break_time_test.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,4 @@ void setup(void) {
7070
Serial.println(all_pass ? "Overall: PASS" : "Overall: FAIL");
7171
}
7272

73-
void loop(void) {
74-
}
73+
void loop(void) {}

hw_tests/busio_test/busio_test.ino

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
#include <Adafruit_I2CDevice.h>
21
#include <Adafruit_BusIO_Register.h>
2+
#include <Adafruit_I2CDevice.h>
33

44
#define AS7331_ADDR 0x74
55

66
Adafruit_I2CDevice *i2c_dev;
77

88
void setup() {
99
Serial.begin(115200);
10-
while (!Serial) delay(10);
11-
10+
while (!Serial)
11+
delay(10);
12+
1213
Serial.println("BusIO Test for AS7331");
1314
Serial.println("=====================");
14-
15+
1516
i2c_dev = new Adafruit_I2CDevice(AS7331_ADDR);
1617
if (!i2c_dev->begin()) {
1718
Serial.println("I2C device not found!");
18-
while(1);
19+
while (1)
20+
;
1921
}
2022
Serial.println("I2C device found.");
21-
23+
2224
// Method 1: Direct read with buffer
2325
Serial.println("\nMethod 1: Direct i2c_dev->write_then_read()");
2426
uint8_t reg = 0x02;
@@ -29,7 +31,7 @@ void setup() {
2931
} else {
3032
Serial.println("write_then_read FAILED");
3133
}
32-
34+
3335
// Method 2: BusIO_Register with explicit 1-byte width
3436
Serial.println("\nMethod 2: BusIO_Register (8-bit, width=1)");
3537
Adafruit_BusIO_Register agen8(i2c_dev, 0x02, 1);
@@ -40,7 +42,7 @@ void setup() {
4042
} else {
4143
Serial.println("BusIO_Register read FAILED");
4244
}
43-
45+
4446
// Method 3: BusIO_Register default (might be 2 bytes?)
4547
Serial.println("\nMethod 3: BusIO_Register (default constructor)");
4648
Adafruit_BusIO_Register agen_def(i2c_dev, 0x02);
@@ -51,8 +53,8 @@ void setup() {
5153
} else {
5254
Serial.println("BusIO_Register default read FAILED");
5355
}
54-
55-
// Method 4: Read as 16-bit
56+
57+
// Method 4: Read as 16-bit
5658
Serial.println("\nMethod 4: BusIO_Register (16-bit)");
5759
Adafruit_BusIO_Register agen16(i2c_dev, 0x02, 2, LSBFIRST);
5860
uint16_t val16 = 0;
@@ -62,10 +64,8 @@ void setup() {
6264
} else {
6365
Serial.println("16-bit read FAILED");
6466
}
65-
67+
6668
Serial.println("\nDone.");
6769
}
6870

69-
void loop() {
70-
delay(1000);
71-
}
71+
void loop() { delay(1000); }

hw_tests/clock_freq_test/clock_freq_test.ino

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ Adafruit_AS7331 as7331;
88
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
99

1010
static const as7331_clock_t kClocks[] = {
11-
AS7331_CLOCK_1024MHZ,
12-
AS7331_CLOCK_2048MHZ,
13-
AS7331_CLOCK_4096MHZ,
14-
AS7331_CLOCK_8192MHZ,
11+
AS7331_CLOCK_1024MHZ,
12+
AS7331_CLOCK_2048MHZ,
13+
AS7331_CLOCK_4096MHZ,
14+
AS7331_CLOCK_8192MHZ,
1515
};
1616

1717
static const char *kClockLabels[] = {
18-
"1024MHz",
19-
"2048MHz",
20-
"4096MHz",
21-
"8192MHz",
18+
"1024MHz",
19+
"2048MHz",
20+
"4096MHz",
21+
"8192MHz",
2222
};
2323

2424
void setup() {
@@ -70,5 +70,4 @@ void setup() {
7070
Serial.println(overall_pass ? "OVERALL PASS" : "OVERALL FAIL");
7171
}
7272

73-
void loop() {
74-
}
73+
void loop() {}

hw_tests/diag_test/diag_test.ino

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,33 @@
44

55
void setup() {
66
Serial.begin(115200);
7-
while (!Serial) delay(10);
8-
7+
while (!Serial)
8+
delay(10);
9+
910
Wire.begin();
10-
Wire.setClock(100000); // Try slower 100kHz
11-
11+
Wire.setClock(100000); // Try slower 100kHz
12+
1213
Serial.println("AS7331 I2C Diagnostic");
1314
Serial.println("=====================");
14-
15+
1516
// Scan for device
1617
Wire.beginTransmission(AS7331_ADDR);
1718
if (Wire.endTransmission() == 0) {
1819
Serial.print("Device found at 0x");
1920
Serial.println(AS7331_ADDR, HEX);
2021
} else {
2122
Serial.println("Device NOT found!");
22-
while(1);
23+
while (1)
24+
;
2325
}
24-
26+
2527
// Try to read first 16 registers
2628
Serial.println("\nReading registers 0x00-0x0F:");
2729
for (uint8_t reg = 0; reg <= 0x0F; reg++) {
2830
Wire.beginTransmission(AS7331_ADDR);
2931
Wire.write(reg);
30-
uint8_t err = Wire.endTransmission(false); // Keep bus active
31-
32+
uint8_t err = Wire.endTransmission(false); // Keep bus active
33+
3234
if (err != 0) {
3335
Serial.print("0x");
3436
Serial.print(reg, HEX);
@@ -37,23 +39,23 @@ void setup() {
3739
Serial.println(")");
3840
continue;
3941
}
40-
42+
4143
Wire.requestFrom(AS7331_ADDR, (uint8_t)1);
4244
if (Wire.available()) {
4345
uint8_t val = Wire.read();
4446
Serial.print("0x");
45-
if (reg < 0x10) Serial.print("0");
47+
if (reg < 0x10)
48+
Serial.print("0");
4649
Serial.print(reg, HEX);
4750
Serial.print(" = 0x");
48-
if (val < 0x10) Serial.print("0");
51+
if (val < 0x10)
52+
Serial.print("0");
4953
Serial.println(val, HEX);
5054
}
5155
delay(5);
5256
}
53-
57+
5458
Serial.println("\nDone.");
5559
}
5660

57-
void loop() {
58-
delay(1000);
59-
}
61+
void loop() { delay(1000); }

hw_tests/divider_test/divider_test.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ void setup(void) {
5252

5353
bool all_pass = true;
5454

55-
for (size_t i = 0; i < sizeof(divider_steps) / sizeof(divider_steps[0]); i++) {
55+
for (size_t i = 0; i < sizeof(divider_steps) / sizeof(divider_steps[0]);
56+
i++) {
5657
as7331.powerDown(true);
5758
as7331.enableDivider(true);
5859
as7331.setDivider(divider_steps[i].div);
@@ -79,5 +80,4 @@ void setup(void) {
7980
Serial.println(all_pass ? "Overall: PASS" : "Overall: FAIL");
8081
}
8182

82-
void loop(void) {
83-
}
83+
void loop(void) {}

hw_tests/edge_count_test/edge_count_test.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,4 @@ void setup() {
5959
}
6060
}
6161

62-
void loop() {
63-
delay(1000);
64-
}
62+
void loop() { delay(1000); }

hw_tests/gain_test/gain_test.ino

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ struct GainStep {
1313
};
1414

1515
const GainStep gain_steps[] = {
16-
{AS7331_GAIN_1X, "1"}, {AS7331_GAIN_2X, "2"},
17-
{AS7331_GAIN_4X, "4"}, {AS7331_GAIN_8X, "8"},
18-
{AS7331_GAIN_16X, "16"}, {AS7331_GAIN_32X, "32"},
16+
{AS7331_GAIN_1X, "1"}, {AS7331_GAIN_2X, "2"}, {AS7331_GAIN_4X, "4"},
17+
{AS7331_GAIN_8X, "8"}, {AS7331_GAIN_16X, "16"}, {AS7331_GAIN_32X, "32"},
1918
};
2019

2120
void setup(void) {
@@ -86,5 +85,4 @@ void setup(void) {
8685
Serial.println(all_pass ? "Overall: PASS" : "Overall: FAIL");
8786
}
8887

89-
void loop(void) {
90-
}
88+
void loop(void) {}

0 commit comments

Comments
 (0)