|
|
@ -26,7 +26,7 @@
|
|
|
|
* Communication interface for FSMC
|
|
|
|
* Communication interface for FSMC
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(STM32F1) || defined(STM32F1xx)
|
|
|
|
#if (defined(STM32F1) || defined(STM32F1xx)) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
|
|
|
|
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfig.h"
|
|
|
|
#include "../../inc/MarlinConfig.h"
|
|
|
|
|
|
|
|
|
|
|
@ -108,6 +108,8 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB(void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define FSMC_CS_NE1 PD7
|
|
|
|
#define FSMC_CS_NE1 PD7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STM32_XL_DENSITY
|
|
|
|
#define FSMC_CS_NE2 PG9
|
|
|
|
#define FSMC_CS_NE2 PG9
|
|
|
|
#define FSMC_CS_NE3 PG10
|
|
|
|
#define FSMC_CS_NE3 PG10
|
|
|
|
#define FSMC_CS_NE4 PG12
|
|
|
|
#define FSMC_CS_NE4 PG12
|
|
|
@ -128,6 +130,8 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB(void) {
|
|
|
|
#define FSMC_RS_A13 PG3
|
|
|
|
#define FSMC_RS_A13 PG3
|
|
|
|
#define FSMC_RS_A14 PG4
|
|
|
|
#define FSMC_RS_A14 PG4
|
|
|
|
#define FSMC_RS_A15 PG5
|
|
|
|
#define FSMC_RS_A15 PG5
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define FSMC_RS_A16 PD11
|
|
|
|
#define FSMC_RS_A16 PD11
|
|
|
|
#define FSMC_RS_A17 PD12
|
|
|
|
#define FSMC_RS_A17 PD12
|
|
|
|
#define FSMC_RS_A18 PD13
|
|
|
|
#define FSMC_RS_A18 PD13
|
|
|
@ -136,8 +140,11 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB(void) {
|
|
|
|
#define FSMC_RS_A21 PE5
|
|
|
|
#define FSMC_RS_A21 PE5
|
|
|
|
#define FSMC_RS_A22 PE6
|
|
|
|
#define FSMC_RS_A22 PE6
|
|
|
|
#define FSMC_RS_A23 PE2
|
|
|
|
#define FSMC_RS_A23 PE2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STM32_XL_DENSITY
|
|
|
|
#define FSMC_RS_A24 PG13
|
|
|
|
#define FSMC_RS_A24 PG13
|
|
|
|
#define FSMC_RS_A25 PG14
|
|
|
|
#define FSMC_RS_A25 PG14
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t fsmcInit = 0;
|
|
|
|
static uint8_t fsmcInit = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -156,15 +163,18 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) {
|
|
|
|
|
|
|
|
|
|
|
|
switch (cs) {
|
|
|
|
switch (cs) {
|
|
|
|
case FSMC_CS_NE1: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION1; break;
|
|
|
|
case FSMC_CS_NE1: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION1; break;
|
|
|
|
|
|
|
|
#ifdef STM32_XL_DENSITY
|
|
|
|
case FSMC_CS_NE2: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION2; break;
|
|
|
|
case FSMC_CS_NE2: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION2; break;
|
|
|
|
case FSMC_CS_NE3: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION3; break;
|
|
|
|
case FSMC_CS_NE3: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION3; break;
|
|
|
|
case FSMC_CS_NE4: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION4; break;
|
|
|
|
case FSMC_CS_NE4: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION4; break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
default: return;
|
|
|
|
default: return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define _ORADDR(N) controllerAddress |= (_BV32(N) - 2)
|
|
|
|
#define _ORADDR(N) controllerAddress |= (_BV32(N) - 2)
|
|
|
|
|
|
|
|
|
|
|
|
switch (rs) {
|
|
|
|
switch (rs) {
|
|
|
|
|
|
|
|
#ifdef STM32_XL_DENSITY
|
|
|
|
case FSMC_RS_A0: _ORADDR( 1); break;
|
|
|
|
case FSMC_RS_A0: _ORADDR( 1); break;
|
|
|
|
case FSMC_RS_A1: _ORADDR( 2); break;
|
|
|
|
case FSMC_RS_A1: _ORADDR( 2); break;
|
|
|
|
case FSMC_RS_A2: _ORADDR( 3); break;
|
|
|
|
case FSMC_RS_A2: _ORADDR( 3); break;
|
|
|
@ -181,6 +191,7 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) {
|
|
|
|
case FSMC_RS_A13: _ORADDR(14); break;
|
|
|
|
case FSMC_RS_A13: _ORADDR(14); break;
|
|
|
|
case FSMC_RS_A14: _ORADDR(15); break;
|
|
|
|
case FSMC_RS_A14: _ORADDR(15); break;
|
|
|
|
case FSMC_RS_A15: _ORADDR(16); break;
|
|
|
|
case FSMC_RS_A15: _ORADDR(16); break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
case FSMC_RS_A16: _ORADDR(17); break;
|
|
|
|
case FSMC_RS_A16: _ORADDR(17); break;
|
|
|
|
case FSMC_RS_A17: _ORADDR(18); break;
|
|
|
|
case FSMC_RS_A17: _ORADDR(18); break;
|
|
|
|
case FSMC_RS_A18: _ORADDR(19); break;
|
|
|
|
case FSMC_RS_A18: _ORADDR(19); break;
|
|
|
@ -189,8 +200,10 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) {
|
|
|
|
case FSMC_RS_A21: _ORADDR(22); break;
|
|
|
|
case FSMC_RS_A21: _ORADDR(22); break;
|
|
|
|
case FSMC_RS_A22: _ORADDR(23); break;
|
|
|
|
case FSMC_RS_A22: _ORADDR(23); break;
|
|
|
|
case FSMC_RS_A23: _ORADDR(24); break;
|
|
|
|
case FSMC_RS_A23: _ORADDR(24); break;
|
|
|
|
|
|
|
|
#ifdef STM32_XL_DENSITY
|
|
|
|
case FSMC_RS_A24: _ORADDR(25); break;
|
|
|
|
case FSMC_RS_A24: _ORADDR(25); break;
|
|
|
|
case FSMC_RS_A25: _ORADDR(26); break;
|
|
|
|
case FSMC_RS_A25: _ORADDR(26); break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
default: return;
|
|
|
|
default: return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -254,4 +267,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_GRAPHICAL_LCD
|
|
|
|
#endif // HAS_GRAPHICAL_LCD
|
|
|
|
|
|
|
|
|
|
|
|
#endif // STM32F1 || STM32F1xx
|
|
|
|
#endif // (STM32F1 || STM32F1xx) && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
|
|
|
|