Skip to content

Add onewire #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add onewire #38

wants to merge 3 commits into from

Conversation

Frederikwag
Copy link

By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description
Added the OneWire-Test. Therefore, 3 tests are executed:

  1. Is there a device connected?
  2. Does the Master receives the description of the slave?
  3. Does the Master receives the data?

Related Issue

  1. Issue: The OneWire-Library is not working. Therefore, the test was developed with an Arduino Mega 2560
  2. Issue: We cannot set a board as slave. Therefore I used DS18B20 as a slave.

Context

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds tests for the OneWire sensor by introducing new test cases and supporting build targets for verifying device connection, chip description, and data retrieval.

  • Added a preprocessor block in the main test file to run onewire sensor tests.
  • Created a new test file with three test cases for OneWire sensor functionality.
  • Updated the Makefile to include a target for the OneWire sensor tests.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/test_main.ino Added preprocessor condition to run onewire sensor tests.
src/corelibs/onewire/test_onewire_sensor.cpp Added new tests for device presence, chip description, and data retrieval on OneWire bus.
Makefile Introduced a new target for OneWire sensor tests.

Comment on lines +11 to +12
// OneWire instance and variables
static OneWire oneWire(5); // Pin 5 is used for the OneWire bus
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider defining a named constant for the OneWire bus pin instead of using the hard-coded value (5) to enhance code readability and ease future modifications.

Suggested change
// OneWire instance and variables
static OneWire oneWire(5); // Pin 5 is used for the OneWire bus
// Define the pin used for the OneWire bus
constexpr int ONE_WIRE_BUS_PIN = 5;
// OneWire instance and variables
static OneWire oneWire(ONE_WIRE_BUS_PIN); // Use named constant for the OneWire bus pin

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant