/* unipolar.cpp Part of Grbl_ESP32 copyright (c) 2019 - Bart Dring. This file was intended for use on the ESP32 CPU. Do not use this with Grbl for atMega328P Grbl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Grbl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Grbl. If not, see . Unipolar Class This class allows you to control a unipolar motor. Unipolar motors have 5 wires. One is typically tied to a voltage, while the other 4 are switched to ground in a sequence To take a step simply call the step(step, direction) function. */ #include "grbl.h" #ifdef USE_UNIPOLAR // assign the I/O pins used for each coil of the motors #ifdef X_UNIPOLAR Unipolar X_Unipolar(X_PIN_PHASE_0, X_PIN_PHASE_1, X_PIN_PHASE_2, X_PIN_PHASE_3, true); #endif #ifdef Y_UNIPOLAR Unipolar Y_Unipolar(Y_PIN_PHASE_0, Y_PIN_PHASE_1, Y_PIN_PHASE_2, Y_PIN_PHASE_3, true); #endif #ifdef Z_UNIPOLAR Unipolar Z_Unipolar(Z_PIN_PHASE_0, Z_PIN_PHASE_1, Z_PIN_PHASE_2, Z_PIN_PHASE_3, true); #endif void unipolar_init(){ #ifdef X_UNIPOLAR X_Unipolar.init(); grbl_send(CLIENT_SERIAL, "[MSG:X Unipolar]\r\n"); #endif #ifdef Y_UNIPOLAR Y_Unipolar.init(); grbl_send(CLIENT_SERIAL, "[MSG:Y Unipolar]\r\n"); #endif #ifdef Z_UNIPOLAR Z_Unipolar.init(); grbl_send(CLIENT_SERIAL, "[MSG:Z Unipolar]\r\n"); #endif } void unipolar_step(uint8_t step_mask, uint8_t dir_mask) { #ifdef X_UNIPOLAR X_Unipolar.step(step_mask & (1<