Skip to content

Conversation

@Frederikwag
Copy link
Contributor

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

…file and test_main.ino.

Signed-off-by: Frederikwag <frederik.wagner@infineon.com>
Signed-off-by: Frederikwag <frederik.wagner@infineon.com>
Signed-off-by: Frederikwag <frederik.wagner@infineon.com>
Copy link

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

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.
Signed-off-by: Frederikwag <frederik.wagner@infineon.com>
Signed-off-by: Frederikwag <frederik.wagner@infineon.com>
@Frederikwag Frederikwag requested a review from LinjingZhang June 13, 2025 11:39
@LinjingZhang
Copy link
Collaborator

Duplicates with: #49

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.

3 participants