From 79288f837b868957c48befa41f797d7b6d20b7c8 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Fri, 21 Apr 2017 12:55:00 +0200 Subject: [PATCH] sysfs: small reordering to file Signed-off-by: deadprogram --- sysfs/pwm_pin.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sysfs/pwm_pin.go b/sysfs/pwm_pin.go index 376400c3..6c71ee2e 100644 --- a/sysfs/pwm_pin.go +++ b/sysfs/pwm_pin.go @@ -7,11 +7,11 @@ import ( // PWMPin is the interface for sysfs PWM interactions type PWMPin interface { - // Unexport unexports the pin and releases the pin from the operating system - Unexport() error // Export exports the pin for use by the operating system Export() error - // Enable enables the PWM pin + // Unexport unexports the pin and releases the pin from the operating system + Unexport() error + // Enable enables/disables the PWM pin Enable(val string) (err error) // Period returns the current PWM period for pin Period() (period string, err error) @@ -33,6 +33,18 @@ func NewPwmPin(pin int) *pwmPin { return p } +// Export writes pin to pwm export path +func (p *pwmPin) Export() (err error) { + _, err = p.write(pwmExportPath(), []byte(p.pin)) + return +} + +// Unexport writes pin to pwm unexport path +func (p *pwmPin) Unexport() (err error) { + _, err = p.write(pwmUnexportPath(), []byte(p.pin)) + return +} + // Enable writes value to pwm enable path func (p *pwmPin) Enable(val string) (err error) { _, err = p.write(pwmEnablePath(p.pin), []byte(val)) @@ -54,18 +66,6 @@ func (p *pwmPin) WriteDuty(duty string) (err error) { return } -// Export writes pin to pwm export path -func (p *pwmPin) Export() (err error) { - _, err = p.write(pwmExportPath(), []byte(p.pin)) - return -} - -// Unexport writes pin to pwm unexport path -func (p *pwmPin) Unexport() (err error) { - _, err = p.write(pwmUnexportPath(), []byte(p.pin)) - return -} - // pwmPath returns pwm base path func pwmPath() string { return "/sys/class/pwm/pwmchip0"