Skip to content

Commit

Permalink
add pi5 model (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnN193 authored Dec 4, 2024
1 parent 2ad9ac8 commit 482eb2c
Show file tree
Hide file tree
Showing 34 changed files with 643 additions and 234 deletions.
21 changes: 14 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ require (
github.com/golangci/golangci-lint v1.61.0
github.com/pkg/errors v0.9.1
github.com/rhysd/actionlint v1.6.24
github.com/viam-modules/pinctrl v0.0.0-20241122191654-83914270ceff
go.uber.org/multierr v1.11.0
go.viam.com/api v0.1.350
go.viam.com/rdk v0.47.1-0.20241023182436-b6f09254154f
go.viam.com/test v1.1.1-0.20220913152726-5da9916c08a2
go.viam.com/utils v0.1.106
go.viam.com/api v0.1.357
go.viam.com/rdk v0.50.0
go.viam.com/test v1.2.3
go.viam.com/utils v0.1.112
)

require (
Expand Down Expand Up @@ -55,7 +56,6 @@ require (
github.com/bufbuild/protocompile v0.5.1 // indirect
github.com/butuzov/ireturn v0.3.0 // indirect
github.com/butuzov/mirror v1.2.0 // indirect
github.com/bytedance/sonic v1.11.9 // indirect
github.com/campoy/embedmd v1.0.0 // indirect
github.com/catenacyber/perfsprint v0.7.1 // indirect
github.com/ccojocar/zxcvbn-go v1.0.2 // indirect
Expand All @@ -65,16 +65,19 @@ require (
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/ckaznocha/intrange v0.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.13.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgottlieb/smarty-assertions v1.2.5 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/edaniels/golog v0.0.0-20230215213219-28954395e8d0 // indirect
github.com/edaniels/lidario v0.0.0-20220607182921-5879aa7b96dd // indirect
github.com/edaniels/zeroconf v1.0.10 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
github.com/ettle/strcase v0.2.0 // indirect
github.com/fatih/camelcase v1.0.0 // indirect
Expand Down Expand Up @@ -179,6 +182,7 @@ require (
github.com/miekg/dns v1.1.53 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mkch/gpio v0.0.0-20190919032813-8327cd97d95e // indirect
github.com/montanaflynn/stats v0.7.0 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
Expand Down Expand Up @@ -229,7 +233,6 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sivchari/tenv v1.10.0 // indirect
github.com/smartystreets/assertions v1.13.0 // indirect
github.com/sonatard/noctx v0.0.2 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
Expand All @@ -250,6 +253,7 @@ require (
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ultraware/funlen v0.1.0 // indirect
github.com/ultraware/whitespace v0.1.1 // indirect
github.com/uudashr/gocognit v1.1.3 // indirect
Expand All @@ -269,7 +273,7 @@ require (
go-hep.org/x/hep v0.32.1 // indirect
go-simpler.org/musttag v0.12.2 // indirect
go-simpler.org/sloglint v0.7.2 // indirect
go.mongodb.org/mongo-driver v1.11.6 // indirect
go.mongodb.org/mongo-driver v1.12.2 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
Expand All @@ -279,6 +283,7 @@ require (
go.uber.org/automaxprocs v1.5.3 // indirect
go.uber.org/goleak v1.3.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect
Expand Down Expand Up @@ -310,3 +315,5 @@ require (
periph.io/x/conn/v3 v3.7.0 // indirect
periph.io/x/host/v3 v3.8.1-0.20230331112814-9f0d9f7d76db // indirect
)

// replace github.com/viam-modules/pinctrl => ../pinctrl
198 changes: 19 additions & 179 deletions go.sum

Large diffs are not rendered by default.

36 changes: 32 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,56 @@ package main

import (
"context"
"raspberry-pi/rpi"

"go.viam.com/rdk/components/board"
"go.viam.com/rdk/components/servo"
"go.viam.com/rdk/logging"
"go.viam.com/rdk/module"
"go.viam.com/utils"

"raspberry-pi/pi5"
"raspberry-pi/rpi"
rpiservo "raspberry-pi/rpi-servo"
)

// func init() {
// if isPi5 {

// pi5.RegisterPINCTRL()
// } else {
// // init registers a pi board based on pigpio.
// rpi.RegisterPIGPIO()
// }
// }

func main() {
utils.ContextualMain(mainWithArgs, module.NewLoggerFromArgs("raspberry-pi"))
}

func mainWithArgs(ctx context.Context, args []string, logger logging.Logger) error {
module, err := module.NewModuleFromArgs(ctx, logger)
module, err := module.NewModuleFromArgs(ctx)
if err != nil {
return err
}

if err = module.AddModelFromRegistry(ctx, board.API, rpi.Model); err != nil {
if err = module.AddModelFromRegistry(ctx, board.API, pi5.Model); err != nil {
return err
}
if err = module.AddModelFromRegistry(ctx, board.API, rpi.ModelPi4); err != nil {
return err
}
if err = module.AddModelFromRegistry(ctx, board.API, rpi.ModelPi3); err != nil {
return err
}
if err = module.AddModelFromRegistry(ctx, board.API, rpi.ModelPi2); err != nil {
return err
}
if err = module.AddModelFromRegistry(ctx, board.API, rpi.ModelPi1); err != nil {
return err
}
if err = module.AddModelFromRegistry(ctx, board.API, rpi.ModelPi0_2); err != nil {
return err
}
if err = module.AddModelFromRegistry(ctx, board.API, rpi.ModelPi0); err != nil {
return err
}

Expand Down
Loading

0 comments on commit 482eb2c

Please sign in to comment.