将指针配置name也设定为可配置

This commit is contained in:
2024-11-21 17:29:32 +08:00
parent a923be10c4
commit 2886009d4d
4 changed files with 6 additions and 4 deletions

View File

@@ -123,12 +123,12 @@ func (d *Device) GetEmpty() int {
return d.status[d.lines.Empty].Get()
}
func New(name string, lines *LineGroup) (*Device, error) {
func New(lines *LineGroup) (*Device, error) {
if !lines.Ok() {
return nil, fmt.Errorf("针脚配置错误")
}
chip, err := gpiocdev.NewChip(name, gpiocdev.AsActiveLow)
chip, err := gpiocdev.NewChip(lines.Name, gpiocdev.AsActiveLow)
if err != nil {
return nil, fmt.Errorf("打开 GPIO 设备失败: %w", err)
}

View File

@@ -1,6 +1,7 @@
package card_device
type LineGroup struct {
Name string
OutOK int
Lower int
Error int