Skip to content

Commit 770d54a

Browse files
committed
fix issue with MAC OS
1 parent 9c85a8e commit 770d54a

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

pkg/motor/bts7960/bts7960._macos.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//go:build darwin
2+
// +build darwin
3+
4+
package bts7960
5+
6+
import (
7+
"context"
8+
9+
"github.com/sirupsen/logrus"
10+
)
11+
12+
// Forward makes the motor work in the forward way.
13+
func (d *bts7960) Forward(ctx context.Context) error {
14+
logrus.Warningln("We are on MAC OS, no action")
15+
16+
// Wait
17+
until, _ := ctx.Deadline()
18+
logrus.Infoln("Wait until", until)
19+
<-ctx.Done()
20+
21+
return nil
22+
}
23+
24+
// Backward makes the motor work in the backward way.
25+
func (d *bts7960) Backward(ctx context.Context) error {
26+
logrus.Warningln("We are on MAC OS, no action")
27+
28+
// Wait
29+
until, _ := ctx.Deadline()
30+
logrus.Infoln("Wait until", until)
31+
<-ctx.Done()
32+
33+
return nil
34+
}
35+
36+
// Stop the motor.
37+
func (d *bts7960) Stop() error {
38+
logrus.Warningln("We are on MAC OS, no action")
39+
40+
return nil
41+
}

pkg/motor/l293d/l293d_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//go:build linux
2+
// +build linux
23

34
package l293d
45

pkg/motor/l293d/l293d_macos.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//go:build darwin
2+
// +build darwin
3+
4+
package l293d
5+
6+
import (
7+
"context"
8+
9+
"github.com/sirupsen/logrus"
10+
)
11+
12+
// Forward makes the motor work in the forward way.
13+
func (motor *l293d) Forward(ctx context.Context) error {
14+
logrus.Warningln("We are on MAC OS, no action")
15+
16+
// Wait
17+
until, _ := ctx.Deadline()
18+
logrus.Infoln("Wait until", until)
19+
<-ctx.Done()
20+
21+
return nil
22+
}
23+
24+
// Backward makes the motor work in the backward way.
25+
func (motor *l293d) Backward(ctx context.Context) error {
26+
logrus.Warningln("We are on MAC OS, no action")
27+
28+
// Wait
29+
until, _ := ctx.Deadline()
30+
logrus.Infoln("Wait until", until)
31+
<-ctx.Done()
32+
33+
return nil
34+
}
35+
36+
// Stop the motor.
37+
func (motor *l293d) Stop() error {
38+
logrus.Warningln("We are on MAC OS, no action")
39+
40+
return nil
41+
}

pkg/motor/l293d/l293d_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//go:build windows
2+
// +build windows
23

34
package l293d
45

0 commit comments

Comments
 (0)