HAL updates

This commit is contained in:
Scott Lahteine
2017-09-06 06:28:32 -05:00
parent 65996e4235
commit 54326fb06a
52 changed files with 327 additions and 378 deletions

View File

@@ -34,7 +34,7 @@
// --------------------------------------------------------------------------
#include "../HAL.h"
#include "../../../macros.h"
#include "../../core/macros.h"
// --------------------------------------------------------------------------
// Externals
@@ -75,7 +75,7 @@
// --------------------------------------------------------------------------
#if ENABLED(SDSUPPORT)
#include "../../../SdFatUtil.h"
#include "../../sd/SdFatUtil.h"
int freeMemory() { return SdFatUtil::FreeRam(); }
#else

View File

@@ -56,7 +56,7 @@ bool endstop_monitor_flag = false;
#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
#include "../../../pinsDebug_list.h"
#include "../../pins/pinsDebug_list.h"
#line 51
// manually add pins that have names that are macros which don't play well with these macros
@@ -107,7 +107,7 @@ const PinInfo pin_array[] PROGMEM = {
#endif
#endif
#include "../../../pinsDebug_list.h"
#include "../../pins/pinsDebug_list.h"
#line 102
};
@@ -483,7 +483,7 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f
SERIAL_CHAR('.');
SERIAL_ECHO_SP(26 + strlen(start_string)); // add padding if not the first instance found
}
name_mem_pointer = (char*)pgm_read_word(&pin_array[x].name);
name_mem_pointer = (char*)pgm_read_ptr(&pin_array[x].name);
for (uint8_t y = 0; y < 28; y++) { // always print pin name
temp_char = pgm_read_byte(name_mem_pointer + y);
if (temp_char != 0)

View File

@@ -37,7 +37,7 @@
// Includes
// --------------------------------------------------------------------------
#include "../../../MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
// --------------------------------------------------------------------------
// Public Variables

View File

@@ -31,7 +31,7 @@
#ifdef ARDUINO_ARCH_AVR
#include "MarlinSerial.h"
#include "../../../Marlin.h"
#include "../../Marlin.h"
// Disable HardwareSerial.cpp to support chips without a UART (Attiny, etc.)
@@ -47,8 +47,7 @@
#if ENABLED(EMERGENCY_PARSER)
#include "../../../stepper.h"
#include "../../../language.h"
#include "../../module/stepper.h"
// Currently looking for: M108, M112, M410
// If you alter the parser please don't forget to update the capabilities in Conditionals_post.h

View File

@@ -32,7 +32,7 @@
#ifndef MARLINSERIAL_H
#define MARLINSERIAL_H
#include "../../../MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#include <WString.h>

View File

@@ -38,7 +38,8 @@
#ifndef _ENDSTOP_INTERRUPTS_H_
#define _ENDSTOP_INTERRUPTS_H_
#include "../../../macros.h"
#include "../../core/macros.h"
#include <stdint.h>
/**
* Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)

View File

@@ -30,7 +30,7 @@
#define _FASTIO_ARDUINO_H
#include <avr/io.h>
#include "../../../macros.h"
#include "../../core/macros.h"
#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
@@ -168,6 +168,7 @@ typedef enum {
} ClockSource2;
// Get interrupt bits in an orderly way
// Ex: cs = GET_CS(0); coma1 = GET_COM(A,1);
#define GET_WGM(T) (((TCCR##T##A >> WGM##T##0) & 0x3) | ((TCCR##T##B >> WGM##T##2 << 2) & 0xC))
#define GET_CS(T) ((TCCR##T##B >> CS##T##0) & 0x7)
#define GET_COM(T,Q) ((TCCR##T##Q >> COM##T##Q##0) & 0x3)
@@ -182,6 +183,7 @@ typedef enum {
#define GET_FOCC(T) GET_FOC(T,C)
// Set Wave Generation Mode bits
// Ex: SET_WGM(5,CTC_ICRn);
#define _SET_WGM(T,V) do{ \
TCCR##T##A = (TCCR##T##A & ~(0x3 << WGM##T##0)) | (( int(V) & 0x3) << WGM##T##0); \
TCCR##T##B = (TCCR##T##B & ~(0x3 << WGM##T##2)) | (((int(V) >> 2) & 0x3) << WGM##T##2); \
@@ -189,6 +191,7 @@ typedef enum {
#define SET_WGM(T,V) _SET_WGM(T,WGM_##V)
// Set Clock Select bits
// Ex: SET_CS3(PRESCALER_64);
#define _SET_CS(T,V) (TCCR##T##B = (TCCR##T##B & ~(0x7 << CS##T##0)) | ((int(V) & 0x7) << CS##T##0))
#define _SET_CS0(V) _SET_CS(0,V)
#define _SET_CS1(V) _SET_CS(1,V)
@@ -213,6 +216,7 @@ typedef enum {
#define SET_CS(T,V) SET_CS##T(V)
// Set Compare Mode bits
// Ex: SET_COMS(4,CLEAR_SET,CLEAR_SET,CLEAR_SET);
#define _SET_COM(T,Q,V) (TCCR##T##Q = (TCCR##T##Q & ~(0x3 << COM##T##Q##0)) | (int(V) << COM##T##Q##0))
#define SET_COM(T,Q,V) _SET_COM(T,Q,COM_##V)
#define SET_COMA(T,V) SET_COM(T,A,V)
@@ -221,12 +225,15 @@ typedef enum {
#define SET_COMS(T,V1,V2,V3) do{ SET_COMA(T,V1); SET_COMB(T,V2); SET_COMC(T,V3); }while(0)
// Set Noise Canceler bit
// Ex: SET_ICNC(2,1)
#define SET_ICNC(T,V) (TCCR##T##B = (V) ? TCCR##T##B | _BV(ICNC##T) : TCCR##T##B & ~_BV(ICNC##T))
// Set Input Capture Edge Select bit
// Ex: SET_ICES(5,0)
#define SET_ICES(T,V) (TCCR##T##B = (V) ? TCCR##T##B | _BV(ICES##T) : TCCR##T##B & ~_BV(ICES##T))
// Set Force Output Compare bit
// Ex: SET_FOC(3,A,1)
#define SET_FOC(T,Q,V) (TCCR##T##C = (V) ? TCCR##T##C | _BV(FOC##T##Q) : TCCR##T##C & ~_BV(FOC##T##Q))
#define SET_FOCA(T,V) SET_FOC(T,A,V)
#define SET_FOCB(T,V) SET_FOC(T,B,V)

View File

@@ -2,10 +2,7 @@
#include "../persistent_store_api.h"
#include "../../../types.h"
#include "../../../language.h"
#include "../../../serial.h"
#include "../../../utility.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)

View File

@@ -54,13 +54,13 @@
#define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin)
#endif
#define VALID_PIN(pin)) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0)
#define VALID_PIN(pin) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0)
#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && ((P) <= analogInputToDigitalPin(15) || (P) <= analogInputToDigitalPin(7)))
#define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin)
void PRINT_ARRAY_NAME(uint8_t x) {
char *name_mem_pointer = (char*)pgm_read_word(&pin_array[x].name);
char *name_mem_pointer = (char*)pgm_read_ptr(&pin_array[x].name);
for (uint8_t y = 0; y < MAX_NAME_LENGTH; y++) {
char temp_char = pgm_read_byte(name_mem_pointer + y);
if (temp_char != 0)
@@ -362,7 +362,8 @@ static void pwm_details(uint8_t pin) {
}
#endif
#ifndef PRINT_PORT(p)
#ifndef PRINT_PORT
void print_port(int8_t pin) { // print port number
#ifdef digitalPinToPort_DEBUG
uint8_t x;
@@ -394,4 +395,7 @@ static void pwm_details(uint8_t pin) {
}
#define PRINT_PORT(p) print_port(p)
#endif
#define GET_PIN_INFO(pin) do{}while(0)

View File

@@ -53,7 +53,7 @@
#ifdef ARDUINO_ARCH_AVR
#include "../../../MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if HAS_SERVOS

View File

@@ -22,13 +22,13 @@
#ifdef ARDUINO_ARCH_AVR
#include "../../../MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(USE_WATCHDOG)
#include "watchdog_AVR.h"
#include "../../../Marlin.h"
#include "../../Marlin.h"
// Initialize watchdog with a 4 sec interrupt time
void watchdog_init() {