Code: Select all
#define LCD_REG (*((volatile unsigned short *) 0x60000000)) /* RS = 0 */
#define LCD_RAM (*((volatile unsigned short *) 0x60020000)) /* RS = 1 */
void ssd1289_fsmc_init(void) {
rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
int FSMC_Bank = 0;
/* timing structure */
/* from datasheet:
address setup: 0ns
address hold: 0ns
Data setup: 5ns
Data hold: 5ns
Data access: 250ns
output hold: 100ns
*/
FSMC_Bank1->BTCR[FSMC_Bank+1] = FSMC_BTR1_ADDSET_1 | FSMC_BTR1_DATAST_1;
/* Bank1 NOR/SRAM control register configuration */
FSMC_Bank1->BTCR[FSMC_Bank] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
}
static __inline void LCD_WriteReg(uint8_t LCD_Reg,uint16_t LCD_RegValue)
{
/* Write 16-bit Index, then Write Reg */
LCD_REG = LCD_Reg;
/* Write 16-bit Reg */
LCD_RAM = LCD_RegValue;
}
static __inline uint16_t LCD_ReadReg(uint8_t LCD_Reg)
{
/* Write 16-bit Index (then Read Reg) */
LCD_REG = LCD_Reg;
/* Read 16-bit Reg */
return (LCD_RAM);
}