2022-11-27 23:06:09 +08:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
2023-05-20 20:25:21 +08:00
|
|
|
"gobot.io/x/gobot/v2"
|
2022-11-27 23:06:09 +08:00
|
|
|
)
|
|
|
|
|
2022-12-02 00:33:33 +08:00
|
|
|
type mockDigitalPinAccess struct {
|
2022-11-27 23:06:09 +08:00
|
|
|
fs *MockFilesystem
|
|
|
|
}
|
|
|
|
|
|
|
|
type digitalPinMock struct{}
|
|
|
|
|
2022-12-02 00:33:33 +08:00
|
|
|
func (h *mockDigitalPinAccess) isSupported() bool { return true }
|
2022-11-27 23:06:09 +08:00
|
|
|
|
2022-12-02 00:33:33 +08:00
|
|
|
func (h *mockDigitalPinAccess) createPin(chip string, pin int,
|
2022-11-27 23:06:09 +08:00
|
|
|
o ...func(gobot.DigitalPinOptioner) bool) gobot.DigitalPinner {
|
|
|
|
dpm := &digitalPinMock{}
|
|
|
|
return dpm
|
|
|
|
}
|
|
|
|
|
2022-12-02 00:33:33 +08:00
|
|
|
func (h *mockDigitalPinAccess) setFs(fs filesystem) {
|
2022-11-27 23:06:09 +08:00
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *digitalPinMock) ApplyOptions(options ...func(gobot.DigitalPinOptioner) bool) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *digitalPinMock) DirectionBehavior() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write writes the given value to the character device
|
|
|
|
func (d *digitalPinMock) Write(b int) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read reads the given value from character device
|
|
|
|
func (d *digitalPinMock) Read() (n int, err error) {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Export sets the pin as exported with the configured direction
|
|
|
|
func (d *digitalPinMock) Export() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unexport release the pin
|
|
|
|
func (d *digitalPinMock) Unexport() error {
|
|
|
|
return nil
|
|
|
|
}
|