Documentation ¶
Overview ¶
Package rpi helps you to develop software for the Raspberry Pi that does IO operations on the Raspberry PI. It enables you to develop your code locally on any type of architecture, by using gRPC to control a Raspberry PI remotely. This is very convenient in conjunction with services like balena.io.
This makes developing applications for the RaspberryPi extremely easy. Once your software is ready, you have the option of continuing to use gRPC calls, or switch over to a local version of the interfaces to compile a binary that runs directly on the RaspberryPi.
If you have any suggestion or comments, please feel free to open an issue on the projects GitHub page.
Index ¶
- func NewCommonServer(common Common) proto.CommonServer
- func NewGpioServer(gpio Gpio) proto.GpioServer
- func NewGrpcClientConnectionInsecure(host, port string) (*grpc.ClientConn, error)
- func NewGrpcServerInsecure(host, port string) (*grpc.Server, net.Listener, error)
- func NewPicamServer(cam PiCam) proto.PiCamServer
- type Common
- type Gpio
- type Ngrok
- type PiCam
- type PiCamArgs
- type Pin
- type PinEdge
- type PinMode
- type PinState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommonServer ¶
func NewCommonServer(common Common) proto.CommonServer
NewCommonServer creates a new common server using the common interface provided
func NewGpioServer ¶
func NewGpioServer(gpio Gpio) proto.GpioServer
NewGpioServer creates a new gpio server that uses the gpio interface provided
func NewGrpcClientConnectionInsecure ¶
func NewGrpcClientConnectionInsecure(host, port string) (*grpc.ClientConn, error)
NewGrpcClientConnectionInsecure creates a new insecure grpc client connection that can used by grpc clients
func NewGrpcServerInsecure ¶
NewGrpcServerInsecure creates a new insecure grpc server that can serve grpc services
func NewPicamServer ¶
func NewPicamServer(cam PiCam) proto.PiCamServer
NewPicamServer creates a picam server that uses the picam interface provided
Types ¶
type Common ¶
type Common interface { GetVersion(ctx context.Context) (string, string, error) Modprobe(ctx context.Context, mod string) error }
Common interface are the basic operations sometimes needed to use other the other interfaces
func NewCommonLocal ¶
func NewCommonLocal() Common
NewCommonLocal creates a new common interface that operates locally
func NewCommonRemote ¶
func NewCommonRemote(connection *grpc.ClientConn) Common
NewCommonRemote creates a new common interface that operates on a remote server
type Gpio ¶
type Gpio interface { Open(ctx context.Context) error Close(ctx context.Context) error Input(ctx context.Context, pin Pin) error Output(ctx context.Context, pin Pin) error Clock(ctx context.Context, pin Pin) error Pwm(ctx context.Context, pin Pin) error PullUp(ctx context.Context, pin Pin) error PullDown(ctx context.Context, pin Pin) error PullOff(ctx context.Context, pin Pin) error High(ctx context.Context, pin Pin) error Low(ctx context.Context, pin Pin) error Toggle(ctx context.Context, pin Pin) error Write(ctx context.Context, pin Pin, state PinState) error Read(ctx context.Context, pin Pin) (PinState, error) Freq(ctx context.Context, pin Pin, freq int32) error DutyCycle(ctx context.Context, pin Pin, dutyLen, cycleLen int32) error Detect(ctx context.Context, pin Pin, edge PinEdge) error EdgeDetected(ctx context.Context, pin Pin) (bool, error) }
Gpio interface provides a way to control and read from the GPIO pins on a RaspberryPi
func NewGpioLocal ¶
func NewGpioLocal() Gpio
NewGpioLocal creates a new Gpio interface that uses local gpio pins
func NewGpioRemote ¶
func NewGpioRemote(connection *grpc.ClientConn) Gpio
NewGpioRemote creates a new Gpio interface that uses remote gpio pins
type Ngrok ¶
Ngrok interface provides a way to create an Ngrok tunnel to expose services to the internet
func NewNgrokLocal ¶
NewNgrokLocal creates a new local Ngrok interface
type PiCam ¶
type PiCam interface { Open(ctx context.Context) error Close(ctx context.Context) error GetFrame(ctx context.Context) ([]byte, error) GetFrames(ctx context.Context, byteCh chan<- []byte, errCh chan<- error) (<-chan struct{}, error) }
PiCam interface provides a way to fetch frames from a PiCam connected to a RaspberryPi
func NewPiCamLocal ¶
NewPiCamLocal creates a new local PiCam
func NewPiCamRemote ¶
func NewPiCamRemote(connection *grpc.ClientConn) PiCam
NewPiCamRemote creates a new remote PiCam
type PiCamArgs ¶
type PiCamArgs = picamera.RaspividArgs
PiCamArgs is a struct of arguments when initializing the PiCamera
func NewPiCamArgs ¶
func NewPiCamArgs() *PiCamArgs
NewPiCamArgs creates the default arguments for the PiCam