summarylogtreecommitdiffstats
path: root/lib_i2c-gpio-custom-filter.sh
diff options
context:
space:
mode:
authorLeo P2020-01-14 15:44:43 -0500
committerLeo P2020-01-14 15:44:43 -0500
commitce76a12c0df524549800a3881a8118befa4159ad (patch)
treefb9fe4d95a0322e8ed75a25d5f22732dd4361a98 /lib_i2c-gpio-custom-filter.sh
downloadaur-ce76a12c0df524549800a3881a8118befa4159ad.tar.gz
atomic pi utils
Diffstat (limited to 'lib_i2c-gpio-custom-filter.sh')
-rw-r--r--lib_i2c-gpio-custom-filter.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib_i2c-gpio-custom-filter.sh b/lib_i2c-gpio-custom-filter.sh
new file mode 100644
index 000000000000..b8780fb8ab45
--- /dev/null
+++ b/lib_i2c-gpio-custom-filter.sh
@@ -0,0 +1,16 @@
+. /usr/lib/gpio-present.sh
+
+check_gpio_bus_configuration () {
+ ERRORS=0
+ shift;
+ if ! gpio_present $1; then
+ echo "SDA GPIO ($1) not detected" >&2
+ ERRORS="$(($ERRORS+1))"
+ fi
+ shift;
+ if ! gpio_present $1; then
+ echo "SCL GPIO ($1) not detected" >&2
+ ERRORS="$(($ERRORS+1))"
+ fi
+ return "$ERRORS"
+}