Skip to content

Commit

Permalink
Fix build and make sm4 a C++ file
Browse files Browse the repository at this point in the history
  • Loading branch information
gudnimg committed Oct 19, 2023
1 parent 24d8a04 commit 92e8841
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ set(FW_SOURCES
SdFile.cpp
SdVolume.cpp
Servo.cpp
sm4.c
sm4.cpp
sound.cpp
speed_lookuptable.cpp
spi.c
Expand Down
7 changes: 3 additions & 4 deletions Firmware/sm4.c → Firmware/sm4.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//sm4.c - simple 4-axis stepper control

//sm4.cpp - simple 4-axis stepper control
#include "sm4.h"
#include <avr/io.h>
#include <avr/pgmspace.h>
Expand Down Expand Up @@ -70,7 +69,7 @@ void sm4_set_dir(uint8_t axis, uint8_t dir)

void sm4_set_dir_bits(uint8_t dir_bits)
{
register uint8_t portL = PORTL;
uint8_t portL = PORTL;
portL &= 0xb8; //set direction bits to zero
//TODO -optimize in asm
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
Expand All @@ -96,7 +95,7 @@ void sm4_do_step(uint8_t axes_mask)
#ifdef TMC2130_DEDGE_STEPPING
PINC = (axes_mask & 0x0f); // toggle step signals by mask
#else
register uint8_t portC = PORTC & 0xf0;
uint8_t portC = PORTC & 0xf0;
PORTC = portC | (axes_mask & 0x0f); //set step signals by mask
asm("nop");
PORTC = portC; //set step signals to zero
Expand Down
6 changes: 0 additions & 6 deletions Firmware/sm4.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
#include <inttypes.h>
#include "config.h"


#if defined(__cplusplus)
extern "C" {
#endif //defined(__cplusplus)


// callback prototype for stop condition (return 0 - continue, return 1 - stop)
typedef uint8_t (*sm4_stop_cb_t)();

Expand Down

0 comments on commit 92e8841

Please sign in to comment.