Skip to content

Conversation

@Ellerbach
Copy link
Member

@Ellerbach Ellerbach commented Dec 24, 2022

This PR is about adding AM2320

  • migration from .NET nanoFramework (replacing SpanByte by Span<byte), new by stackalloc)
  • adjusting the sample

Origin: https://github.com/nanoframework/nanoFramework.IoT.Device/tree/develop/devices/Am2320

Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Dec 24, 2022
/// <returns>True on success, false if reading failed.</returns>
[Telemetry("Temperature")]
public bool TryReadTemperature(
#if NET5_0_OR_GREATER
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not really necessary here, since Temperature is a value type.

Comment on lines 26 to 28
am2330.TryReadTemperature(out Temperature temp);
am2330.TryReadHumidity(out RelativeHumidity hum);
if (am2330.IsLastReadSuccessful)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to show how to do it right: if (am2330.TryReadTemperature(out Temperature temp) && ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch! You're fully right!

@Ellerbach Ellerbach merged commit 006a2e3 into dotnet:main Jan 19, 2023
@Ellerbach Ellerbach deleted the add-am2320 branch January 19, 2023 16:34
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants