-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add I2cTransferResult and I2cTransferStatus #11
Add I2cTransferResult and I2cTransferStatus #11
Conversation
Hi @josesimoes, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
11d9e28
to
1b197f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just _buffer which should be a SpanByte
private bool _disposed; | ||
|
||
// speeds up the execution of ReadByte and WriteByte operations | ||
private readonly byte[] _buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now should be SpanByte
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't do...
CS8345 Field or auto-implemented property cannot be of type 'SpanByte' unless it is an instance member of a ref struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum, then it makes less sense to do this. We can tweak SpanByte to be a ref struct (it's technically one on the Span world.
return bufferSingleOperation[0]; | ||
lock (_syncLock) | ||
{ | ||
var buffer = new SpanByte(_buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not needed as _buffer should be a SpanByte directly
{ | ||
var buffer = new SpanByte(_buffer); | ||
|
||
NativeTransmit(null, buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here it's directly _buffer
// copy value | ||
_buffer[0] = value; | ||
|
||
return NativeTransmit(new SpanByte(_buffer), null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, _buffer should now be a SpanByte
_connectionSettings = settings; | ||
|
||
// create the buffer | ||
_buffer = new byte[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok, it's just than _buffer should be a SpanByte, this new allocation won't change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understand why can't be SpanByte for _buffer, then all good like this
Description
Motivation and Context
How Has This Been Tested?
Screenshots
Types of changes
Checklist: