OLED
OLED
OLED
(SPSR&_BV(SPIF)));}
#define tft_Write_16(C) tft_Write_8((uint8_t)((C)>>8));tft_Write_8((uint8_t)
((C)>>0))
#define tft_Write_32C(C,D) \
tft_Write_16((uint16_t) (C)); \
tft_Write_16((uint16_t) (D))
len=240*240;
while ( len-- ) {tft_Write_16(color);} //Renk kodlari.
**********************
/*
if(input(ust_sinir)) //yukarı sınır. e6 yukarı e5 asagi e7 ortak.
{
if(asa==0)
{
output_low(kavrama);
output_low(ust_dc_sinir); //Yukari.
output_low(pin_e4);
output_low(ortak_dc);
}
if(asa==1)
{
output_high(kavrama);
output_high(ortak_dc);
output_high(pin_e4);
if(yuk==0)
{
output_low(kavrama);
output_low(alt_dc_sinir);//Asagi.
output_low(ortak_dc);
output_low(pin_e4);
}
if(yuk==1)
{
output_high(kavrama);
output_high(ortak_dc);
output_high(pin_e4);
*/
**************************************************
/*
//RESET PIN 0 SONRA 1 OLACAK ,BLK :3.3 ,DC :0 KOMUT DC :1 DATA
#define RGB565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b &
0xF8) >> 3))
#define ST7789_ColorMode_65K 0x50
//#define ST7789_ColorMode_262K 0x60
//#define ST7789_ColorMode_12bit 0x03
#define ST7789_ColorMode_16bit 0x55 //0x05
//#define ST7789_ColorMode_18bit 0x06
//#define ST7789_ColorMode_16M 0x07
#define ST7789_X_Start 0
#define ST7789_Y_Start 0
void ST7789_HardReset(void);
void ST7789_SoftReset(void);
void ST7789_InversionMode(uint8_t Mode);
void ST7789_ColorModeSet(uint8_t ColorMode);
void ST7789_SleepModeExit( void );
int oldu=0;
ST7789_HardReset();
ST7789_SoftReset();
ST7789_SleepModeExit();
ST7789_ColorModeSet(ST7789_ColorMode_65K | ST7789_ColorMode_16bit);
bekle(420000);
ST7789_MemAccessModeSet(4, 1, 1, 0);
bekle(420000);
ST7789_InversionMode(1);
bekle(420000);
ST7789_FillScreen(0);
ST7789_SendCmd(ST7789_Cmd_DISPON);
bekle(4200000);
}
void ST7789_HardReset(void)
{
// GPIOA->ODR &=~(1<<1);
GPIOA->BSRR |=1<<17;
bekle(420000);
GPIOA->BSRR |=1<<1;
//GPIOA->ODR |=(1<<1);
bekle(8400000);
}
void ST7789_SoftReset(void)
{
ST7789_SendCmd(ST7789_Cmd_SWRESET);
bekle(8400000);
}
void ST7789_InversionMode(uint8_t Mode)
{
if (Mode)
ST7789_SendCmd(ST7789_Cmd_INVON);
else
ST7789_SendCmd(ST7789_Cmd_INVOFF);
}
ST7789_SendCmd(ST7789_Cmd_MADCTL);
switch (Rotation)
{
case 0:
Value = 0;
break;
case 1:
Value = ST7789_MADCTL_MX;
break;
case 2:
Value = ST7789_MADCTL_MY;
break;
case 3:
Value = ST7789_MADCTL_MX | ST7789_MADCTL_MY;
break;
case 4:
Value = ST7789_MADCTL_MV;
break;
case 5:
Value = ST7789_MADCTL_MV | ST7789_MADCTL_MX;
break;
case 6:
Value = ST7789_MADCTL_MV | ST7789_MADCTL_MY;
break;
case 7:
Value = ST7789_MADCTL_MV | ST7789_MADCTL_MX | ST7789_MADCTL_MY;
break;
}
if (VertMirror)
Value = ST7789_MADCTL_ML;
if (HorizMirror)
Value = ST7789_MADCTL_MH;
if (IsBGR)
Value |= ST7789_MADCTL_BGR;
ST7789_SendData(Value);
}
ST7789_SetWindow(x, y, x, y);
ST7789_RamWrite(&color, 1);
}
ColumnStart += ST7789_X_Start;
ColumnEnd += ST7789_X_Start;
ST7789_SendCmd(ST7789_Cmd_CASET);
ST7789_SendData(ColumnStart >> 8);
ST7789_SendData(ColumnStart & 0xFF);
ST7789_SendData(ColumnEnd >> 8);
ST7789_SendData(ColumnEnd & 0xFF);
}
RowStart += ST7789_Y_Start;
RowEnd += ST7789_Y_Start;
ST7789_SendCmd(ST7789_Cmd_RASET);
ST7789_SendData(RowStart >> 8);
ST7789_SendData(RowStart & 0xFF);
ST7789_SendData(RowEnd >> 8);
ST7789_SendData(RowEnd & 0xFF);
}
*************************************
dr ye yaz.877.satırda
bsy biti.
dr ve sr registerini oku.
RCC BENDEKİ
SPI
CR 00000344
GPIOA
MODER A8008905
OTYPER 00000000
ODR 000000013
AFRL 505000000