gy61

package module
v0.0.0-...-f6285ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gy61

Driver for WAVGAT 6 Axis MPU6050 Module with Kalman filtering.

Preparation

The module comes with I2C and UART interfaces. Only UART interface provides the Kalman-filtered data, so we connect the module to the UART adapter:

Building

Building with Go compiler go version go1.21.1 linux/amd64:

cd main/
go build -o gy61

Testing

Run ./gy61 executable, providing the serial device, for example /dev/ttyUSB0, in case of USB-UART adapter:

./gy61 /dev/ttyUSB0
 -49.12   76.87  107.95
 -48.77   76.82  108.26
 -54.50   -0.64  -53.28
 -54.54   -0.64  -53.28
 -54.56   -0.63  -53.27
 -54.57   -0.63  -53.26
 -54.59   -0.62  -53.22
 -54.60   -0.60  -53.18
 -54.60   -0.59  -53.11
 -54.62   -0.57  -53.03
 -54.60   -0.54  -52.93
 -54.58   -0.53  -52.83
 -54.56   -0.53  -52.74

The program will output the 3D data, which will change, as you move the module around.

Documentation

Overview

Package gy61 is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorFn

type ErrorFn func(error)

type GY61

type GY61 struct {
	// contains filtered or unexported fields
}

func NewGY61

func NewGY61(serialPort Serial, gyroReceivedFn, accReceivedFn, anglesReceivedFn GY61DataReceivedFn, onError ErrorFn) *GY61

NewGY61 creates a new instance for gyro data reading

func (*GY61) ReadAsync

func (s *GY61) ReadAsync()

ReadAsync starts goroutine to read data in the background

type GY61DataReceivedFn

type GY61DataReceivedFn func(x, y, z float32)

type MockSerial

type MockSerial struct {
	// contains filtered or unexported fields
}

MockSerial is a mock of Serial interface

func NewMockSerial

func NewMockSerial(ctrl *gomock.Controller) *MockSerial

NewMockSerial creates a new mock instance

func (*MockSerial) Close

func (m *MockSerial) Close() error

Close mocks base method

func (*MockSerial) EXPECT

func (m *MockSerial) EXPECT() *MockSerialMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockSerial) OpenSerial

func (m *MockSerial) OpenSerial(c *serial.Config) error

OpenSerial mocks base method

func (*MockSerial) Read

func (m *MockSerial) Read(b []byte) (int, error)

Read mocks base method

func (*MockSerial) Write

func (m *MockSerial) Write(b []byte) (int, error)

Write mocks base method

type MockSerialMockRecorder

type MockSerialMockRecorder struct {
	// contains filtered or unexported fields
}

MockSerialMockRecorder is the mock recorder for MockSerial

func (*MockSerialMockRecorder) Close

func (mr *MockSerialMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockSerialMockRecorder) OpenSerial

func (mr *MockSerialMockRecorder) OpenSerial(c interface{}) *gomock.Call

OpenSerial indicates an expected call of OpenSerial

func (*MockSerialMockRecorder) Read

func (mr *MockSerialMockRecorder) Read(b interface{}) *gomock.Call

Read indicates an expected call of Read

func (*MockSerialMockRecorder) Write

func (mr *MockSerialMockRecorder) Write(b interface{}) *gomock.Call

Write indicates an expected call of Write

type Serial

type Serial interface {
	OpenSerial(c *serial.Config) error
	Write(b []byte) (int, error)
	Read(b []byte) (int, error)
	Close() error
}

func NewSerial

func NewSerial(c *serial.Config) (Serial, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址