-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08cf33d
commit db4255b
Showing
8 changed files
with
202 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# LibraryBuild.yml | ||
# Github workflow script to test compile all examples of an Arduino library repository. | ||
# | ||
# Copyright (C) 2021 Armin Joachimsmeyer | ||
# https://github.com/ArminJo/Github-Actions | ||
|
||
# This is the name of the workflow, visible on GitHub UI. | ||
name: LibraryBuild | ||
|
||
on: | ||
workflow_dispatch: # To run it manually | ||
push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request | ||
paths: | ||
- '**.ino' | ||
- '**.cpp' | ||
- '**.h' | ||
- '**LibraryBuild.yml' | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.arduino-boards-fqbn }} - test compiling examples | ||
|
||
runs-on: ubuntu-latest # I picked Ubuntu to use shell scripts. | ||
|
||
strategy: | ||
matrix: | ||
# The matrix will produce one job for each configuration parameter of type `arduino-boards-fqbn` | ||
# In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command | ||
# | ||
# Examples: arduino:avr:uno, arduino:avr:leonardo, arduino:avr:nano, arduino:avr:mega | ||
# arduino:sam:arduino_due_x, arduino:samd:arduino_zero_native" | ||
# ATTinyCore:avr:attinyx5:chip=85,clock=1internal, digistump:avr:digispark-tiny, digistump:avr:digispark-pro | ||
# STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 | ||
# esp8266:esp8266:huzzah:eesz=4M3M,xtal=80, esp32:esp32:featheresp32:FlashFreq=80 | ||
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace | ||
############################################################################################################# | ||
arduino-boards-fqbn: | ||
- arduino:avr:uno | ||
- arduino:avr:leonardo | ||
|
||
# Choose the right platform for the boards we want to test. (maybe in the future Arduino will automatically do this for you) | ||
# With sketches-exclude you may exclude specific examples for a board. Use a comma separated list. | ||
############################################################################################################# | ||
# Do not cancel all jobs / architectures if one job fails | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Compile all examples | ||
uses: ArminJo/arduino-test-compile@master | ||
with: | ||
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }} | ||
platform-url: ${{ matrix.platform-url }} | ||
build-properties: ${{ toJson(matrix.build-properties) }} | ||
cli-version: 0.33.0 # in order to avoid errors for ATTinyCore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
CHANGELOG for FlexWire | ||
|
||
V0.0.1 (30.1.2023) | ||
V1.0.0 (14.12.2023) | ||
- Fix: Set received bytes to zero in call to requestFrom when I2C | ||
device NAKs on the device address | ||
- Changed DELAY to I2C_DELAY | ||
- Added Atomic Blocks for level changes, provided the AVR | ||
architecture is used | ||
- Added new example: multi_i2c | ||
- Added new method: setPins | ||
- removed the requestFrom call with internal registers (not | ||
documented, but present in the Wire lib) | ||
- Added the possibility to instantiate class without pin arguments; | ||
these have to be set later using setPins | ||
- removed i2c_start_wait | ||
|
||
V0.0.1 (30.11.2023) | ||
- initial commit, merging SlowSoftI2CMaster and SlowSoftMaster | ||
- contains already Wire.h in the library folder | ||
- contains already Wire.h in the library folder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Demonstrate that we can replace Wire and use multiple instances to implement multiple I2C buses. | ||
* We use the Sparkfun library for the HTU21D temp/humidity sensor to demonstrate that | ||
*/ | ||
|
||
#define SHARESCL 0 | ||
#define SWITCHPINS 0 | ||
|
||
#include <FlexWire.h> | ||
#include <SparkFunHTU21D.h> | ||
|
||
#define MAXSENSOR 2 | ||
|
||
// The pins are we are going to use for the I2C buses | ||
uint8_t sdapin[MAXSENSOR] = { 2, 4 }; | ||
#if SHARESCL | ||
const uint8_t sclpin = 3; | ||
#else | ||
uint8_t sclpin[MAXSENSOR] = { 3, 5 }; | ||
#endif | ||
|
||
#if SWITCHPINS | ||
FlexWire Wire; | ||
HTU21D htu; | ||
#else | ||
// Array of Flexwire instances | ||
#if SHARESCL | ||
FlexWire wire[MAXSENSOR] = { {sdapin[0], sclpin}, {sdapin[1], sclpin} }; | ||
#else | ||
FlexWire wire[MAXSENSOR] = { {sdapin[0], sclpin[0]}, {sdapin[1], sclpin[1]} }; | ||
#endif | ||
// Create array of instances of the HTU21D class | ||
HTU21D htu[MAXSENSOR]; | ||
#endif | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println(F("Multi-I2C example with HTU21D")); | ||
#if SWITCHPINS | ||
for (uint8_t i=0; i < MAXSENSOR; i++) { | ||
Wire.setPins(sdapin[i], sclpin); | ||
htu.begin(); | ||
} | ||
#else | ||
for (uint8_t i=0; i < MAXSENSOR; i++) htu[i].begin(wire[i]); | ||
#endif | ||
} | ||
|
||
void loop() | ||
{ | ||
for (uint8_t i=0; i < MAXSENSOR; i++) { | ||
Serial.print(F("Sensor ")); | ||
Serial.print(i+1); | ||
Serial.print(F(": ")); | ||
#if SWITCHPINS | ||
Wire.setPins(sdapin[i], sclpin); | ||
Serial.print(htu.readTemperature(), 1); | ||
#else | ||
Serial.print(htu[i].readTemperature(), 1); | ||
#endif | ||
Serial.println("C"); | ||
} | ||
Serial.println(); | ||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name=FlexWire | ||
version=0.0.1 | ||
version=1.0.0 | ||
author=Bernhard Nebel | ||
maintainer=Bernhard Nebel <[email protected]> | ||
sentence=This library implements the master side of the I2C protocol. | ||
paragraph=It can be used a drop-in replacement for the Wire library without even touching the sensor/actuator library, which uses Wire | ||
sentence=This library implements the master side of the I2C protocol in a platform independent way. | ||
paragraph=It can be used a drop-in replacement for the Wire library without even touching the sensor/actuator library, which uses the Wire library. The reason is that the library folder contains the header file Wire.h, which satisfies the dependency for the Wire library. In addition, it supports dynamic changes of the I2C pins. | ||
category=Communication | ||
url=https://github.com/felias-fogg/FlexWire | ||
architectures=* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.