Sending SPI commands from Smoothie

Hi, I would like to have smoothie send an arbitrary command over SPI or I2C when it receives a given gcode or mcode over telnet.

  1. Is this possible?
  2. Where can I find an example of making custom commands for smoothie? I haven’t been successful so far…

Thanks for the help!

Imported from wikidot

This might be possible with a custom module in the firmware. (I can’t make any guarantees, but conceptually I don’t see why this wouldn’t work.)

Check out the ModuleExample page on Smoothieware site for an example on how to make a custom module.
NOTE: there is no longer an ON_GCODE_EXECUTE event, instead use the ON_GCODE_RECEIVED event.

Check out the Laser module ("/src/modules/tools/laser/Laser.cpp") for an example of using this event to listen to custom m-codes.
Check out the Universal Panel Adapter module (“src/modules/utils/panel/panels/UniversalAdapter.cpp”) for an example in SPI.
Check out the Current Control module (“src/modules/utils/currentcontrol/mcp4451.h”) for an example in I2C.