Skip to content

Commit

Permalink
More pin names
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 13, 2021
1 parent d75e795 commit 594c685
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 61 deletions.
10 changes: 5 additions & 5 deletions Marlin/src/HAL/DUE/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,13 @@
SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS);
SPI_Enable(SPI0);

SET_OUTPUT(DAC0_SYNC);
SET_OUTPUT(DAC0_SYNC_PIN);
#if HAS_MULTI_EXTRUDER
OUT_WRITE(DAC1_SYNC, HIGH);
OUT_WRITE(DAC1_SYNC_PIN, HIGH);
#endif
WRITE(DAC0_SYNC, HIGH);
OUT_WRITE(SPI_EEPROM1_CS, HIGH);
OUT_WRITE(SPI_EEPROM2_CS, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
OUT_WRITE(SPI_EEPROM1_CS_PIN, HIGH);
OUT_WRITE(SPI_EEPROM2_CS_PIN, HIGH);
OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SD_SS_PIN, HIGH);

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/eeprom_wired.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool PersistentStore::access_start() {
SET_OUTPUT(BOARD_SPI1_SCK_PIN);
SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
SET_INPUT(BOARD_SPI1_MISO_PIN);
SET_OUTPUT(SPI_EEPROM1_CS);
SET_OUTPUT(SPI_EEPROM1_CS_PIN);
#endif
spiInit(0);
#endif
Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/HAL/shared/eeprom_if_spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ static void _eeprom_begin(uint8_t * const pos, const uint8_t cmd) {
(unsigned(pos) >> 8) & 0xFF, // Address High
unsigned(pos) & 0xFF // Address Low
};
WRITE(SPI_EEPROM1_CS, HIGH); // Usually free already
WRITE(SPI_EEPROM1_CS, LOW); // Activate the Bus
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Usually free already
WRITE(SPI_EEPROM1_CS_PIN, LOW); // Activate the Bus
spiSend(SPI_CHAN_EEPROM1, eeprom_temp, 3);
// Leave the Bus in-use
}
Expand All @@ -60,23 +60,23 @@ uint8_t eeprom_read_byte(uint8_t *pos) {

const uint8_t v = spiRec(SPI_CHAN_EEPROM1); // After READ a value sits on the Bus

WRITE(SPI_EEPROM1_CS, HIGH); // Done with device
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with device

return v;
}

void eeprom_write_byte(uint8_t *pos, uint8_t value) {
const uint8_t eeprom_temp = CMD_WREN;
WRITE(SPI_EEPROM1_CS, LOW);
WRITE(SPI_EEPROM1_CS_PIN, LOW);
spiSend(SPI_CHAN_EEPROM1, &eeprom_temp, 1); // Write Enable

WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus
delay(1); // For a small amount of time

_eeprom_begin(pos, CMD_WRITE); // Set write address and begin transmission

spiSend(SPI_CHAN_EEPROM1, value); // Send the value to be written
WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus
delay(EEPROM_WRITE_DELAY); // Give page write time to complete
}

Expand Down
40 changes: 20 additions & 20 deletions Marlin/src/feature/dac/dac_dac084s085.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@ void dac084s085::begin() {
uint8_t externalDac_buf[] = { 0x20, 0x00 }; // all off

// All SPI chip-select HIGH
SET_OUTPUT(DAC0_SYNC);
SET_OUTPUT(DAC0_SYNC_PIN);
#if HAS_MULTI_EXTRUDER
SET_OUTPUT(DAC1_SYNC);
SET_OUTPUT(DAC1_SYNC_PIN);
#endif
cshigh();
spiBegin();

//init onboard DAC
DELAY_US(2);
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);

spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);

#if HAS_MULTI_EXTRUDER
//init Piggy DAC
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);

spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
#endif

return;
Expand All @@ -66,31 +66,31 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
cshigh();

if (channel > 3) { // DAC Piggy E1,E2,E3
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
}
else { // DAC onboard X,Y,Z,E0
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
}

DELAY_US(2);
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
}

void dac084s085::cshigh() {
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
#if HAS_MULTI_EXTRUDER
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
#endif
WRITE(SPI_EEPROM1_CS, HIGH);
WRITE(SPI_EEPROM2_CS, HIGH);
WRITE(SPI_EEPROM1_CS_PIN, HIGH);
WRITE(SPI_EEPROM2_CS_PIN, HIGH);
WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SD_SS_PIN, HIGH);
}
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/pins/pinsDebug_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@
#if PIN_EXISTS(DAC_DISABLE)
REPORT_NAME_DIGITAL(__LINE__, DAC_DISABLE_PIN)
#endif
#if defined(DAC0_SYNC) && DAC0_SYNC >= 0
REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC)
#if PIN_EXISTS(DAC0_SYNC)
REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC_PIN)
#endif
#if defined(DAC1_SYNC) && DAC1_SYNC >= 0
REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC)
#if PIN_EXISTS(DAC1_SYNC)
REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC_PIN)
#endif
#if PIN_EXISTS(DEBUG)
REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN)
Expand Down Expand Up @@ -974,11 +974,11 @@
#if defined(SPARE_IO) && SPARE_IO >= 0
REPORT_NAME_DIGITAL(__LINE__, SPARE_IO)
#endif
#if defined(SPI_EEPROM1_CS) && SPI_EEPROM1_CS >= 0
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS)
#if PIN_EXISTS(SPI_EEPROM1_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS_PIN)
#endif
#if defined(SPI_EEPROM2_CS) && SPI_EEPROM2_CS >= 0
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS)
#if PIN_EXISTS(SPI_EEPROM2_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS_PIN)
#endif
#if PIN_EXISTS(SPI_FLASH_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS_PIN)
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/pins/sam/pins_ALLIGATOR_R2.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@

#define SPI_CHAN_DAC 1

#define DAC0_SYNC 53 // PB14
#define DAC1_SYNC 6 // PC24
#define DAC0_SYNC_PIN 53 // PB14
#define DAC1_SYNC_PIN 6 // PC24

// 64K SPI EEPROM
#define SPI_EEPROM
#define SPI_CHAN_EEPROM1 2
#define SPI_EEPROM1_CS 25 // PD0
#define SPI_EEPROM1_CS_PIN 25 // PD0

// 2K SPI EEPROM
#define SPI_EEPROM2_CS 26 // PD1
#define SPI_EEPROM2_CS_PIN 26 // PD1

// FLASH SPI
// 32Mb
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/pins/sam/pins_RURAMPS4D_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@
//#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
//#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM
//#define SPI_EEPROM2_CS ?
//#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH
//#define SPI_FLASH_CS_PIN ?

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/pins/sam/pins_RURAMPS4D_13.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@
//#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
//#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM
//#define SPI_EEPROM2_CS ?
//#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH
//#define SPI_FLASH_CS_PIN ?

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@
// SPI Buses
//

#define DAC0_SYNC 53 // PB14
#define DAC0_SYNC_PIN 53 // PB14
#define SPI_CHAN_DAC 1

#define SPI_CHAN_EEPROM1 -1
#define SPI_EEPROM1_CS -1
#define SPI_EEPROM2_CS -1
#define SPI_EEPROM1_CS_PIN -1
#define SPI_EEPROM2_CS_PIN -1
#define SPI_FLASH_CS_PIN -1

#define SD_SCK_PIN 76
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
// SPI
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
//#define SPI_EEPROM1_CS_PIN ?

// 2K EEPROM
//#define SPI_EEPROM2_CS ?
//#define SPI_EEPROM2_CS_PIN ?

// 32Mb FLASH
//#define SPI_FLASH_CS_PIN ?
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@
#if ENABLED(SPI_EEPROM)
// SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits)
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PC5 // pin 34
#define EEPROM_SCK BOARD_SPI1_SCK_PIN // PA5 pin 30
#define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define SPI_EEPROM1_CS_PIN PC5 // pin 34
#define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30
#define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#elif HAS_SPI_FLASH
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/pins/stm32f4/pins_LERDGE_S.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@
#if ENABLED(SPI_EEPROM)
// Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI PB15 // datasheet: DI pin, found with multimeter, not tested
#define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#else
Expand Down

0 comments on commit 594c685

Please sign in to comment.