-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
763d165
commit d083ffc
Showing
5 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,41 @@ | ||
//go:build linux | ||
|
||
// Package odroid implements a odroid based board. | ||
package odroid | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"periph.io/x/host/v3" | ||
|
||
"go.viam.com/rdk/components/board" | ||
"go.viam.com/rdk/components/board/genericlinux" | ||
"go.viam.com/rdk/logging" | ||
"go.viam.com/rdk/resource" | ||
) | ||
|
||
const modelName = "odroid" | ||
|
||
func init() { | ||
if _, err := host.Init(); err != nil { | ||
logging.Global().Debugw("error initializing host", "error", err) | ||
} | ||
// Model for viam supported hardkernel odroid board. | ||
var Model = resource.NewModel("viam", "hardkernel", "odroid") | ||
|
||
func init() { | ||
gpioMappings, err := genericlinux.GetGPIOBoardMappings(modelName, boardInfoMappings) | ||
var noBoardErr genericlinux.NoBoardFoundError | ||
if errors.As(err, &noBoardErr) { | ||
logging.Global().Debugw("error getting odroid GPIO board mapping", "error", err) | ||
} | ||
|
||
genericlinux.RegisterBoard(modelName, gpioMappings) | ||
resource.RegisterComponent( | ||
board.API, | ||
Model, | ||
resource.Registration[board.Board, *genericlinux.Config]{ | ||
Constructor: func( | ||
ctx context.Context, | ||
_ resource.Dependencies, | ||
conf resource.Config, | ||
logger logging.Logger, | ||
) (board.Board, error) { | ||
return genericlinux.NewBoard(ctx, conf, genericlinux.ConstPinDefs(gpioMappings), logger) | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package odroid is only available on Linux. | ||
package odroid |