Merge pull request #8484 from Bob-the-Kuhn/P1.02-P1.20

2.0.x LPC1768 - M42 compatibility with Repetier Host
This commit is contained in:
Scott Lahteine 2017-11-20 15:03:00 -06:00 committed by GitHub
commit 586c1e4e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 401 additions and 358 deletions

View File

@ -58,7 +58,7 @@ void HAL_analog_pin_state(char buffer[], int8_t pin) {
#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
#include "../../pins/pinsDebug_list.h"
#line 51
#line 62
// manually add pins that have names that are macros which don't play well with these macros
#if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
@ -109,7 +109,7 @@ const PinInfo pin_array[] PROGMEM = {
#endif
#include "../../pins/pinsDebug_list.h"
#line 102
#line 113
};

View File

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

View File

@ -174,12 +174,12 @@ uint16_t HAL_adc_get_result(void) {
#define SBIT_PWMEN 2
#define SBIT_PWMMR0R 1
#define PWM_1 0 //P2_0 (0-1 Bits of PINSEL4)
#define PWM_2 2 //P2_1 (2-3 Bits of PINSEL4)
#define PWM_3 4 //P2_2 (4-5 Bits of PINSEL4)
#define PWM_4 6 //P2_3 (6-7 Bits of PINSEL4)
#define PWM_5 8 //P2_4 (8-9 Bits of PINSEL4)
#define PWM_6 10 //P2_5 (10-11 Bits of PINSEL4)
#define PWM_1 0 //P2_00 (0-1 Bits of PINSEL4)
#define PWM_2 2 //P2_01 (2-3 Bits of PINSEL4)
#define PWM_3 4 //P2_02 (4-5 Bits of PINSEL4)
#define PWM_4 6 //P2_03 (6-7 Bits of PINSEL4)
#define PWM_5 8 //P2_04 (8-9 Bits of PINSEL4)
#define PWM_6 10 //P2_05 (10-11 Bits of PINSEL4)
void HAL_pwm_init(void) {
LPC_PINCON->PINSEL4 = _BV(PWM_5) | _BV(PWM_6);
@ -193,7 +193,7 @@ void HAL_pwm_init(void) {
// Trigger the latch Enable Bits to load the new Match Values MR0, MR5, MR6
LPC_PWM1->LER = _BV(0) | _BV(5) | _BV(6);
// Enable the PWM output pins for PWM_5-PWM_6(P2_4 - P2_5)
// Enable the PWM output pins for PWM_5-PWM_6(P2_04 - P2_05)
LPC_PWM1->PCR = _BV(13) | _BV(14);
}

View File

@ -20,16 +20,12 @@
*
*/
#if defined(TARGET_LPC1768)
void u8g_i2c_init(uint8_t options);
#ifdef TARGET_LPC1768
void u8g_i2c_init(uint8_t options);
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
uint8_t u8g_i2c_start(uint8_t sla);
uint8_t u8g_i2c_send_byte(uint8_t data);
void u8g_i2c_stop(void);
#endif

View File

@ -30,34 +30,34 @@
* resulted in using about about 25% of the CPU's time.
*/
#if defined(TARGET_LPC1768)
#ifdef TARGET_LPC1768
#include <LPC17xx.h>
#include <lpc17xx_pinsel.h>
#include "src/core/macros.h"
// #include "pinmapping.h"
#include <LPC17xx.h>
#include <lpc17xx_pinsel.h>
#include "src/core/macros.h"
//#include "pinmapping.h"
#define LPC_PORT_OFFSET (0x0020)
#define LPC_PIN(pin) (1UL << pin)
#define LPC_GPIO(port) ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port))
#define LPC_PORT_OFFSET (0x0020)
#define LPC_PIN(pin) (1UL << pin)
#define LPC_GPIO(port) ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port))
#define INPUT 0
#define OUTPUT 1
#define INPUT_PULLUP 2
#define INPUT 0
#define OUTPUT 1
#define INPUT_PULLUP 2
uint8_t LPC1768_PIN_PORT(const uint8_t pin);
uint8_t LPC1768_PIN_PIN(const uint8_t pin);
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif
// IO functions
// I/O functions
// As defined by Arduino INPUT(0x0), OUPUT(0x1), INPUT_PULLUP(0x2)
void pinMode_LCD(uint8_t pin, uint8_t mode) {
#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
PINSEL_CFG_Type config = { LPC1768_PIN_PORT(pin),
LPC1768_PIN_PIN(pin),
PINSEL_FUNC_0,
@ -82,35 +82,32 @@ void pinMode_LCD(uint8_t pin, uint8_t mode) {
}
}
void u8g_SetPinOutput(uint8_t internal_pin_number) {
pinMode_LCD(internal_pin_number, 1); // OUTPUT
}
void u8g_SetPinOutput(uint8_t internal_pin_number) {
pinMode_LCD(internal_pin_number, 1); // OUTPUT
void u8g_SetPinInput(uint8_t internal_pin_number) {
pinMode_LCD(internal_pin_number, 0); // INPUT
}
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status) {
#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
if (pin_status)
LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(pin));
else
LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(pin));
}
uint8_t u8g_GetPinLevel(uint8_t pin) {
#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
return (uint32_t)LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0;
}
#ifdef __cplusplus
}
void u8g_SetPinInput(uint8_t internal_pin_number) {
pinMode_LCD(internal_pin_number, 0); // INPUT
}
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status) {
#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
if (pin_status)
LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(pin));
else
LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(pin));
}
uint8_t u8g_GetPinLevel(uint8_t pin) {
#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
return (uint32_t)LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0;
}
#ifdef __cplusplus
}
#endif
#endif
#endif // TARGET_LPC1768

View File

@ -115,8 +115,8 @@ PWM_map ISR_table[NUM_PWMS] = PWM_MAP_INIT;
#define P1_18_PWM_channel 1 // servo 3
#define P1_20_PWM_channel 2 // servo 0
#define P1_21_PWM_channel 3 // servo 1
#define P2_4_PWM_channel 5 // D9
#define P2_5_PWM_channel 6 // D10
#define P2_04_PWM_channel 5 // D9
#define P2_05_PWM_channel 6 // D10
// used to keep track of which Match Registers have been used and if they will be used by the
// PWM1 module to directly control the pin or will be used to generate an interrupt
@ -138,8 +138,8 @@ void LPC1768_PWM_update_map_MR(void) {
map_MR[1] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P1_20_PWM_channel) ? 1 : 0), P1_20, &LPC_PWM1->MR2, 0, 0, 0 };
map_MR[2] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P1_21_PWM_channel) ? 1 : 0), P1_21, &LPC_PWM1->MR3, 0, 0, 0 };
map_MR[3] = { 0, 0, P_NC, &LPC_PWM1->MR4, 0, 0, 0 };
map_MR[4] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_4_PWM_channel) ? 1 : 0), P2_4, &LPC_PWM1->MR5, 0, 0, 0 };
map_MR[5] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_5_PWM_channel) ? 1 : 0), P2_5, &LPC_PWM1->MR6, 0, 0, 0 };
map_MR[4] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_04_PWM_channel) ? 1 : 0), P2_04, &LPC_PWM1->MR5, 0, 0, 0 };
map_MR[5] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_05_PWM_channel) ? 1 : 0), P2_05, &LPC_PWM1->MR6, 0, 0, 0 };
}
/**
@ -279,19 +279,19 @@ bool LPC1768_PWM_detach_pin(pin_t pin) {
map_MR[P1_18_PWM_channel - 1].PINSEL_bits = 0;
map_MR[P1_18_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM
break;
case P2_4: // D9 FET, PWM1 channel 5 (Pin 9 P2_4 PWM1.5)
LPC_PWM1->PCR &= ~(_BV(8 + P2_4_PWM_channel)); // disable PWM1 module control of this pin
map_MR[P2_4_PWM_channel - 1].PCR_bit = 0;
case P2_04: // D9 FET, PWM1 channel 5 (Pin 9 P2_04 PWM1.5)
LPC_PWM1->PCR &= ~(_BV(8 + P2_04_PWM_channel)); // disable PWM1 module control of this pin
map_MR[P2_04_PWM_channel - 1].PCR_bit = 0;
LPC_PINCON->PINSEL4 &= ~(0x3 << 10); // return pin to general purpose I/O
map_MR[P2_4_PWM_channel - 1].PINSEL_bits = 0;
map_MR[P2_4_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM
map_MR[P2_04_PWM_channel - 1].PINSEL_bits = 0;
map_MR[P2_04_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM
break;
case P2_5: // D10 FET, PWM1 channel 6 (Pin 10 P2_5 PWM1.6)
LPC_PWM1->PCR &= ~(_BV(8 + P2_5_PWM_channel)); // disable PWM1 module control of this pin
map_MR[P2_5_PWM_channel - 1].PCR_bit = 0;
case P2_05: // D10 FET, PWM1 channel 6 (Pin 10 P2_05 PWM1.6)
LPC_PWM1->PCR &= ~(_BV(8 + P2_05_PWM_channel)); // disable PWM1 module control of this pin
map_MR[P2_05_PWM_channel - 1].PCR_bit = 0;
LPC_PINCON->PINSEL4 &= ~(0x3 << 4); // return pin to general purpose I/O
map_MR[P2_5_PWM_channel - 1].PINSEL_bits = 0;
map_MR[P2_5_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM
map_MR[P2_05_PWM_channel - 1].PINSEL_bits = 0;
map_MR[P2_05_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM
break;
default:
break;
@ -333,17 +333,17 @@ bool LPC1768_PWM_write(pin_t pin, uint32_t value) {
case P1_18: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1)
map_MR[P1_18_PWM_channel - 1].PCR_bit = _BV(8 + P1_18_PWM_channel); // enable PWM1 module control of this pin
map_MR[P1_18_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL3;
map_MR[P1_18_PWM_channel - 1].PINSEL_bits = 0x2 << 4; // ISR must do this AFTER setting PCR
map_MR[P1_18_PWM_channel - 1].PINSEL_bits = 0x2 << 4; // ISR must do this AFTER setting PCR
break;
case P2_4: // D9 FET, PWM1 channel 5 (Pin 9 P2_4 PWM1.5)
map_MR[P2_4_PWM_channel - 1].PCR_bit = _BV(8 + P2_4_PWM_channel); // enable PWM1 module control of this pin
map_MR[P2_4_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
map_MR[P2_4_PWM_channel - 1].PINSEL_bits = 0x1 << 8; // ISR must do this AFTER setting PCR
case P2_04: // D9 FET, PWM1 channel 5 (Pin 9 P2_04 PWM1.5)
map_MR[P2_04_PWM_channel - 1].PCR_bit = _BV(8 + P2_04_PWM_channel); // enable PWM1 module control of this pin
map_MR[P2_04_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
map_MR[P2_04_PWM_channel - 1].PINSEL_bits = 0x1 << 8; // ISR must do this AFTER setting PCR
break;
case P2_5: // D10 FET, PWM1 channel 6 (Pin 10 P2_5 PWM1.6)
map_MR[P2_5_PWM_channel - 1].PCR_bit = _BV(8 + P2_5_PWM_channel); // enable PWM1 module control of this pin
map_MR[P2_5_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
map_MR[P2_5_PWM_channel - 1].PINSEL_bits = 0x1 << 10; // ISR must do this AFTER setting PCR
case P2_05: // D10 FET, PWM1 channel 6 (Pin 10 P2_05 PWM1.6)
map_MR[P2_05_PWM_channel - 1].PCR_bit = _BV(8 + P2_05_PWM_channel); // enable PWM1 module control of this pin
map_MR[P2_05_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
map_MR[P2_05_PWM_channel - 1].PINSEL_bits = 0x1 << 10; // ISR must do this AFTER setting PCR
break;
default: // ISR pins
pinMode(pin, OUTPUT); // set pin to output
@ -466,8 +466,8 @@ HAL_PWM_LPC1768_ISR {
if (ISR_table[i].active_flag && !((ISR_table[i].pin == P1_20) ||
(ISR_table[i].pin == P1_21) ||
(ISR_table[i].pin == P1_18) ||
(ISR_table[i].pin == P2_4) ||
(ISR_table[i].pin == P2_5))
(ISR_table[i].pin == P2_04) ||
(ISR_table[i].pin == P2_05))
) {
*ISR_table[i].set_register = ISR_table[i].write_mask; // set pins for all enabled interrupt channels active
}

View File

@ -39,7 +39,7 @@
#include "../../inc/MarlinConfig.h"
#include <stdint.h>
#include <stdarg.h>
#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 "arduino.h"
#include "include/arduino.h"
#include <stdint.h>
//#include "serial.h"
#include <Stream.h>

View File

@ -36,7 +36,7 @@
#define _FASTIO_LPC1768_H
#include <LPC17xx.h>
#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 "arduino.h"
#include "include/arduino.h"
#include "serial.h"
#include "LPC1768_PWM.h"

View File

@ -22,29 +22,53 @@
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "pinmapping.h"
#include "../../gcode/parser.h"
int16_t GET_PIN_MAP_INDEX(pin_t pin) {
const uint8_t pin_port = LPC1768_PIN_PORT(pin),
pin_pin = LPC1768_PIN_PIN(pin);
for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i)
if (LPC1768_PIN_PORT(pin_map[i]) == pin_port && LPC1768_PIN_PIN(pin_map[i]) == pin_pin)
return i;
return -1;
// Get the digital pin for an analog index
pin_t analogInputToDigitalPin(const uint8_t p) {
return (p < COUNT(adc_pin_table) ? adc_pin_table[p] : P_NC);
}
int16_t PARSED_PIN_INDEX(char code, int16_t dval) {
if (parser.seenval(code)) {
int port, pin;
if (sscanf(parser.strval(code), "%d.%d", &port, &pin) == 2)
for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i)
if (LPC1768_PIN_PORT(pin_map[i]) == port && LPC1768_PIN_PIN(pin_map[i]) == pin)
return i;
}
return dval;
// Return the index of a pin number
// The pin number given here is in the form ppp:nnnnn
int16_t GET_PIN_MAP_INDEX(const pin_t pin) {
const uint16_t index = (LPC1768_PIN_PORT(pin) << 5) | LPC1768_PIN_PIN(pin);
return (index < NUM_DIGITAL_PINS && pin_map[index] != P_NC) ? index : -1;
}
#endif // TARGET_LPC1768
// Test whether the pin is valid
bool VALID_PIN(const pin_t p) {
const int16_t ind = GET_PIN_MAP_INDEX(p);
return ind >= 0 && pin_map[ind] >= 0;
}
// Get the analog index for a digital pin
int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) {
return (VALID_PIN(p) ? LPC1768_PIN_ADC(p) : -1);
}
// Test whether the pin is PWM
bool PWM_PIN(const pin_t p) {
return VALID_PIN(p) && LPC1768_PIN_PWM(p);
}
// Test whether the pin is interruptable
bool INTERRUPT_PIN(const pin_t p) {
return VALID_PIN(p) && LPC1768_PIN_INTERRUPT(p);
}
// Get the pin number at the given index
pin_t GET_PIN_MAP_PIN(const int16_t ind) {
return WITHIN(ind, 0, NUM_DIGITAL_PINS - 1) ? pin_map[ind] : P_NC;
}
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
const uint16_t val = (uint16_t)parser.intval(code), port = val / 100, pin = val % 100;
const int16_t ind = (port < (NUM_DIGITAL_PINS >> 5) && (pin < 32))
? GET_PIN_MAP_INDEX(port << 5 | pin) : -2;
return ind > -2 ? ind : dval;
}
#endif // TARGET_LPC1768

View File

@ -20,10 +20,10 @@
*
*/
#ifndef __HAL_PINMAPPING_H__
#define __HAL_PINMAPPING_H__
#ifndef _PINMAPPING_H_
#define _PINMAPPING_H_
#include "../../core/macros.h"
#include "../../inc/MarlinConfigPre.h"
#include <stdint.h>
@ -94,6 +94,7 @@ typedef int16_t pin_t;
#define INTERRUPT(b) BOOL_(b)
#define PWM(b) BOOL_(b)
// Combine elements into pin bits: 0b00AAAAWIPPPNNNNN
#define LPC1768_PIN_(port, pin, int, pwm, adc) 0b00##adc##pwm##int##port##pin
#define LPC1768_PIN(port, pin, int, pwm, adc) LPC1768_PIN_(port, pin, int, pwm, adc)
@ -106,178 +107,176 @@ constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10)
// ******************
// Runtime pinmapping
// ******************
#define P_NC -1
#define P_NC -1
#if SERIAL_PORT != 3
#define P0_0 LPC1768_PIN(PORT(0), PIN(0), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_1 LPC1768_PIN(PORT(0), PIN(1), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_00 LPC1768_PIN(PORT(0), PIN( 0), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_01 LPC1768_PIN(PORT(0), PIN( 1), INTERRUPT(1), PWM(0), ADC_NONE)
#endif
#if SERIAL_PORT != 0
#define P0_2 LPC1768_PIN(PORT(0), PIN(2), INTERRUPT(1), PWM(0), ADC_CHAN(7))
#define P0_3 LPC1768_PIN(PORT(0), PIN(3), INTERRUPT(1), PWM(0), ADC_CHAN(6))
#define P0_02 LPC1768_PIN(PORT(0), PIN( 2), INTERRUPT(1), PWM(0), ADC_CHAN(7))
#define P0_03 LPC1768_PIN(PORT(0), PIN( 3), INTERRUPT(1), PWM(0), ADC_CHAN(6))
#endif
#define P0_4 LPC1768_PIN(PORT(0), PIN(4), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_5 LPC1768_PIN(PORT(0), PIN(5), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_6 LPC1768_PIN(PORT(0), PIN(6), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_7 LPC1768_PIN(PORT(0), PIN(7), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_8 LPC1768_PIN(PORT(0), PIN(8), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_9 LPC1768_PIN(PORT(0), PIN(9), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_04 LPC1768_PIN(PORT(0), PIN( 4), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_05 LPC1768_PIN(PORT(0), PIN( 5), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_06 LPC1768_PIN(PORT(0), PIN( 6), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_07 LPC1768_PIN(PORT(0), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_08 LPC1768_PIN(PORT(0), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_09 LPC1768_PIN(PORT(0), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE)
#if SERIAL_PORT != 2
#define P0_10 LPC1768_PIN(PORT(0), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_11 LPC1768_PIN(PORT(0), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_10 LPC1768_PIN(PORT(0), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_11 LPC1768_PIN(PORT(0), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
#endif
#if SERIAL_PORT != 1
#define P0_15 LPC1768_PIN(PORT(0), PIN(15), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_16 LPC1768_PIN(PORT(0), PIN(16), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_15 LPC1768_PIN(PORT(0), PIN(15), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_16 LPC1768_PIN(PORT(0), PIN(16), INTERRUPT(1), PWM(0), ADC_NONE)
#endif
#define P0_17 LPC1768_PIN(PORT(0), PIN(17), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_18 LPC1768_PIN(PORT(0), PIN(18), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_19 LPC1768_PIN(PORT(0), PIN(19), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_20 LPC1768_PIN(PORT(0), PIN(20), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_21 LPC1768_PIN(PORT(0), PIN(21), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_22 LPC1768_PIN(PORT(0), PIN(22), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_23 LPC1768_PIN(PORT(0), PIN(23), INTERRUPT(1), PWM(0), ADC_CHAN(0))
#define P0_24 LPC1768_PIN(PORT(0), PIN(24), INTERRUPT(1), PWM(0), ADC_CHAN(1))
#define P0_25 LPC1768_PIN(PORT(0), PIN(25), INTERRUPT(1), PWM(0), ADC_CHAN(2))
#define P0_26 LPC1768_PIN(PORT(0), PIN(26), INTERRUPT(1), PWM(0), ADC_CHAN(3))
#define P0_27 LPC1768_PIN(PORT(0), PIN(27), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_28 LPC1768_PIN(PORT(0), PIN(28), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_29 LPC1768_PIN(PORT(0), PIN(29), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_30 LPC1768_PIN(PORT(0), PIN(30), INTERRUPT(1), PWM(0), ADC_NONE)
#define P1_0 LPC1768_PIN(PORT(1), PIN(0), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_1 LPC1768_PIN(PORT(1), PIN(1), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_4 LPC1768_PIN(PORT(1), PIN(4), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_8 LPC1768_PIN(PORT(1), PIN(8), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_9 LPC1768_PIN(PORT(1), PIN(9), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_10 LPC1768_PIN(PORT(1), PIN(10), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_14 LPC1768_PIN(PORT(1), PIN(14), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_15 LPC1768_PIN(PORT(1), PIN(15), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_16 LPC1768_PIN(PORT(1), PIN(16), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_17 LPC1768_PIN(PORT(1), PIN(17), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_18 LPC1768_PIN(PORT(1), PIN(18), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_19 LPC1768_PIN(PORT(1), PIN(19), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_20 LPC1768_PIN(PORT(1), PIN(20), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_21 LPC1768_PIN(PORT(1), PIN(21), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_22 LPC1768_PIN(PORT(1), PIN(22), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_23 LPC1768_PIN(PORT(1), PIN(23), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_24 LPC1768_PIN(PORT(1), PIN(24), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_25 LPC1768_PIN(PORT(1), PIN(25), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_26 LPC1768_PIN(PORT(1), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_27 LPC1768_PIN(PORT(1), PIN(27), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_28 LPC1768_PIN(PORT(1), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_29 LPC1768_PIN(PORT(1), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_30 LPC1768_PIN(PORT(1), PIN(30), INTERRUPT(0), PWM(0), ADC_CHAN(4))
#define P1_31 LPC1768_PIN(PORT(1), PIN(31), INTERRUPT(0), PWM(0), ADC_CHAN(5))
#define P2_0 LPC1768_PIN(PORT(2), PIN(0), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_1 LPC1768_PIN(PORT(2), PIN(1), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_2 LPC1768_PIN(PORT(2), PIN(2), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_3 LPC1768_PIN(PORT(2), PIN(3), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_4 LPC1768_PIN(PORT(2), PIN(4), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_5 LPC1768_PIN(PORT(2), PIN(5), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_6 LPC1768_PIN(PORT(2), PIN(6), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_7 LPC1768_PIN(PORT(2), PIN(7), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_8 LPC1768_PIN(PORT(2), PIN(8), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_9 LPC1768_PIN(PORT(2), PIN(9), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_10 LPC1768_PIN(PORT(2), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_11 LPC1768_PIN(PORT(2), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_12 LPC1768_PIN(PORT(2), PIN(12), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_13 LPC1768_PIN(PORT(2), PIN(13), INTERRUPT(1), PWM(0), ADC_NONE)
#define P3_25 LPC1768_PIN(PORT(3), PIN(25), INTERRUPT(0), PWM(1), ADC_NONE)
#define P3_26 LPC1768_PIN(PORT(3), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
#define P4_28 LPC1768_PIN(PORT(4), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
#define P4_29 LPC1768_PIN(PORT(4), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
#define P0_17 LPC1768_PIN(PORT(0), PIN(17), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_18 LPC1768_PIN(PORT(0), PIN(18), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_19 LPC1768_PIN(PORT(0), PIN(19), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_20 LPC1768_PIN(PORT(0), PIN(20), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_21 LPC1768_PIN(PORT(0), PIN(21), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_22 LPC1768_PIN(PORT(0), PIN(22), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_23 LPC1768_PIN(PORT(0), PIN(23), INTERRUPT(1), PWM(0), ADC_CHAN(0))
#define P0_24 LPC1768_PIN(PORT(0), PIN(24), INTERRUPT(1), PWM(0), ADC_CHAN(1))
#define P0_25 LPC1768_PIN(PORT(0), PIN(25), INTERRUPT(1), PWM(0), ADC_CHAN(2))
#define P0_26 LPC1768_PIN(PORT(0), PIN(26), INTERRUPT(1), PWM(0), ADC_CHAN(3))
#define P0_27 LPC1768_PIN(PORT(0), PIN(27), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_28 LPC1768_PIN(PORT(0), PIN(28), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_29 LPC1768_PIN(PORT(0), PIN(29), INTERRUPT(1), PWM(0), ADC_NONE)
#define P0_30 LPC1768_PIN(PORT(0), PIN(30), INTERRUPT(1), PWM(0), ADC_NONE)
#define P1_00 LPC1768_PIN(PORT(1), PIN( 0), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_01 LPC1768_PIN(PORT(1), PIN( 1), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_04 LPC1768_PIN(PORT(1), PIN( 4), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_08 LPC1768_PIN(PORT(1), PIN( 8), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_09 LPC1768_PIN(PORT(1), PIN( 9), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_10 LPC1768_PIN(PORT(1), PIN(10), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_14 LPC1768_PIN(PORT(1), PIN(14), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_15 LPC1768_PIN(PORT(1), PIN(15), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_16 LPC1768_PIN(PORT(1), PIN(16), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_17 LPC1768_PIN(PORT(1), PIN(17), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_18 LPC1768_PIN(PORT(1), PIN(18), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_19 LPC1768_PIN(PORT(1), PIN(19), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_20 LPC1768_PIN(PORT(1), PIN(20), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_21 LPC1768_PIN(PORT(1), PIN(21), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_22 LPC1768_PIN(PORT(1), PIN(22), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_23 LPC1768_PIN(PORT(1), PIN(23), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_24 LPC1768_PIN(PORT(1), PIN(24), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_25 LPC1768_PIN(PORT(1), PIN(25), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_26 LPC1768_PIN(PORT(1), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
#define P1_27 LPC1768_PIN(PORT(1), PIN(27), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_28 LPC1768_PIN(PORT(1), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_29 LPC1768_PIN(PORT(1), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
#define P1_30 LPC1768_PIN(PORT(1), PIN(30), INTERRUPT(0), PWM(0), ADC_CHAN(4))
#define P1_31 LPC1768_PIN(PORT(1), PIN(31), INTERRUPT(0), PWM(0), ADC_CHAN(5))
#define P2_00 LPC1768_PIN(PORT(2), PIN( 0), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_01 LPC1768_PIN(PORT(2), PIN( 1), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_02 LPC1768_PIN(PORT(2), PIN( 2), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_03 LPC1768_PIN(PORT(2), PIN( 3), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_04 LPC1768_PIN(PORT(2), PIN( 4), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_05 LPC1768_PIN(PORT(2), PIN( 5), INTERRUPT(1), PWM(1), ADC_NONE)
#define P2_06 LPC1768_PIN(PORT(2), PIN( 6), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_07 LPC1768_PIN(PORT(2), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_08 LPC1768_PIN(PORT(2), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_09 LPC1768_PIN(PORT(2), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_10 LPC1768_PIN(PORT(2), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_11 LPC1768_PIN(PORT(2), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_12 LPC1768_PIN(PORT(2), PIN(12), INTERRUPT(1), PWM(0), ADC_NONE)
#define P2_13 LPC1768_PIN(PORT(2), PIN(13), INTERRUPT(1), PWM(0), ADC_NONE)
#define P3_25 LPC1768_PIN(PORT(3), PIN(25), INTERRUPT(0), PWM(1), ADC_NONE)
#define P3_26 LPC1768_PIN(PORT(3), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
#define P4_28 LPC1768_PIN(PORT(4), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
#define P4_29 LPC1768_PIN(PORT(4), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
constexpr bool VALID_PIN(const pin_t p) {
return (
#if SERIAL_PORT == 0
(LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 1) ||
(LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 4, 11)) ||
#elif SERIAL_PORT == 2
(LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 9) ||
#elif SERIAL_PORT == 3
(LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 2, 11)) ||
#else
(LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 11) ||
#endif
#if SERIAL_PORT == 1
(LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 17, 30)) ||
#else
(LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 15, 30)) ||
#endif
(LPC1768_PIN_PORT(p) == 1 && LPC1768_PIN_PIN(p) == 1) ||
(LPC1768_PIN_PORT(p) == 1 && LPC1768_PIN_PIN(p) == 4) ||
(LPC1768_PIN_PORT(p) == 1 && WITHIN(LPC1768_PIN_PIN(p), 8, 10)) ||
(LPC1768_PIN_PORT(p) == 1 && WITHIN(LPC1768_PIN_PIN(p), 14, 31)) ||
(LPC1768_PIN_PORT(p) == 2 && LPC1768_PIN_PIN(p) <= 13) ||
(LPC1768_PIN_PORT(p) == 3 && WITHIN(LPC1768_PIN_PIN(p), 25, 26)) ||
(LPC1768_PIN_PORT(p) == 4 && WITHIN(LPC1768_PIN_PIN(p), 28, 29))
);
}
// Pin index for M43 and M226
constexpr pin_t pin_map[] = {
#if SERIAL_PORT != 3
P0_00, P0_01,
#else
P_NC, P_NC,
#endif
#if SERIAL_PORT != 0
P0_02, P0_03,
#else
P_NC, P_NC,
#endif
P0_04, P0_05, P0_06, P0_07,
P0_08, P0_09,
#if SERIAL_PORT != 2
P0_10, P0_11,
#else
P_NC, P_NC,
#endif
P_NC, P_NC, P_NC,
#if SERIAL_PORT != 1
P0_15,
P0_16,
#else
P_NC,
P_NC,
#endif
P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23,
P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P_NC,
constexpr bool PWM_PIN(const pin_t p) {
return (VALID_PIN(p) && LPC1768_PIN_PWM(p));
}
P1_00, P1_01, P_NC, P_NC, P1_04, P_NC, P_NC, P_NC,
P1_08, P1_09, P1_10, P_NC, P_NC, P_NC, P1_14, P1_15,
P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23,
P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
constexpr bool INTERRUPT_PIN(const pin_t p) {
return (VALID_PIN(p) && LPC1768_PIN_INTERRUPT(p));
}
P2_00, P2_01, P2_02, P2_03, P2_04, P2_05, P2_06, P2_07,
P2_08, P2_09, P2_10, P2_11, P2_12, P2_13, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
#if SERIAL_PORT == 0
#define NUM_ANALOG_INPUTS 6
#else
#define NUM_ANALOG_INPUTS 8
#endif
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P3_25, P3_26, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC,
P_NC, P_NC, P_NC, P_NC, P4_28, P4_29, P_NC, P_NC
};
constexpr int16_t NUM_DIGITAL_PINS = COUNT(pin_map);
constexpr pin_t adc_pin_table[] = {
P0_23, P0_24, P0_25, P0_26, P1_30, P1_31,
#if SERIAL_PORT != 0
P0_3, P0_2
P0_03, P0_02
#endif
};
constexpr pin_t analogInputToDigitalPin(const uint8_t p) {
return (p < COUNT(adc_pin_table) ? adc_pin_table[p] : P_NC);
}
constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) {
return (VALID_PIN(p) ? LPC1768_PIN_ADC(p) : -1);
}
constexpr int16_t NUM_ANALOG_INPUTS = COUNT(adc_pin_table);
// P0.6 thru P0.9 are for the onboard SD card
// P0.29 and P0.30 are for the USB port
#define HAL_SENSITIVE_PINS P0_6, P0_7, P0_8, P0_9, P0_29, P0_30
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09, P0_29, P0_30
// Pin map for M43 and M226
const pin_t pin_map[] = {
#if SERIAL_PORT != 3
P0_0, P0_1,
#endif
#if SERIAL_PORT != 0
P0_2, P0_3,
#endif
P0_4, P0_5, P0_6, P0_7, P0_8, P0_9,
#if SERIAL_PORT != 2
P0_10, P0_11,
#endif
#if SERIAL_PORT != 1
P0_15, P0_16,
#endif
P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24,
P0_25, P0_26, P0_27, P0_28, P0_29, P0_30,
P1_0, P1_1, P1_4, P1_8, P1_9, P1_10, P1_14, P1_15,
P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23,
P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7,
P2_8, P2_9, P2_10, P2_11, P2_12, P2_13,
P3_25, P3_26,
P4_28, P4_29
};
// Get the digital pin for an analog index
pin_t analogInputToDigitalPin(const uint8_t p);
#define NUM_DIGITAL_PINS COUNT(pin_map)
// Return the index of a pin number
// The pin number given here is in the form ppp:nnnnn
int16_t GET_PIN_MAP_INDEX(const pin_t pin);
#define GET_PIN_MAP_PIN(i) (WITHIN(i, 0, (int)NUM_DIGITAL_PINS - 1) ? pin_map[i] : -1)
// Test whether the pin is valid
bool VALID_PIN(const pin_t p);
int16_t GET_PIN_MAP_INDEX(pin_t pin);
int16_t PARSED_PIN_INDEX(char code, int16_t dval = 0);
// Get the analog index for a digital pin
int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p);
#endif // __HAL_PINMAPPING_H__
// Test whether the pin is PWM
bool PWM_PIN(const pin_t p);
// Test whether the pin is interruptable
bool INTERRUPT_PIN(const pin_t p);
// Get the pin number at the given index
pin_t GET_PIN_MAP_PIN(const int16_t ind);
// Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
#endif // _PINMAPPING_H_

View File

@ -26,10 +26,10 @@
#define LPC_SOFTWARE_SPI
/** onboard SD card */
//#define SCK_PIN P0_7
//#define MISO_PIN P0_8
//#define MOSI_PIN P0_9
//#define SS_PIN P0_6
//#define SCK_PIN P0_07
//#define MISO_PIN P0_08
//#define MOSI_PIN P0_09
//#define SS_PIN P0_06
/** external */
#define SCK_PIN P0_15
#define MISO_PIN P0_17

View File

@ -28,11 +28,9 @@
* M42: Change pin status via GCode
*
* P<pin> Pin number (LED if omitted)
* For LPC1768 use M42 P1.20 S255 if wanting to set P1_20 to logic 1
* NOTE - Repetier Host truncates trailing zeros on a decimal when
* sending commands so typing M42 P1.20 S255 results in
* M42 P1.2 S255 being sent. Pronterface doesn't have this issue.
*
* For LPC1768 specify pin P1_02 as M42 P102,
* P1_20 as M42 P120, etc.
*
* S<byte> Pin status from 0 - 255
*/
void GcodeSuite::M42() {

View File

@ -23,13 +23,8 @@
#ifndef MARLIN_CONFIG_H
#define MARLIN_CONFIG_H
#include "../core/boards.h"
#include "../core/macros.h"
#include "Version.h"
#include "../../Configuration.h"
#include "Conditionals_LCD.h"
#include "../../Configuration_adv.h"
#include "Conditionals_adv.h"
#include "MarlinConfigPre.h"
#include "../HAL/HAL.h"
#include "../pins/pins.h"
#if defined(__AVR__) && !defined(USBCON)

View File

@ -0,0 +1,34 @@
/**
* 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/>.
*
*/
#ifndef MARLIN_CONFIGPRE_H
#define MARLIN_CONFIGPRE_H
#include "../core/boards.h"
#include "../core/macros.h"
#include "Version.h"
#include "../../Configuration.h"
#include "Conditionals_LCD.h"
#include "../../Configuration_adv.h"
#include "Conditionals_adv.h"
#endif // MARLIN_CONFIGPRE_H

View File

@ -23,12 +23,12 @@
#ifndef _VERSION_H_
#define _VERSION_H_
#include "MarlinConfig.h"
#include "../core/macros.h" // for ENABLED
/**
* This file is the standard Marlin version identifier file, all fields can be
* overriden by the ones defined in _Version.h by using the Configuration.h
* directive USE_AUTOMATIC_VERSIONING.
* This file is the standard Marlin version identifier file.
* Use -DUSE_AUTOMATIC_VERSIONING=1 and a custom _Version.h
* to override these values.
*/
#if ENABLED(USE_AUTOMATIC_VERSIONING)

View File

@ -721,7 +721,7 @@
#endif
#ifndef HAL_SENSITIVE_PINS
#define HAL_SENSITIVE_PINS
#define HAL_SENSITIVE_PINS
#endif
#define SENSITIVE_PINS { \

View File

@ -43,7 +43,7 @@
#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
#include "pinsDebug_list.h"
#line 49
#line 47
// manually add pins that have names that are macros which don't play well with these macros
#if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
@ -95,7 +95,7 @@ const PinInfo pin_array[] PROGMEM = {
#endif
#include "pinsDebug_list.h"
#line 101
#line 99
};

View File

@ -48,23 +48,23 @@
//
// Steppers
//
#define X_STEP_PIN P2_0
#define X_DIR_PIN P0_5
#define X_ENABLE_PIN P0_4
#define X_STEP_PIN P2_00
#define X_DIR_PIN P0_05
#define X_ENABLE_PIN P0_04
#define Y_STEP_PIN P2_1
#define Y_STEP_PIN P2_01
#define Y_DIR_PIN P0_11
#define Y_ENABLE_PIN P0_10
#define Z_STEP_PIN P2_2
#define Z_STEP_PIN P2_02
#define Z_DIR_PIN P0_20
#define Z_ENABLE_PIN P0_19
#define E0_STEP_PIN P2_3
#define E0_STEP_PIN P2_03
#define E0_DIR_PIN P0_22
#define E0_ENABLE_PIN P0_21
#define E1_STEP_PIN P2_8
#define E1_STEP_PIN P2_08
#define E1_DIR_PIN P2_13
#define E1_ENABLE_PIN P4_29
@ -80,14 +80,14 @@
// Heaters / Fans
//
// EFB
#define HEATER_0_PIN P2_4
#define HEATER_BED_PIN P2_5
#define FAN_PIN P2_7
#define HEATER_0_PIN P2_04
#define HEATER_BED_PIN P2_05
#define FAN_PIN P2_07
#define FAN1_PIN P0_26
#if ENABLED(AZSMZ_12864)
#define BEEPER_PIN P1_30
#define DOGLCD_A0 P2_6
#define DOGLCD_A0 P2_06
#define DOGLCD_CS P1_22
#define BTN_EN1 P4_28
#define BTN_EN2 P1_27
@ -104,11 +104,11 @@
#define ENET_RXD1 P1_10
#define ENET_MOC P1_16
#define REF_CLK P1_15
#define ENET_RXD0 P1_9
#define ENET_CRS P1_8
#define ENET_TX_EN P1_4
#define ENET_TXD0 P1_0
#define ENET_TXD1 P1_1
#define ENET_RXD0 P1_09
#define ENET_CRS P1_08
#define ENET_TX_EN P1_04
#define ENET_TXD0 P1_00
#define ENET_TXD1 P1_01
/**
* PWMs

View File

@ -49,23 +49,23 @@
//
// Steppers
//
#define X_STEP_PIN P2_1
#define X_STEP_PIN P2_01
#define X_DIR_PIN P0_11
#define X_ENABLE_PIN P0_10
#define Y_STEP_PIN P2_2
#define Y_STEP_PIN P2_02
#define Y_DIR_PIN P0_20
#define Y_ENABLE_PIN P0_19
#define Z_STEP_PIN P2_3
#define Z_STEP_PIN P2_03
#define Z_DIR_PIN P0_22
#define Z_ENABLE_PIN P0_21
#define E0_STEP_PIN P2_0
#define E0_DIR_PIN P0_5
#define E0_ENABLE_PIN P0_4
#define E0_STEP_PIN P2_00
#define E0_DIR_PIN P0_05
#define E0_ENABLE_PIN P0_04
#define E1_STEP_PIN P2_8
#define E1_STEP_PIN P2_08
#define E1_DIR_PIN P2_13
#define E1_ENABLE_PIN P4_29
@ -82,9 +82,9 @@
// Heaters / Fans
//
#define HEATER_BED_PIN P2_7
#define HEATER_0_PIN P2_4
#define HEATER_1_PIN P2_5
#define HEATER_BED_PIN P2_07
#define HEATER_0_PIN P2_04
#define HEATER_1_PIN P2_05
#define FAN_PIN P0_26
#define FAN1_PIN P1_22
@ -94,7 +94,7 @@
#if ENABLED(VIKI2) || ENABLED(miniVIKI)
#define BEEPER_PIN P1_30
#define DOGLCD_A0 P2_6
#define DOGLCD_A0 P2_06
#define DOGLCD_CS P0_16
#define BTN_EN1 P3_25

View File

@ -53,23 +53,23 @@
//
// Steppers
//
#define X_STEP_PIN P2_0
#define X_DIR_PIN P0_5
#define X_ENABLE_PIN P0_4
#define X_STEP_PIN P2_00
#define X_DIR_PIN P0_05
#define X_ENABLE_PIN P0_04
#define Y_STEP_PIN P2_1
#define Y_STEP_PIN P2_01
#define Y_DIR_PIN P0_11
#define Y_ENABLE_PIN P0_10
#define Z_STEP_PIN P2_2
#define Z_STEP_PIN P2_02
#define Z_DIR_PIN P0_20
#define Z_ENABLE_PIN P0_19
#define E0_STEP_PIN P2_3
#define E0_STEP_PIN P2_03
#define E0_DIR_PIN P0_22
#define E0_ENABLE_PIN P0_21
#define E1_STEP_PIN P2_8
#define E1_STEP_PIN P2_08
#define E1_DIR_PIN P2_13
#define E1_ENABLE_PIN P4_29
@ -88,10 +88,10 @@
// Heaters / Fans
//
#define HEATER_BED_PIN P2_5
#define HEATER_0_PIN P2_7
#define HEATER_1_PIN P2_6
#define FAN_PIN P2_4
#define HEATER_BED_PIN P2_05
#define HEATER_0_PIN P2_07
#define HEATER_1_PIN P2_06
#define FAN_PIN P2_04
#define PS_ON_PIN P0_25
@ -166,11 +166,11 @@
#endif
#define ENET_MOC P1_16 // J12-3
#define REF_CLK P1_15 // J12-5
#define ENET_RXD0 P1_9 // J12-7
#define ENET_CRS P1_8 // J12-9
#define ENET_TX_EN P1_4 // J12-10
#define ENET_TXD0 P1_0 // J12-11
#define ENET_TXD1 P1_1 // J12-12
#define ENET_RXD0 P1_09 // J12-7
#define ENET_CRS P1_08 // J12-9
#define ENET_TX_EN P1_04 // J12-10
#define ENET_TXD0 P1_00 // J12-11
#define ENET_TXD1 P1_01 // J12-12
/**
* PWMs
@ -180,17 +180,17 @@
* SERVO2 does NOT have a PWM assigned to it.
*
* PWM1.1 P1_18 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM
* PWM1.1 P2_0 E0_STEP_PIN
* PWM1.1 P2_00 E0_STEP_PIN
* PWM1.2 P1_20 SERVO0_PIN
* PWM1.2 P2_1 X_STEP_PIN
* PWM1.2 P2_01 X_STEP_PIN
* PWM1.3 P1_21 SERVO1_PIN J5-1
* PWM1.3 P2_2 Y_STEP_PIN
* PWM1.3 P2_02 Y_STEP_PIN
* PWM1.4 P1_23 SDSS(SSEL0) J3-5 AUX-3
* PWM1.4 P2_3 Z_STEP_PIN
* PWM1.4 P2_03 Z_STEP_PIN
* PWM1.5 P1_24 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES
* PWM1.5 P2_4 RAMPS_D9_PIN
* PWM1.5 P2_04 RAMPS_D9_PIN
* PWM1.6 P1_26 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES
* PWM1.6 P2_5 RAMPS_D10_PIN
* PWM1.6 P2_05 RAMPS_D10_PIN
*/
/**

View File

@ -65,27 +65,27 @@
//
// Steppers
//
#define X_STEP_PIN P2_1 // (54)
#define X_STEP_PIN P2_01 // (54)
#define X_DIR_PIN P0_11 // (55)
#define X_ENABLE_PIN P0_10 // (38)
#define Y_STEP_PIN P2_2 // (60)
#define Y_STEP_PIN P2_02 // (60)
#define Y_DIR_PIN P0_20 // (61)
#define Y_ENABLE_PIN P0_19 // (56)
#define Z_STEP_PIN P2_3 // (46)
#define Z_STEP_PIN P2_03 // (46)
#define Z_DIR_PIN P0_22 // (48)
#define Z_ENABLE_PIN P0_21 // (62)
#define E0_STEP_PIN P2_0 // (26)
#define E0_DIR_PIN P0_5 // (28)
#define E0_ENABLE_PIN P0_4 // (24)
#define E0_STEP_PIN P2_00 // (26)
#define E0_DIR_PIN P0_05 // (28)
#define E0_ENABLE_PIN P0_04 // (24)
#define E1_STEP_PIN P2_8 // (36)
#define E1_STEP_PIN P2_08 // (36)
#define E1_DIR_PIN P2_13 // (34)
#define E1_ENABLE_PIN P4_29 // (30)
#define E2_STEP_PIN P2_8 // (36)
#define E2_STEP_PIN P2_08 // (36)
#define E2_DIR_PIN P2_13 // (34)
#define E2_ENABLE_PIN P4_29 // (30)
@ -127,13 +127,13 @@
#define MOSFET_D_PIN -1
#endif
#ifndef RAMPS_D8_PIN
#define RAMPS_D8_PIN P2_7 // (8)
#define RAMPS_D8_PIN P2_07 // (8)
#endif
#ifndef RAMPS_D9_PIN
#define RAMPS_D9_PIN P2_4 // (9)
#define RAMPS_D9_PIN P2_04 // (9)
#endif
#ifndef RAMPS_D10_PIN
#define RAMPS_D10_PIN P2_5 // (10)
#define RAMPS_D10_PIN P2_05 // (10)
#endif
#define HEATER_0_PIN RAMPS_D10_PIN
@ -198,8 +198,8 @@
//
// Průša i3 MK2 Multiplexer Support
//
#define E_MUX0_PIN P0_3 // ( 0) Z_CS_PIN
#define E_MUX1_PIN P0_2 // ( 1) E0_CS_PIN
#define E_MUX0_PIN P0_03 // ( 0) Z_CS_PIN
#define E_MUX1_PIN P0_02 // ( 1) E0_CS_PIN
#define E_MUX2_PIN P0_26 // (63) E1_CS_PIN
/**
@ -237,7 +237,7 @@
#define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3
#define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3
#define DOGLCD_A0 P2_6 // (59) J3-8 & AUX-2
#define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2
#define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2
#ifdef ULTIPANEL
@ -278,8 +278,8 @@
#undef LCD_PINS_ENABLE //P0_18 // (51) (MOSI) J3-10 & AUX-3
#undef LCD_PINS_D4 //P0_15 // (52) (SCK) J3-9 & AUX-3
#undef LCD_PINS_D5 //P2_6 // (59) J3-8 & AUX-2
#define DOGLCD_A0 P2_6 // (59) J3-8 & AUX-2
#undef LCD_PINS_D5 //P2_06 // (59) J3-8 & AUX-2
#define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2
#undef LCD_PINS_D6 //P0_26 // (63) J5-3 & AUX-2
#undef LCD_PINS_D7 //P1_21 // ( 6) (SERVO1) J5-1 & SERVO connector
#define DOGLCD_SCK SCK_PIN
@ -315,11 +315,11 @@
#endif
#define ENET_MOC P1_16 // (70) J12-3
#define REF_CLK P1_15 // (72) J12-5
#define ENET_RXD0 P1_9 // (74) J12-7
#define ENET_CRS P1_8 // (76) J12-9
#define ENET_TX_EN P1_4 // (77) J12-10
#define ENET_TXD0 P1_0 // (78) J12-11
#define ENET_TXD1 P1_1 // (79) J12-12
#define ENET_RXD0 P1_09 // (74) J12-7
#define ENET_CRS P1_08 // (76) J12-9
#define ENET_TX_EN P1_04 // (77) J12-10
#define ENET_TXD0 P1_00 // (78) J12-11
#define ENET_TXD1 P1_01 // (79) J12-12
/**
* Fast PWMS
@ -339,8 +339,8 @@
* P1_20 (11) SERVO0_PIN
* P1_21 ( 6) SERVO1_PIN J5-1
* P0_18 ( 4) SERVO3_PIN 5V output
* *P2_4 ( 9) RAMPS_D9_PIN
* *P2_5 (10) RAMPS_D10_PIN
* *P2_04 ( 9) RAMPS_D9_PIN
* *P2_05 (10) RAMPS_D10_PIN
*
* * - If used as a heater driver then a Fast PWM is NOT assigned. If used as
* a fan driver then enabling FAST_PWM_FAN assigns a Fast PWM to it.
@ -375,4 +375,4 @@
* 64
* 65
* 66
*/
*/

View File

@ -10,7 +10,7 @@
void setup() {
Serial.begin(9600);
Serial.println("PINs causing interrups are:");
Serial.println("PINs causing interrupts are:");
for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {