Documentation ¶
Overview ¶
Package ams implements the AMS_AS5048 encoder
Index ¶
- type Config
- type Encoder
- func (enc *Encoder) Close(ctx context.Context) error
- func (enc *Encoder) GetPosition(ctx context.Context, positionType encoder.PositionType, ...) (float64, encoder.PositionType, error)
- func (enc *Encoder) GetProperties(ctx context.Context, extra map[string]interface{}) (map[encoder.Feature]bool, error)
- func (enc *Encoder) Reconfigure(ctx context.Context, deps resource.Dependencies, conf resource.Config) error
- func (enc *Encoder) ResetPosition(ctx context.Context, extra map[string]interface{}) error
- type I2CConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { BoardName string `json:"board"` // We include connection type here in anticipation for // future SPI support ConnectionType string `json:"connection_type"` *I2CConfig `json:"i2c_attributes,omitempty"` }
Config contains the connection information for configuring an AS5048 encoder.
type Encoder ¶
Encoder is a struct representing an instance of a hardware unit in AMS's AS5048 series of Hall-effect encoders.
func (*Encoder) GetPosition ¶
func (enc *Encoder) GetPosition( ctx context.Context, positionType encoder.PositionType, extra map[string]interface{}, ) (float64, encoder.PositionType, error)
GetPosition returns the total number of rotations detected by the encoder (rather than a number of pulse state transitions) because this encoder is absolute and not incremental. As a result a user MUST set ticks_per_rotation on the config of the corresponding motor to 1. Any other value will result in completely incorrect position measurements by the motor.
func (*Encoder) GetProperties ¶
func (enc *Encoder) GetProperties(ctx context.Context, extra map[string]interface{}) (map[encoder.Feature]bool, error)
GetProperties returns a list of all the position types that are supported by a given encoder.
func (*Encoder) Reconfigure ¶
func (enc *Encoder) Reconfigure( ctx context.Context, deps resource.Dependencies, conf resource.Config, ) error
Reconfigure reconfigures the encoder atomically.
type I2CConfig ¶
I2CConfig stores the configuration information for I2C connection.
func (*I2CConfig) ValidateI2C ¶
ValidateI2C ensures all parts of the config are valid.