Compare commits

...

9 commits

Author SHA1 Message Date
James Harton 4f8d3b16fa
chore: release version v2.0.1
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-23 20:25:43 +13:00
James Harton db448c5061
chore: Add ex_check. 2024-02-23 20:25:25 +13:00
James Harton 0dcd843906
docs: Update README and package links. 2024-02-23 20:25:03 +13:00
Renovate Bot 1661c30de5 chore: Configure Renovate (#27)
All checks were successful
continuous-integration/drone/push Build is passing
Welcome to [Renovate](https://github.com/renovatebot/renovate)! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.

---
### Detected Package Files

 * `.tool-versions` (asdf)
 * `.drone.yml` (droneci)
 * `mix.exs` (mix)

### Configuration Summary

Based on the default config's presets, Renovate will:

  - Start dependency updates only once this onboarding PR is merged
  - Enable Renovate Dependency Dashboard creation.
  - Use semantic commit type `fix` for dependencies and `chore` for all others if semantic commits are in use.
  - Ignore `node_modules`, `bower_components`, `vendor` and various test/tests directories.
  - Group known monorepo packages together.
  - Use curated list of recommended non-monorepo package groupings.
  - Apply crowd-sourced package replacement rules.
  - Apply crowd-sourced workarounds for known problems with packages.
  - Use semantic prefixes for commit messages and PR titles.
  - Use `chore` as semantic commit type for commit messages and PR titles.
  - Removes rate limit for PR creation per hour.
  - Remove limit for open PRs at any time.
  - Automerge all upgrades (including `major`) if they pass tests.
  - Assign PRs to `james`.
  - Rebase existing PRs any time the base branch has been updated.
  - Raise PR when vulnerability alerts are detected.
  - Disable Renovate Dependency Dashboard creation.

🔡 Do you want to change how Renovate upgrades your dependencies? Add your custom config to `renovate.json` in this branch. Renovate will update the Pull Request description the next time it runs.

---

### What to Expect

With your current configuration, Renovate will create 2 Pull Requests:

<details>
<summary>chore(deps): update dependency ex_doc to ~> 0.31</summary>

  - Schedule: ["at any time"]
  - Branch name: `renovate/ex_doc-0.x`
  - Merge into: `main`
  - Upgrade ex_doc to `~> 0.31`

</details>

<details>
<summary>chore(deps): update dependency circuits_gpio to v2</summary>

  - Schedule: ["at any time"]
  - Branch name: `renovate/circuits_gpio-2.x`
  - Merge into: `main`
  - Upgrade circuits_gpio to `~> 2.0`

</details>

---

 Got questions? Check out Renovate's [Docs](https://docs.renovatebot.com/), particularly the Getting Started section.
If you need any further assistance then you can also [request help here](https://github.com/renovatebot/renovate/discussions).

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

<!--renovate-config-hash:758a0db051676a629cb8daada3244b6287c728a47d095002c4ae62062eae6bf3-->

Reviewed-on: #27
Co-authored-by: Renovate Bot <bot@harton.nz>
Co-committed-by: Renovate Bot <bot@harton.nz>
2024-02-14 17:42:05 +13:00
James Harton b8624141f2 chore: migrate to local (#26)
All checks were successful
continuous-integration/drone/push Build is passing
* Add Drone CI configuration
* Change URLs
* Remove Gitlab CI configuration

Reviewed-on: #26
Co-authored-by: James Harton <james@harton.nz>
Co-committed-by: James Harton <james@harton.nz>
2024-02-14 16:15:59 +13:00
James Harton 64c1b12cd2
chore(deps): Update wafer, circuits_i2c and elixir_make in lockstep. 2023-08-23 09:38:01 +12:00
James Harton 4959637eba chore(deps): update dependency circuits_i2c to v2 2023-08-22 23:28:55 +12:00
James Harton 0135740dce chore(deps): update dependency ex_doc to ~> 0.30 2023-07-07 23:12:45 +12:00
James Harton a8db503604 chore(deps): update dependency wafer to v1 2023-01-17 11:58:02 +13:00
11 changed files with 521 additions and 199 deletions

383
.drone.yml Normal file
View file

@ -0,0 +1,383 @@
kind: pipeline
type: docker
name: build
steps:
- name: restore ASDF cache
image: meltwater/drone-cache
pull: "always"
environment:
AWS_ACCESS_KEY_ID:
from_secret: ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: SECRET_ACCESS_KEY
AWS_PLUGIN_PATH_STYLE: true
settings:
restore: true
endpoint:
from_secret: S3_ENDPOINT
bucket:
from_secret: CACHE_BUCKET
region: us-east-1
path-style: true
cache_key: 'asdf-{{ os }}-{{ arch }}-{{ checksum ".tool-versions" }}'
mount:
- .asdf
- name: restore build cache
image: meltwater/drone-cache
environment:
AWS_ACCESS_KEY_ID:
from_secret: ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: SECRET_ACCESS_KEY
AWS_PLUGIN_PATH_STYLE: true
settings:
restore: true
endpoint:
from_secret: S3_ENDPOINT
bucket:
from_secret: CACHE_BUCKET
region: us-east-1
path-style: true
cache_key: 'elixir-{{ checksum "mix.lock" }}-{{ checksum ".tool-versions" }}'
mount:
- deps
- _build
- .hex
- .mix
- .rebar3
- name: install dependencies
image: harton.dev/james/asdf_container:latest
pull: "always"
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
ASDF_DIR: /root/.asdf
depends_on:
- restore ASDF cache
- restore build cache
commands:
- asdf_install
- rm -rf .asdf/downloads
- . $ASDF_DIR/asdf.sh
- mix local.hex --if-missing --force
- mix local.rebar --if-missing --force
- mix deps.get
- mix deps.compile
- mix dialyzer --plt
- name: store ASDF cache
image: meltwater/drone-cache
environment:
AWS_ACCESS_KEY_ID:
from_secret: ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: SECRET_ACCESS_KEY
AWS_PLUGIN_PATH_STYLE: true
depends_on:
- install dependencies
settings:
rebuild: true
override: false
endpoint:
from_secret: S3_ENDPOINT
bucket:
from_secret: CACHE_BUCKET
region: us-east-1
path-style: true
cache_key: 'asdf-{{ os }}-{{ arch }}-{{ checksum ".tool-versions" }}'
mount:
- .asdf
- name: store build cache
image: meltwater/drone-cache
environment:
AWS_ACCESS_KEY_ID:
from_secret: ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: SECRET_ACCESS_KEY
AWS_PLUGIN_PATH_STYLE: true
depends_on:
- install dependencies
settings:
rebuild: true
override: false
endpoint:
from_secret: S3_ENDPOINT
bucket:
from_secret: CACHE_BUCKET
region: us-east-1
path-style: true
cache_key: 'elixir-{{ checksum "mix.lock" }}-{{ checksum ".tool-versions" }}'
mount:
- deps
- _build
- .hex
- .mix
- .rebar3
- name: mix compile
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- install dependencies
commands:
- asdf mix compile --warnings-as-errors
- name: mix test
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix test
- name: mix credo
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix credo --strict
- name: mix dialyzer
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix dialyzer
- name: mix hex.audit
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix hex.audit
- name: mix format
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix format --check-formatted
- name: mix deps.unlock
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix deps.unlock --check-unused
- name: mix doctor
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- asdf mix doctor --full
- name: mix git_ops.check_message
image: harton.dev/james/asdf_container:latest
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
depends_on:
- mix compile
commands:
- git log -1 --format=%s > .last_commit_message
- asdf mix git_ops.check_message .last_commit_message
- name: mix git_ops.release
image: harton.dev/james/asdf_container:latest
when:
branch:
- main
event:
exclude:
- pull_request
depends_on:
- mix test
- mix credo
- mix dialyzer
- mix hex.audit
- mix format
- mix deps.unlock
- mix doctor
- mix git_ops.check_message
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
ASDF_DIR: /root/.asdf
DRONE_TOKEN:
from_secret: DRONE_TOKEN
commands:
- git fetch --tags
- . $ASDF_DIR/asdf.sh
- mix git_ops.project_info --format=shell > before.env
- mix git_ops.release --yes --no-major || true
- mix git_ops.project_info --format=shell > after.env
- . ./before.env
- export OLD_APP_VERSION=$${APP_VERSION}
- . ./after.env
- export NEW_APP_VERSION=$${APP_VERSION}
- if [ "v$${OLD_APP_VERSION}" != "v$${NEW_APP_VERSION}" ]; then
- export GIT_URL=$(echo $DRONE_GIT_HTTP_URL | sed -e "s/:\\/\\//:\\/\\/$DRONE_REPO_OWNER:$DRONE_TOKEN@/")
- git push $${GIT_URL} "HEAD:${DRONE_COMMIT_REF}" "refs/tags/v$${NEW_APP_VERSION}"
- fi
- name: build artifacts
image: harton.dev/james/asdf_container:latest
when:
event:
- tag
refs:
include:
- refs/tags/v*
depends_on:
- mix test
- mix credo
- mix dialyzer
- mix hex.audit
- mix format
- mix deps.unlock
- mix doctor
- mix git_ops.check_message
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
ASDF_DIR: /root/.asdf
commands:
- . $ASDF_DIR/asdf.sh
- mix git_ops.project_info --format=shell > app.env
- . ./app.env
- mkdir artifacts
- mix hex.build -o "artifacts/$${APP_NAME}-$${APP_VERSION}-pkg.tar"
- gzip "artifacts/$${APP_NAME}-$${APP_VERSION}-pkg.tar"
- mix docs
- tar zcvf "artifacts/$${APP_NAME}-$${APP_VERSION}-docs.tar.gz" doc/
- git tag -l --format='%(contents:subject)' v$${APP_VERSION} > tag_subject
- git tag -l --format='%(contents:body)' v$${APP_VERSION} > tag_body
- name: gitea release
image: plugins/gitea-release
when:
event:
- tag
refs:
include:
- refs/tags/v*
depends_on:
- build artifacts
settings:
api_key:
from_secret: DRONE_TOKEN
base_url: https://harton.dev
files: artifacts/*.tar.gz
checksum: sha256
title: tag_subject
note: tag_body
- name: docs release
when:
event:
- tag
refs:
include:
- refs/tags/v*
image: minio/mc
environment:
S3_ENDPOINT:
from_secret: S3_ENDPOINT
ACCESS_KEY:
from_secret: ACCESS_KEY_ID
SECRET_KEY:
from_secret: SECRET_ACCESS_KEY
depends_on:
- build artifacts
commands:
- mc alias set store $${S3_ENDPOINT} $${ACCESS_KEY} $${SECRET_KEY}
- mc mb -p store/docs.harton.nz
- mc anonymous set download store/docs.harton.nz
- mc mirror --overwrite doc/ store/docs.harton.nz/$${DRONE_REPO}/$${DRONE_TAG}
- mc mirror --overwrite doc/ store/docs.harton.nz/$${DRONE_REPO}
- name: hex release
image: harton.dev/james/asdf_container:latest
when:
event:
- tag
refs:
include:
- refs/tags/v*
depends_on:
- build artifacts
environment:
MIX_ENV: test
HEX_HOME: /drone/src/.hex
MIX_HOME: /drone/src/.mix
REBAR_BASE_DIR: /drone/src/.rebar3
ASDF_DATA_DIR: /drone/src/.asdf
ASDF_DIR: /root/.asdf
HEX_API_KEY:
from_secret: HEX_API_KEY
commands:
- . $ASDF_DIR/asdf.sh
- mix hex.publish --yes

View file

@ -1,139 +0,0 @@
stages:
- build
- test
- release
variables:
MIX_ENV: "test"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/"
HEX_HOME: "$CI_PROJECT_DIR/.hex"
MIX_HOME: "$CI_PROJECT_DIR/.mix"
build:
image: elixir:latest
stage: build
cache:
key: "$CI_JOB_NAME"
paths:
- deps
- _build
- .hex
- .mix
script:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- mix deps.compile
- mix git_ops.project_info -f dotenv > project_info.env
artifacts:
paths:
- _build/
- deps/
- .hex
- .mix
reports:
dotenv: project_info.env
test:
image: elixir:latest
dependencies:
- build
stage: test
script:
- mix test
credo:
image: elixir:latest
dependencies:
- build
stage: test
script:
- mix credo
audit:
image: elixir:latest
dependencies:
- build
stage: test
script:
- mix hex.audit
format:
image: elixir:latest
dependencies:
- build
stage: test
script:
- mix format --check-formatted
pages:
image: elixir:latest
dependencies:
- build
stage: release
script:
- mix docs -o public
artifacts:
paths:
- public
only:
- main
git_ops:
image: elixir:latest
dependencies:
- build
stage: release
only:
refs:
- main
except:
variables:
- $CI_COMMIT_MESSAGE =~ /chore\:\ release version/
script:
- |
export OLD_APP_VERSION=$APP_VERSION
mkdir -p artifacts
git config --global user.name "Gitlab Runner for ${GITLAB_USER_NAME}"
git config --global user.email "${GITLAB_USER_EMAIL}"
mix git_ops.release --yes || true
mix git_ops.project_info -f shell > artifacts/env
source artifacts/env
if [ "v${OLD_APP_VERSION}" != "v${APP_VERSION}" ]; then
mix hex.build -o "artifacts/${APP_NAME}-${APP_VERSION}.tar"
gzip "artifacts/${APP_NAME}-${APP_VERSION}.tar"
mix docs && tar zcvf "artifacts/${APP_NAME}-${APP_VERSION}-docs.tar.gz" doc/
curl --header "JOB_TOKEN: ${CI_JOB_TOKEN}" --upload-file "artifacts/${APP_NAME}-${APP_VERSION}.tar.gz" "${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}.tar.gz"
curl --header "JOB_TOKEN: ${CI_JOB_TOKEN}" --upload-file "artifacts/${APP_NAME}-${APP_VERSION}-docs.tar.gz" "${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}-docs.tar.gz"
git push "https://project_${CI_PROJECT_ID}_bot:${RELEASE_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git" "HEAD:${CI_COMMIT_REF_NAME}" "refs/tags/v${APP_VERSION}"
fi
artifacts:
paths:
- artifacts/*
release-gitlab:
image: registry.gitlab.com/gitlab-org/release-cli:latest
dependencies:
- build
stage: release
only:
- tags
- /^v\d+\.\d+\.\d+(-\w+)?$/
script:
- release-cli create \
--name "Release ${APP_NAME} ${APP_VERSION}" \
--description "./CHANGELOG.md" \
--tag-name "v${APP_VERSION}" \
--assets-link "{\"name\":\"${APP_NAME}-${APP_VERSION}.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}.tar.gz\"}" \
--assets-link "{\"name\":\"${APP_NAME}-${APP_VERSION}-docs.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}-docs.tar.gz\"}"
release-hex:
image: elixir:latest
dependencies:
- build
stage: release
only:
- tags
- /^v\d+\.\d+\.\d+(-\w+)?$/
script:
- mix hex.publish --yes

2
.tool-versions Normal file
View file

@ -0,0 +1,2 @@
erlang 26.2.2
elixir 1.16.1

View file

@ -5,14 +5,15 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v2.0.0](https://gitlab.com/jimsy/pca9641/compare/v1.0.0...v2.0.0) (2023-01-16)
## [v2.0.1](https://harton.dev/james/pca9641/compare/v2.0.0...v2.0.1) (2024-02-23)
## [v2.0.0](https://harton.dev/james/pca9641/compare/v1.0.0...v2.0.0) (2023-01-16)
### Breaking Changes:
* Relicence to HL3-FULL.
## [v1.0.0](https://gitlab.com/jimsy/pca9641/compare/v1.0.0...v1.0.0) (2020-12-28)
- Relicence to HL3-FULL.
## [v1.0.0](https://harton.dev/james/pca9641/compare/v1.0.0...v1.0.0) (2020-12-28)

View file

@ -1,6 +1,6 @@
# PCA9641
[![pipeline status](https://gitlab.com/jimsy/pca9641/badges/main/pipeline.svg)](https://gitlab.com/jimsy/pca9641/commits/main)
[![Build Status](https://drone.harton.dev/api/badges/james/pca9641/status.svg)](https://drone.harton.dev/james/pca9641)
[![Hex.pm](https://img.shields.io/hexpm/v/pca9641.svg)](https://hex.pm/packages/pca9641)
[![Hippocratic License HL3-FULL](https://img.shields.io/static/v1?label=Hippocratic%20License&message=HL3-FULL&labelColor=5e2751&color=bc8c3d)](https://firstdonoharm.dev/version/3/0/full.html)
@ -8,25 +8,31 @@ Driver for the PCA9641 2-channel I2C bus master arbiter chip.
It's a pretty sweet little chip that lets you connect two i2c mastering devices
to a shared downstream bus and makes sure that only one master can address the
downstream devices at a time. It can also relay downstream interrupts to the
downstream devices at a time. It can also relay downstream interrupts to the
mastering devices.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `pca9641` to your list of dependencies in `mix.exs`:
`pca9641` is [available in Hex](https://hex.pm/packages/pca9641), the package
can be installed by adding `pca9641` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:pca9641, "~> 2.0.0"}
{:pca9641, "~> 2.0.1"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/pca9641](https://hexdocs.pm/pca9641).
Documentation for the latest release can be found on
[HexDocs](https://hexdocs.pm/pca9641) and for the `main` branch on
[docs.harton.nz](https://docs.harton.nz/james/pca9641).
## Github Mirror
This repository is mirrored [on Github](https://github.com/jimsynz/pca9641)
from it's primary location [on my Forejo instance](https://harton.dev/james/pca9641).
Feel free to raise issues and open PRs on Github.
## License
@ -35,7 +41,7 @@ This software is licensed under the terms of the
this package for the terms.
This license actively proscribes this software being used by and for some
industries, countries and activities. If your usage of this software doesn't
industries, countries and activities. If your usage of this software doesn't
comply with the terms of this license, then [contact me](mailto:james@harton.nz)
with the details of your use-case to organise the purchase of a license - the
cost of which may include a donation to a suitable charity or NGO.

View file

@ -3,7 +3,7 @@ import Config
config :git_ops,
mix_project: Mix.Project.get!(),
changelog_file: "CHANGELOG.md",
repository_url: "https://gitlab.com/jimsy/pca9641",
repository_url: "https://harton.dev/james/pca9641",
manage_mix_version?: true,
manage_readme_version: "README.md",
version_tag_prefix: "v"

View file

@ -163,8 +163,13 @@ defmodule PCA9641 do
masters request the downstream bus at the same time.
"""
@spec priority(t, boolean) :: {:ok, t} | {:error, reason :: any}
def priority(%PCA9641{conn: conn} = dev, value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 7, value)),
def priority(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 7)),
do: {:ok, %{dev | conn: conn}}
end
def priority(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 7)),
do: {:ok, %{dev | conn: conn}}
end
@ -197,8 +202,13 @@ defmodule PCA9641 do
disconnected upon detecting an SMBus time-out condition.
"""
@spec downstream_disconnect_on_timeout(t, boolean) :: {:ok, t} | {:error, term}
def downstream_disconnect_on_timeout(%PCA9641{conn: conn} = dev, value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 6, value)),
def downstream_disconnect_on_timeout(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 6)),
do: {:ok, %{dev | conn: conn}}
end
def downstream_disconnect_on_timeout(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 6)),
do: {:ok, %{dev | conn: conn}}
end
@ -237,8 +247,13 @@ defmodule PCA9641 do
ms, the connection between master and downstream bus will be disconnected.
"""
@spec idle_timer_disconnect(t, boolean) :: {:ok, t} | {:error, term}
def idle_timer_disconnect(%{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 5, value)),
def idle_timer_disconnect(%{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 5)),
do: {:ok, %{dev | conn: conn}}
end
def idle_timer_disconnect(%{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 5)),
do: {:ok, %{dev | conn: conn}}
end
@ -271,8 +286,13 @@ defmodule PCA9641 do
general call soft reset from master.
"""
@spec smbus_software_reset(t, boolean) :: {:ok, t} | {:error, term}
def smbus_software_reset(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 4, value)),
def smbus_software_reset(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 4)),
do: {:ok, %{dev | conn: conn}}
end
def smbus_software_reset(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 4)),
do: {:ok, %{dev | conn: conn}}
end
@ -311,8 +331,13 @@ defmodule PCA9641 do
bus.
"""
@spec bus_init(t, boolean) :: {:ok, t} | {:error, term}
def bus_init(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 3, value)),
def bus_init(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 3)),
do: {:ok, %{dev | conn: conn}}
end
def bus_init(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 3)),
do: {:ok, %{dev | conn: conn}}
end
@ -343,8 +368,13 @@ defmodule PCA9641 do
- `true` -> Connect downstream bus; the internal switch is closed only if LOCK_GRANT = 1.
"""
@spec bus_connect(t, boolean) :: {:ok, t} | {:error, term}
def bus_connect(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 2, value)),
def bus_connect(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 2)),
do: {:ok, %{dev | conn: conn}}
end
def bus_connect(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 2)),
do: {:ok, %{dev | conn: conn}}
end
@ -402,8 +432,13 @@ defmodule PCA9641 do
- `true` -> Master is requesting a lock on the downstream bus.
"""
@spec lock_request(t, boolean) :: {:ok, t} | {:error, term}
def lock_request(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 0, value)),
def lock_request(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_control(conn, &set_bit(&1, 0)),
do: {:ok, %{dev | conn: conn}}
end
def lock_request(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_control(conn, &clear_bit(&1, 0)),
do: {:ok, %{dev | conn: conn}}
end
@ -446,8 +481,13 @@ defmodule PCA9641 do
When written, PCA9641 drives SDA pin of the downstream bus HIGH.
"""
@spec sda_becomes_io(t, boolean) :: {:ok, t} | {:error, term}
def sda_becomes_io(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_status(conn, &set_bit(&1, 7, value)),
def sda_becomes_io(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_status(conn, &set_bit(&1, 7)),
do: {:ok, %{dev | conn: conn}}
end
def sda_becomes_io(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_status(conn, &clear_bit(&1, 7)),
do: {:ok, %{dev | conn: conn}}
end
@ -490,8 +530,13 @@ defmodule PCA9641 do
written, PCA9641 drives SCL pin of the downstream bus HIGH.
"""
@spec scl_becomes_io(t, boolean) :: {:ok, t} | {:error, term}
def scl_becomes_io(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_status(conn, &set_bit(&1, 6, value)),
def scl_becomes_io(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_status(conn, &set_bit(&1, 6)),
do: {:ok, %{dev | conn: conn}}
end
def scl_becomes_io(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_status(conn, &clear_bit(&1, 6)),
do: {:ok, %{dev | conn: conn}}
end
@ -530,8 +575,13 @@ defmodule PCA9641 do
Routine to handle housekeeping tasks.
"""
@spec test_interrupt_pin(t, boolean) :: {:ok, t} | {:error, term}
def test_interrupt_pin(%PCA9641{conn: conn} = dev, value) when is_boolean(value) do
with {:ok, conn} <- Registers.update_status(conn, &set_bit(&1, 5, value)),
def test_interrupt_pin(%PCA9641{conn: conn} = dev, true) do
with {:ok, conn} <- Registers.update_status(conn, &set_bit(&1, 5)),
do: {:ok, %{dev | conn: conn}}
end
def test_interrupt_pin(%PCA9641{conn: conn} = dev, false) do
with {:ok, conn} <- Registers.update_status(conn, &clear_bit(&1, 5)),
do: {:ok, %{dev | conn: conn}}
end
@ -827,7 +877,7 @@ defmodule PCA9641 do
downstream bus.
- `true` -> Interrupt generated; this master has a lock on the downstream bus.
"""
@spec lock_grant_interrupt?(pid) :: boolean
@spec lock_grant_interrupt?(t) :: boolean
def lock_grant_interrupt?(%PCA9641{conn: conn}) do
with {:ok, data} <- Registers.read_interrupt_status(conn),
true <- get_bool(data, 2),
@ -982,7 +1032,7 @@ defmodule PCA9641 do
@doc """
Write shared mailbox.
"""
@spec write_mailbox(pid, mailbox_data) :: :ok | {:error, term}
@spec write_mailbox(t, mailbox_data) :: {:ok, t} | {:error, term}
def write_mailbox(%PCA9641{conn: conn} = dev, <<msb, lsb>>) do
with {:ok, conn} <- Registers.write_mailbox_lsb(conn, <<lsb>>),
{:ok, conn} <- Registers.write_mailbox_msb(conn, <<msb>>),

24
mix.exs
View file

@ -1,7 +1,7 @@
defmodule PCA9641.MixProject do
use Mix.Project
@version "2.0.0"
@version "2.0.1"
def project do
[
@ -11,7 +11,11 @@ defmodule PCA9641.MixProject do
start_permanent: Mix.env() == :prod,
description: "Driver for PCA9641 2-channel I2C bus master arbiter chip",
deps: deps(),
package: package()
package: package(),
docs: [
main: "readme",
extras: ["README.md", "CHANGELOG.md"]
]
]
end
@ -27,7 +31,10 @@ defmodule PCA9641.MixProject do
maintainers: ["James Harton <james@harton.nz>"],
licenses: ["HL3-FULL"],
links: %{
"Source" => "https://gitlab.com/jimsy/pca9641"
"Source" => "https://harton.dev/james/pca9641",
"GitHub" => "https://github.com/jimsynz/pca9641",
"Changelog" => "https://docs.harton.nz/james/pca9641/changelog.html",
"Sponsor" => "https://github.com/sponsors/jimsynz"
}
]
end
@ -36,14 +43,17 @@ defmodule PCA9641.MixProject do
defp deps do
[
{:circuits_gpio, "~> 1.0", optional: true},
{:circuits_i2c, "~> 1.0", optional: true},
{:circuits_i2c, "~> 2.0", optional: true},
{:credo, "~> 1.6", only: ~w[dev test]a, runtime: false},
{:earmark, "~> 1.4", only: ~w[dev test]a},
{:dialyxir, "~> 1.4", only: ~w[dev test]a, runtime: false},
{:doctor, "~> 0.21", only: ~w[dev test]a, runtime: false},
{:earmark, "~> 1.4", only: ~w[dev test]a, runtime: false},
{:elixir_ale, "~> 1.2", optional: true},
{:ex_doc, "~> 0.29", only: ~w[dev test]a},
{:ex_check, "~> 0.15", only: ~w[dev test]a, runtime: false},
{:ex_doc, "~> 0.30", only: ~w[dev test]a, runtime: false},
{:git_ops, "~> 2.4", only: ~w[dev test]a, runtime: false},
{:mimic, "~> 1.5", only: :test},
{:wafer, "~> 0.3"}
{:wafer, "~> 1.0"}
]
end
end

View file

@ -1,21 +1,26 @@
%{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"circuits_gpio": {:hex, :circuits_gpio, "1.0.0", "b2a493b1822ec712bfba7068a016930f6db5e31713b9b84ed8bc307c7c323682", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "da64c1d9ba1329cd7ca7e63adcd68d73e2294d6b48eb66c9a1064f3db5c523f3"},
"circuits_i2c": {:hex, :circuits_i2c, "1.0.0", "0b9c686ff5075f9364209fef62f6b5162eeb41a0061571f52f02637b40ca37fe", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f80efc49235e7819b9ea8e82c7dbd5e2523c65d8e3d4f46f89dfd43217a3f4f7"},
"circuits_gpio": {:hex, :circuits_gpio, "1.1.0", "cda895fd0a12fdf50e27f6d61cc349587dff29755fca640b93233a661925d97a", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "11dab3c7b39cbe08588e9527c9fd98117be485f70b61641874abdda50340e991"},
"circuits_i2c": {:hex, :circuits_i2c, "2.0.0", "8343b12879189f844835abeaf31a36c5626b8ace58413a582794fdfe60c2dc0e", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "06eccd33b36bcedf41730cac8da58e359967ea63a2cd899cea58c2a138634cc4"},
"credo": {:hex, :credo, "1.6.1", "7dc76dcdb764a4316c1596804c48eada9fff44bd4b733a91ccbf0c0f368be61e", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "698607fb5993720c7e93d2d8e76f2175bba024de964e160e2f7151ef3ab82ac5"},
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"},
"doctor": {:hex, :doctor, "0.21.0", "20ef89355c67778e206225fe74913e96141c4d001cb04efdeba1a2a9704f1ab5", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "a227831daa79784eb24cdeedfa403c46a4cb7d0eab0e31232ec654314447e4e0"},
"earmark": {:hex, :earmark, "1.4.19", "3854a17305c880cc46305af15fb1630568d23a709aba21aaa996ced082fc29d7", [:mix], [{:earmark_parser, ">= 1.4.18", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "d5a8c9f9e37159a8fdd3ea8437fb4e229eaf56d5129b9a011dc4780a4872079d"},
"earmark_parser": {:hex, :earmark_parser, "1.4.28", "0bf6546eb7cd6185ae086cbc5d20cd6dbb4b428aad14c02c49f7b554484b4586", [:mix], [], "hexpm", "501cef12286a3231dc80c81352a9453decf9586977f917a96e619293132743fb"},
"earmark_parser": {:hex, :earmark_parser, "1.4.33", "3c3fd9673bb5dcc9edc28dd90f50c87ce506d1f71b70e3de69aa8154bc695d44", [:mix], [], "hexpm", "2d526833729b59b9fdb85785078697c72ac5e5066350663e5be6a1182da61b8f"},
"elixir_ale": {:hex, :elixir_ale, "1.2.1", "07ac2f17a0191b8bd3b0df6b526c7f699a3a4d690c9def573fcb5824eef24d98", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "bfb099137500a3b8c4a1750cf07f2d704897ef9feac3412064bf9edc7d74193c"},
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"},
"ex_doc": {:hex, :ex_doc, "0.29.0", "4a1cb903ce746aceef9c1f9ae8a6c12b742a5461e6959b9d3b24d813ffbea146", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "f096adb8bbca677d35d278223361c7792d496b3fc0d0224c9d4bc2f651af5db1"},
"elixir_make": {:hex, :elixir_make, "0.7.7", "7128c60c2476019ed978210c245badf08b03dbec4f24d05790ef791da11aa17c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5bc19fff950fad52bbe5f211b12db9ec82c6b34a9647da0c2224b8b8464c7e6c"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_check": {:hex, :ex_check, "0.15.0", "074b94c02de11c37bba1ca82ae5cc4926e6ccee862e57a485b6ba60fca2d8dc1", [:mix], [], "hexpm", "33848031a0c7e4209c3b4369ce154019788b5219956220c35ca5474299fb6a0e"},
"ex_doc": {:hex, :ex_doc, "0.30.0", "ed94bf5183f559d2f825e4f866cc0eab277bbb17da76aff40f8e0f149656943e", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "6743fe46704fe27e2f2558faa61f00e5356528768807badb2092d38476d6dac2"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"git_cli": {:hex, :git_cli, "0.3.0", "a5422f9b95c99483385b976f5d43f7e8233283a47cda13533d7c16131cb14df5", [:mix], [], "hexpm", "78cb952f4c86a41f4d3511f1d3ecb28edb268e3a7df278de2faa1bd4672eaf9b"},
"git_ops": {:hex, :git_ops, "2.4.5", "185a724dfde3745edd22f7571d59c47a835cf54ded67e9ccbc951920b7eec4c2", [:mix], [{:git_cli, "~> 0.2", [hex: :git_cli, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e323a5b01ad53bc8c19c3a444be3e61ed7803ecd2e95530446ae9327d0143ecc"},
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"},
"mimic": {:hex, :mimic, "1.5.1", "085f7ebfeb5b579a13a167aec3c712d71fecfc6cb8b298c0dd3056f97ea2c2a0", [:mix], [], "hexpm", "33a50ef9ff38f8f24b2586d52e529981a3ba2b8d061c872084aff0e993bf4bd5"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
"wafer": {:hex, :wafer, "0.3.1", "4c77aadcb5bb5729a86fe9c3cfcb652531a6203c977f59ca1650c0aa2fd165ca", [:mix], [{:circuits_gpio, "~> 1.0", [hex: :circuits_gpio, repo: "hexpm", optional: true]}, {:circuits_i2c, "~> 1.0", [hex: :circuits_i2c, repo: "hexpm", optional: true]}, {:circuits_spi, "~> 1.0", [hex: :circuits_spi, repo: "hexpm", optional: true]}, {:elixir_ale, "~> 1.2", [hex: :elixir_ale, repo: "hexpm", optional: true]}], "hexpm", "a724bab0f421043f646d2da1ad206776e7d13b8bd8ae06f614245a6755cd1823"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
"wafer": {:hex, :wafer, "1.0.2", "4b1f25fe1d9220cb9b060ddd002c0c51f71067a996f2d541b1951457de6c9702", [:mix], [{:circuits_gpio, "~> 1.0", [hex: :circuits_gpio, repo: "hexpm", optional: true]}, {:circuits_i2c, "~> 1.0 or ~> 2.0", [hex: :circuits_i2c, repo: "hexpm", optional: true]}, {:circuits_spi, "~> 1.3", [hex: :circuits_spi, repo: "hexpm", optional: true]}, {:elixir_ale, "~> 1.2", [hex: :elixir_ale, repo: "hexpm", optional: true]}], "hexpm", "58fd27785d66de3703a51b1a13a8de6fac77bfa284f4e2eaec22ecf94ab4bb5a"},
}

View file

@ -1,3 +1,6 @@
{
"extends": ["gitlab>jimsy/renovate"]
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>renovate/renovate"
]
}

View file

@ -1,7 +1,6 @@
defmodule PCA9641Test do
use ExUnit.Case, async: true
use Mimic
use Bitwise
alias PCA9641.Registers, as: Registers
alias Wafer.Driver.Fake, as: Driver
@ -927,11 +926,13 @@ defmodule PCA9641Test do
{:ok, conn}
end)
assert {:ok, conn} = PCA9641.abandon_downstream_bus(conn())
assert {:ok, _conn} = PCA9641.abandon_downstream_bus(conn())
end
end
defp conn do
with {:ok, conn} <- Driver.acquire([]), {:ok, conn} <- PCA9641.acquire(conn: conn), do: conn
with {:ok, conn} <- Driver.acquire([]),
{:ok, conn} <- PCA9641.acquire(conn: conn),
do: conn
end
end