Implement HAL and apply macros across code-base
Implement AVR Platform
This commit is contained in:
committed by
Scott Lahteine
parent
fb04dfcda8
commit
4b16fa3272
@@ -251,7 +251,9 @@
|
||||
#include "cardreader.h"
|
||||
#include "configuration_store.h"
|
||||
#include "language.h"
|
||||
#include "pins_arduino.h"
|
||||
#ifdef ARDUINO
|
||||
#include "pins_arduino.h"
|
||||
#endif
|
||||
#include "math.h"
|
||||
#include "nozzle.h"
|
||||
#include "duration_t.h"
|
||||
@@ -275,10 +277,6 @@
|
||||
#include "buzzer.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
#include "watchdog.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
#include "Max7219_Debug_LEDs.h"
|
||||
#endif
|
||||
@@ -297,7 +295,7 @@
|
||||
#endif
|
||||
|
||||
#if HAS_SERVOS
|
||||
#include "servo.h"
|
||||
#include "src/HAL/servo.h"
|
||||
#endif
|
||||
|
||||
#if HAS_DIGIPOTSS
|
||||
@@ -317,7 +315,7 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
#include "endstop_interrupts.h"
|
||||
#include "src/HAL/HAL_endstop_interrupts.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(M100_FREE_MEMORY_WATCHER)
|
||||
@@ -653,7 +651,7 @@ float cartes[XYZ] = { 0 };
|
||||
static bool send_ok[BUFSIZE];
|
||||
|
||||
#if HAS_SERVOS
|
||||
Servo servo[NUM_SERVOS];
|
||||
HAL_SERVO_LIB servo[NUM_SERVOS];
|
||||
#define MOVE_SERVO(I, P) servo[I].move(P)
|
||||
#if HAS_Z_SERVO_ENDSTOP
|
||||
#define DEPLOY_Z_SERVO() MOVE_SERVO(Z_ENDSTOP_SERVO_NR, z_servo_angle[0])
|
||||
@@ -789,26 +787,6 @@ inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#include "SdFatUtil.h"
|
||||
int freeMemory() { return SdFatUtil::FreeRam(); }
|
||||
#else
|
||||
extern "C" {
|
||||
extern char __bss_end;
|
||||
extern char __heap_start;
|
||||
extern void* __brkval;
|
||||
|
||||
int freeMemory() {
|
||||
int free_memory;
|
||||
if ((int)__brkval == 0)
|
||||
free_memory = ((int)&free_memory) - ((int)&__bss_end);
|
||||
else
|
||||
free_memory = ((int)&free_memory) - ((int)__brkval);
|
||||
return free_memory;
|
||||
}
|
||||
}
|
||||
#endif // !SDSUPPORT
|
||||
|
||||
#if ENABLED(DIGIPOT_I2C)
|
||||
extern void digipot_i2c_set_current(uint8_t channel, float current);
|
||||
extern void digipot_i2c_init();
|
||||
@@ -11845,7 +11823,7 @@ void ok_to_send() {
|
||||
delta_diagonal_rod_2_tower[C_AXIS] = sq(diagonal_rod + drt[C_AXIS]);
|
||||
}
|
||||
|
||||
#if ENABLED(DELTA_FAST_SQRT)
|
||||
#if ENABLED(DELTA_FAST_SQRT) && defined(ARDUINO_ARCH_AVR)
|
||||
/**
|
||||
* Fast inverse sqrt from Quake III Arena
|
||||
* See: https://en.wikipedia.org/wiki/Fast_inverse_square_root
|
||||
@@ -13357,17 +13335,22 @@ void setup() {
|
||||
#endif
|
||||
|
||||
MYSERIAL.begin(BAUDRATE);
|
||||
while(!MYSERIAL);
|
||||
SERIAL_PROTOCOLLNPGM("start");
|
||||
SERIAL_ECHO_START();
|
||||
|
||||
// Check startup - does nothing if bootloader sets MCUSR to 0
|
||||
byte mcu = MCUSR;
|
||||
byte mcu = HAL_get_reset_source();
|
||||
if (mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP);
|
||||
if (mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET);
|
||||
if (mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET);
|
||||
if (mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET);
|
||||
if (mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET);
|
||||
MCUSR = 0;
|
||||
HAL_clear_reset_source();
|
||||
|
||||
#if ENABLED(USE_WATCHDOG) //reinit watchdog after HAL_get_reset_source call
|
||||
watchdog_init();
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPGM(MSG_MARLIN);
|
||||
SERIAL_CHAR(' ');
|
||||
@@ -13406,10 +13389,6 @@ void setup() {
|
||||
|
||||
thermalManager.init(); // Initialize temperature loop
|
||||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
watchdog_init();
|
||||
#endif
|
||||
|
||||
stepper.init(); // Initialize stepper, this enables interrupts!
|
||||
servo_init();
|
||||
|
||||
@@ -13619,4 +13598,3 @@ void loop() {
|
||||
endstops.report_state();
|
||||
idle();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user