farmbot v6.4.1 Farmbot.Firmware.Handler behaviour View Source

Any module that implements this behaviour should be a GenStage.

The implementng stage should communicate with the various Farmbot hardware such as motors and encoders. The Farmbot.Firmware module will subscribe_to: the implementing handler. Events should be Gcodes as parsed by Farmbot.Firmware.Gcode.Parser.

Link to this section Summary

Types

Pid of a firmware implementation

Pin

Mode of a pin

Speed of a command

Callbacks

Calibrate an axis

Lock the firmware

Unlock the firmware

Find home on an axis

Home an axis

Home every axis

Read all params

Request firmware version

Set a pin mode (input/output)

Set angle on a servo pin

Start a firmware handler

Manually set an axis’s current position to zero

Link to this section Types

Link to this type fw_ret_val() View Source
fw_ret_val() :: :ok | {:error, term()}
Link to this type handler() View Source
handler() :: pid()

Pid of a firmware implementation.

Link to this type pin_mode() View Source
pin_mode() :: :digital | :analog

Mode of a pin.

Speed of a command.

Link to this section Callbacks

Link to this callback calibrate(handler, axis) View Source
calibrate(handler(), axis()) :: fw_ret_val()

Calibrate an axis.

Link to this callback emergency_lock(handler) View Source
emergency_lock(handler()) :: fw_ret_val()

Lock the firmware.

Link to this callback emergency_unlock(handler) View Source
emergency_unlock(handler()) :: fw_ret_val()

Unlock the firmware.

Link to this callback find_home(handler, axis) View Source
find_home(handler(), axis()) :: fw_ret_val()

Find home on an axis.

Link to this callback home(handler, axis) View Source
home(handler(), axis()) :: fw_ret_val()

Home an axis.

Link to this callback home_all(handler) View Source
home_all(handler()) :: fw_ret_val()

Home every axis.

Link to this callback move_absolute(handler, vec3, speed, speed, speed) View Source
move_absolute(handler(), vec3(), speed(), speed(), speed()) :: fw_ret_val()

Move to a position.

Link to this callback read_all_params(handler) View Source
read_all_params(handler()) :: fw_ret_val()

Read all params

Link to this callback read_param(handler, fw_param) View Source
read_param(handler(), fw_param()) :: fw_ret_val()

Read a paramater.

Link to this callback read_pin(handler, pin, pin_mode) View Source
read_pin(handler(), pin(), pin_mode()) :: fw_ret_val()

Read a pin.

Link to this callback request_software_version(handler) View Source
request_software_version(handler()) :: fw_ret_val()

Request firmware version.

Link to this callback set_pin_mode(handler, pin, arg2) View Source
set_pin_mode(handler(), pin(), :input | :input_pullup | :output) ::
  fw_ret_val()

Set a pin mode (input/output)

Link to this callback set_servo_angle(handler, pin, number) View Source
set_servo_angle(handler(), pin(), number()) :: fw_ret_val()

Set angle on a servo pin.

Link to this callback start_link() View Source
start_link() :: {:ok, handler()}

Start a firmware handler.

Link to this callback update_param(handler, fw_param, number) View Source
update_param(handler(), fw_param(), number()) :: fw_ret_val()

Update a paramater.

Link to this callback write_pin(handler, pin, pin_mode, number) View Source
write_pin(handler(), pin(), pin_mode(), number()) :: fw_ret_val()

Write a pin.

Link to this callback zero(handler, axis) View Source
zero(handler(), axis()) :: fw_ret_val()

Manually set an axis’s current position to zero.