ezopmp

package
v0.2.36 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package ezopmp is a motor driver for the hydrogarden pump

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMotor

func NewMotor(ctx context.Context, deps resource.Dependencies, c *Config, name resource.Name,
	logger golog.Logger,
) (motor.LocalMotor, error)

NewMotor returns a motor(Ezopmp) with I2C protocol.

Types

type Config added in v0.2.36

type Config struct {
	BoardName   string `json:"board"`
	BusName     string `json:"i2c_bus"`
	I2CAddress  *byte  `json:"i2c_addr"`
	MaxReadBits *int   `json:"max_read_bits"`
}

Config is user config inputs for ezopmp.

func (*Config) Validate added in v0.2.36

func (conf *Config) Validate(path string) ([]string, error)

Validate ensures all parts of the config are valid.

type Ezopmp

type Ezopmp struct {
	resource.Named
	resource.AlwaysRebuild
	resource.TriviallyCloseable

	I2CAddress byte
	// contains filtered or unexported fields
}

Ezopmp represents a motor connected via the I2C protocol.

func (*Ezopmp) GoFor

func (m *Ezopmp) GoFor(ctx context.Context, mLPerMin, mins float64, extra map[string]interface{}) error

GoFor sets a constant flow rate mLPerMin = rpm, mins = revolutions.

func (*Ezopmp) GoTillStop

func (m *Ezopmp) GoTillStop(ctx context.Context, rpm float64, stopFunc func(ctx context.Context) bool) error

GoTillStop is unimplemented.

func (*Ezopmp) GoTo

func (m *Ezopmp) GoTo(ctx context.Context, mLPerMin, mins float64, extra map[string]interface{}) error

GoTo uses the Dose Over Time Command in the EZO-PMP datasheet mLPerMin = rpm, mins = revolutions.

func (*Ezopmp) IsMoving

func (m *Ezopmp) IsMoving(ctx context.Context) (bool, error)

IsMoving returns whether or not the motor is currently moving.

func (*Ezopmp) IsPowered

func (m *Ezopmp) IsPowered(ctx context.Context, extra map[string]interface{}) (bool, float64, error)

IsPowered returns whether or not the motor is currently on, and how much power it's getting.

func (*Ezopmp) Position

func (m *Ezopmp) Position(ctx context.Context, extra map[string]interface{}) (float64, error)

Position will return the total volume dispensed.

func (*Ezopmp) Properties

func (m *Ezopmp) Properties(ctx context.Context, extra map[string]interface{}) (map[motor.Feature]bool, error)

Properties returns the status of optional features on the motor.

func (*Ezopmp) ResetZeroPosition

func (m *Ezopmp) ResetZeroPosition(ctx context.Context, offset float64, extra map[string]interface{}) error

ResetZeroPosition clears the amount of volume that has been dispensed.

func (*Ezopmp) SetPower

func (m *Ezopmp) SetPower(ctx context.Context, powerPct float64, extra map[string]interface{}) error

SetPower sets the percentage of power the motor should employ between -1 and 1. Negative power implies a backward directional rotational for this pump, it goes between 0.5ml to 105ml/min.

func (*Ezopmp) Stop

func (m *Ezopmp) Stop(ctx context.Context, extra map[string]interface{}) error

Stop turns the power to the motor off immediately, without any gradual step down.

func (*Ezopmp) Validate

func (m *Ezopmp) Validate() error

Validate if this config is valid.

Jump to

Keyboard shortcuts

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