Documentation
¶
Overview ¶
Package ams implements the AMS_AS5048 encoder
Index ¶
- type AttrConfig
- type Encoder
- func (enc *Encoder) Close() 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) ResetPosition(ctx context.Context, extra map[string]interface{}) error
- type I2CAttrConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttrConfig ¶
type AttrConfig struct { BoardName string `json:"board"` // We include connection type here in anticipation for // future SPI support ConnectionType string `json:"connection_type"` *I2CAttrConfig `json:"i2c_attributes,omitempty"` }
AttrConfig contains the connection information for configuring an AS5048 encoder.
type Encoder ¶
type Encoder struct { generic.Unimplemented // contains filtered or unexported fields }
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.
type I2CAttrConfig ¶
I2CAttrConfig stores the configuration information for I2C connection.
func (*I2CAttrConfig) ValidateI2C ¶
func (cfg *I2CAttrConfig) ValidateI2C(path string) error
ValidateI2C ensures all parts of the config are valid.