Skip to content

Commit f31a85e

Browse files
authored
Merge pull request adafruit#2 from ladyada-eagleclaw/add-library-ci
Add Arduino library CI
2 parents d73d4c1 + 084901f commit f31a85e

7 files changed

Lines changed: 76 additions & 20 deletions

File tree

.clang-format

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Language: Cpp
2+
BasedOnStyle: Google
3+
IndentWidth: 2
4+
ColumnLimit: 80
5+
AllowShortFunctionsOnASingleLine: Empty
6+
AllowShortIfStatementsOnASingleLine: false
7+
AllowShortLoopsOnASingleLine: false
8+
BinPackArguments: true
9+
BinPackParameters: true
10+
BreakBeforeBraces: Attach
11+
DerivePointerAlignment: false
12+
PointerAlignment: Left
13+
SpacesBeforeTrailingComments: 1

.github/workflows/githubci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Arduino Library CI
2+
3+
on: [pull_request, push, repository_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v4
12+
with:
13+
python-version: '3.x'
14+
- uses: actions/checkout@v4
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: clang
23+
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
24+
25+
- name: test platforms
26+
run: python3 ci/build_platform.py main_platforms
27+
28+
- name: doxy
29+
env:
30+
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
31+
PRETTYNAME : "Adafruit GP8403 Arduino Library"
32+
run: bash ci/doxy_gen_and_deploy.sh

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
hw_tests/results/
2+
3+
# Local agent configuration
4+
AGENTS.md
5+
CLAUDE.md
6+
GEMINI.md
7+
.codex/
8+
.claude/
9+
.gemini/
10+
11+
# Local reference documents
12+
datasheet*.pdf
13+
datasheet*.txt

Adafruit_GP8403.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include "Adafruit_GP8403.h"
18+
1819
#include <Adafruit_BusIO_Register.h>
1920

2021
/**
@@ -45,7 +46,7 @@ Adafruit_GP8403::~Adafruit_GP8403() {
4546
* @param wire I2C interface to use.
4647
* @return true if the probe and all initialization writes succeeded.
4748
*/
48-
bool Adafruit_GP8403::begin(uint8_t address, TwoWire *wire) {
49+
bool Adafruit_GP8403::begin(uint8_t address, TwoWire* wire) {
4950
delete _i2c_dev;
5051
_i2c_dev = new Adafruit_I2CDevice(address, wire);
5152

@@ -102,8 +103,7 @@ bool Adafruit_GP8403::setRaw(uint8_t channel, uint16_t value) {
102103
* @return true if both values were valid and the I2C write succeeded.
103104
*/
104105
bool Adafruit_GP8403::setRawValues(uint16_t channel0, uint16_t channel1) {
105-
if (channel0 > GP8403_MAX_RAW_VALUE ||
106-
channel1 > GP8403_MAX_RAW_VALUE) {
106+
if (channel0 > GP8403_MAX_RAW_VALUE || channel1 > GP8403_MAX_RAW_VALUE) {
107107
return false;
108108
}
109109

@@ -234,8 +234,8 @@ bool Adafruit_GP8403::writeRawValues(uint16_t channel0, uint16_t channel1) {
234234
uint16_t wireChannel0 = channel0 << 4;
235235
uint16_t wireChannel1 = channel1 << 4;
236236
uint32_t wireValues = ((uint32_t)wireChannel1 << 16) | wireChannel0;
237-
Adafruit_BusIO_Register channelRegister(
238-
_i2c_dev, GP8403_COMMAND_CHANNEL_0, 4, LSBFIRST);
237+
Adafruit_BusIO_Register channelRegister(_i2c_dev, GP8403_COMMAND_CHANNEL_0, 4,
238+
LSBFIRST);
239239
if (!channelRegister.write(wireValues)) {
240240
return false;
241241
}
@@ -252,7 +252,7 @@ bool Adafruit_GP8403::writeRawValues(uint16_t channel0, uint16_t channel1) {
252252
* @param value Destination for the converted value.
253253
* @return true if the voltage is finite and within the selected range.
254254
*/
255-
bool Adafruit_GP8403::voltageToRaw(float volts, uint16_t &value) {
255+
bool Adafruit_GP8403::voltageToRaw(float volts, uint16_t& value) {
256256
float fullScale = fullScaleVoltage();
257257
if (!isfinite(volts) || volts < 0.0 || volts > fullScale) {
258258
return false;
@@ -279,7 +279,7 @@ namespace {
279279
constexpr uint8_t GP8403_NVM_HALF_PERIOD_US = 5;
280280

281281
class GP8403NVMWriter {
282-
public:
282+
public:
283283
GP8403NVMWriter(uint16_t sdaPin, uint16_t sclPin) {
284284
_sdaPin = sdaPin;
285285
_sclPin = sclPin;
@@ -346,8 +346,8 @@ class GP8403NVMWriter {
346346
delayMicroseconds(GP8403_NVM_HALF_PERIOD_US);
347347
release(_sclPin);
348348
delayMicroseconds(GP8403_NVM_HALF_PERIOD_US);
349-
bool acknowledged = digitalRead(_sclPin) == HIGH &&
350-
digitalRead(_sdaPin) == LOW;
349+
bool acknowledged =
350+
digitalRead(_sclPin) == HIGH && digitalRead(_sdaPin) == LOW;
351351
driveLow(_sclPin);
352352
delayMicroseconds(GP8403_NVM_HALF_PERIOD_US);
353353
return clocksHigh && acknowledged;
@@ -363,7 +363,7 @@ class GP8403NVMWriter {
363363
return stop() && waveformOK;
364364
}
365365

366-
private:
366+
private:
367367
static void driveLow(uint16_t pin) {
368368
digitalWrite(pin, LOW);
369369
pinMode(pin, OUTPUT);
@@ -449,8 +449,8 @@ bool Adafruit_GP8403::saveToNVM(uint16_t sdaPin, uint16_t sclPin) {
449449
exitStopOK = writer.stop();
450450
}
451451
}
452-
bool exited = exitPreambleOK && exitStartOK && exitCommandACK && exitDataACK &&
453-
exitStopOK;
452+
bool exited = exitPreambleOK && exitStartOK && exitCommandACK &&
453+
exitDataACK && exitStopOK;
454454
writer.releaseBus();
455455
return entered && dataWaveformOK && exited;
456456
}

Adafruit_GP8403.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ enum gp8403_output_range_t {
3232

3333
/** @brief Driver for the GP8403 dual-channel 12-bit DAC. */
3434
class Adafruit_GP8403 {
35-
public:
35+
public:
3636
Adafruit_GP8403();
3737
~Adafruit_GP8403();
3838

39-
bool begin(uint8_t address = GP8403_DEFAULT_ADDRESS,
40-
TwoWire *wire = &Wire);
39+
bool begin(uint8_t address = GP8403_DEFAULT_ADDRESS, TwoWire* wire = &Wire);
4140

4241
bool setOutputRange(gp8403_output_range_t range);
4342
gp8403_output_range_t getOutputRange();
@@ -52,14 +51,14 @@ class Adafruit_GP8403 {
5251

5352
bool saveToNVM(uint16_t sdaPin, uint16_t sclPin);
5453

55-
private:
54+
private:
5655
bool writeOutputRange(gp8403_output_range_t range);
5756
bool writeRaw(uint8_t channel, uint16_t value);
5857
bool writeRawValues(uint16_t channel0, uint16_t channel1);
59-
bool voltageToRaw(float volts, uint16_t &value);
58+
bool voltageToRaw(float volts, uint16_t& value);
6059
float fullScaleVoltage();
6160

62-
Adafruit_I2CDevice *_i2c_dev; ///< BusIO I2C device
61+
Adafruit_I2CDevice* _i2c_dev; ///< BusIO I2C device
6362
gp8403_output_range_t _range; ///< Cached output range
6463
uint16_t _raw[2]; ///< Cached channel DAC values
6564
};

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MIT License
1+
The MIT License (MIT)
22

33
Copyright (c) 2026 Adafruit Industries
44

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=Adafruit GP8403 Library
1+
name=Adafruit GP8403
22
version=1.0.0
33
author=Adafruit
44
maintainer=Adafruit <info@adafruit.com>

0 commit comments

Comments
 (0)