gobot.io/x/gobot/v2@v2.1.0/system/digitalpin_mock.go (about)

     1  package system
     2  
     3  import (
     4  	"gobot.io/x/gobot/v2"
     5  )
     6  
     7  type mockDigitalPinAccess struct {
     8  	fs *MockFilesystem
     9  }
    10  
    11  type digitalPinMock struct{}
    12  
    13  func (h *mockDigitalPinAccess) isSupported() bool { return true }
    14  
    15  func (h *mockDigitalPinAccess) createPin(chip string, pin int,
    16  	o ...func(gobot.DigitalPinOptioner) bool) gobot.DigitalPinner {
    17  	dpm := &digitalPinMock{}
    18  	return dpm
    19  }
    20  
    21  func (h *mockDigitalPinAccess) setFs(fs filesystem) {
    22  	// do nothing
    23  }
    24  
    25  func (d *digitalPinMock) ApplyOptions(options ...func(gobot.DigitalPinOptioner) bool) error {
    26  	return nil
    27  }
    28  
    29  func (d *digitalPinMock) DirectionBehavior() string {
    30  	return ""
    31  }
    32  
    33  // Write writes the given value to the character device
    34  func (d *digitalPinMock) Write(b int) error {
    35  	return nil
    36  }
    37  
    38  // Read reads the given value from character device
    39  func (d *digitalPinMock) Read() (n int, err error) {
    40  	return 0, err
    41  }
    42  
    43  // Export sets the pin as exported with the configured direction
    44  func (d *digitalPinMock) Export() error {
    45  	return nil
    46  }
    47  
    48  // Unexport release the pin
    49  func (d *digitalPinMock) Unexport() error {
    50  	return nil
    51  }