Mcp23017 initialization resets pin values
- Ngôn ngữ chính
- C#
- Star
- 2.4k
- Fork
- 630
- Merge trung bình
- 7 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 3
Mô tả
**Describe the bug**
Every time a new instance of Mcp23017() is being created the pins are being reset to low. This is an issue when the written software reboots, eg when updating the software version.
**Steps to reproduce**
```csharp
var pinNumber = 0;
var i2cConnectionSettings = new I2cConnectionSettings(1, 0x20);
var i2cDevice = I2cDevice.Create(i2cConnectionSettings);
var device = new Mcp23017(i2cDevice);
var controller = new GpioController(PinNumberingScheme.Logical, Mcp23017Device);
controller.Write(pinNumber, PinValue.High);
var device2 = new Mcp23017(i2cDevice);
var pinValue = controller.Read(pinNumber);
```
**Expected behavior**
Pins need to keep their value after re-initializing the Mcp23017() adapter.
**Actual behavior**
Pins are being reset every time a new instance of Mcp23017() is being declared. Looks like it is embedded in the init code here:
https://github.com/dotnet/iot/blob/main/src/devices/Mcp23xxx/Mcp23xxx.cs - starting at line 84.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu trong src/devices/Mcp23xxx/Mcp23xxx.cs, khoảng dòng 84, nơi việc khởi tạo Mcp23017 được thực hiện. Tái hiện chuỗi tạo một adapter, ghi một pin ở mức high và tạo một adapter thứ hai; hoàn tất khi pin giữ nguyên giá trị sau khi khởi tạo lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp
- Lĩnh vực
- embedded-iot
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100