Comments (6)
This makes sense, there is no particular reason why to use Span, so I agree that we should be using ReadOnlySpan for writing as well. I'm marking this up-for-grabs. @arkadiuszwojcik let me know if this is something that you would be interested in fixing.
from iot.
They should also use "buffer" as the term. And single items should be "value". So:
public abstract class I2cDevice : IDisposable
{
protected I2cDevice();
public abstract I2cConnectionSettings ConnectionSettings { get; }
public void Dispose();
public virtual void Dispose(bool disposing);
public abstract void Read(Span<byte> buffer);
public abstract byte ReadByte();
// OLD: public abstract void Write(Span<byte> data);
public abstract void Write(ReadOnlySpan<byte> buffer);
// OLD: public abstract void WriteByte(byte data);
public abstract void WriteByte(byte value);
}
See https://apisof.net/ to find existing patterns. https://apisof.net/catalog/System.IO.Stream.WriteByte(Byte) for an example.
from iot.
I had a related discussion with @joperezr about data/buffer during an earlier PR. He might want to chime in on the thinking around naming.
from iot.
Note that I am not the API review process myself, but what I'm pointing out is based on my experience with that process. Which is hopefully going to get us closer than we would be otherwise. 😆
from iot.
@JeremyKuhne I've sent PR with the fix but did not include any naming changes
We should re-iterate on all of the APIs at one point separately
from iot.
I didn't know that we had an existing pattern for Write where we also called it buffer. What @shaggygi and I discussed in the past, was that it made sense for reading for it to be a buffer since that is where the API will be writing into, but thought that for writing it wasn't really a buffer you fill, but instead just data that you write which is why we had it like that. If we have an existing pattern in the framework, then we should use that instead.
from iot.
Related Issues (20)
- "Error 13 initializing the Gpio driver" with .NET 8 in rootless container HOT 31
- libgpiod v2 support HOT 5
- ILi9341 on Raspberry Pi 4 HOT 6
- Raspberry Pi4 running WIndows 11 - GPIO HOT 8
- Raspberry Pi 3A+ Board Revision 1.1 is not detected/supported during GpioController construction HOT 2
- Jitter on PIN Rising and Falling on GPIO Pin callback HOT 8
- Creating the documentation with the essential knowledge (or links)
- Raspberry Pi 5 -> GPIO Package Can it Support as of Today ???? HOT 9
- Dht11, Dht22, no result in RaspBerry Pi5 HOT 7
- Improve library detection algorithm in LibGpiodDriverFactory HOT 2
- Check alternatives to exposing LibGpiodDriverVersion enum
- GPIOController (PinChangeEventHandler): Assigning a PinChangeEventHandler callback or Controller.OpenPin() causes "Segmentation Error" HOT 20
- If define a PWM Output on , eg GPIO18 (pin12), Does it create a ValueChanged Event if I enable this ? HOT 6
- [Test Issue] GitHub Automation Testing HOT 1
- system.device.gpio is missing NuGet package README file HOT 2
- Add LIS3DSHTR to LIS3DHTR code HOT 4
- logical GPIO HOT 5
- UltralightCardType detect bug HOT 1
- TryReadNdefMessage can trim off terminator TLV (0xFE) causing validation to throw exception HOT 1
- System.Device.* HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iot.