[2.0.x] TMC2130 support for LPC platform (#9114)

This commit is contained in:
teemuatlut
2018-02-02 05:49:40 +02:00
committed by Scott Lahteine
parent 34160806c0
commit 5c69d45f5b
55 changed files with 328 additions and 12 deletions

View File

@ -56,7 +56,7 @@ extern "C" volatile uint32_t _millis;
#define B01 1
#define B10 2
#include "include/arduino.h"
#include "include/Arduino.h"
#include "pinmapping.h"
#include "fastio.h"

View File

@ -56,6 +56,8 @@
//#include "../../../MarlinConfig.h" //works except in U8g
#include "spi_pins.h"
#include "fastio.h"
#include "LPC_SPI.h"
#include "../SPI.h"
// --------------------------------------------------------------------------
// Public Variables
@ -191,6 +193,20 @@
WRITE(SS_PIN, HIGH);
}
void SPIClass::begin() { spiBegin(); }
uint8_t SPIClass::transfer(uint8_t B) {
return spiTransfer(B);
}
uint16_t SPIClass::transfer16(uint16_t data) {
uint16_t buffer;
buffer = transfer((data>>8) & 0xFF) << 8;
buffer |= transfer(data & 0xFF) && 0xFF;
return buffer;
}
SPIClass SPI;
#else
// hardware SPI

View File

@ -74,7 +74,7 @@
#include "../../inc/MarlinConfig.h"
#include <lpc17xx_pinsel.h>
#include "LPC1768_PWM.h"
#include "arduino.h"
#include "Arduino.h"
#define NUM_ISR_PWMS 20

View File

@ -0,0 +1,44 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef TARGET_LPC1768
#include <stdint.h>
#define MSBFIRST 0
#define SPI_MODE3 0
class SPISettings {
public:
SPISettings(int a, int b, int c) {};
};
class SPIClass {
public:
void begin();
void beginTransaction(SPISettings foo) {};
void endTransaction() {};
uint8_t transfer(uint8_t data);
uint16_t transfer16(uint16_t data);
};
extern SPIClass SPI;
#endif

View File

@ -39,7 +39,7 @@
#include "../../inc/MarlinConfig.h"
#include <stdint.h>
#include <stdarg.h>
#include "include/arduino.h"
#include "include/Arduino.h"
#include "pinmapping.h"
#include "fastio.h"
#include "SoftwareSerial.h"

View File

@ -33,7 +33,7 @@
#ifndef SOFTWARESERIAL_H
#define SOFTWARESERIAL_H
#include "include/arduino.h"
#include "include/Arduino.h"
#include <stdint.h>
//#include "serial.h"
#include <Stream.h>

View File

@ -19,7 +19,7 @@
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "include/arduino.h"
#include "include/Arduino.h"
#include "pinmapping.h"
//#include "HAL_timers.h"
#include "fastio.h"

View File

@ -36,7 +36,7 @@
#define _FASTIO_LPC1768_H
#include <LPC17xx.h>
#include "include/arduino.h"
#include "include/Arduino.h"
#include "pinmapping.h"
bool useable_hardware_PWM(pin_t pin);

View File

@ -30,7 +30,7 @@ extern "C" {
#include "HAL_timers.h"
#include <stdio.h>
#include <stdarg.h>
#include "include/arduino.h"
#include "include/Arduino.h"
#include "serial.h"
#include "LPC1768_PWM.h"