JrockCa925 / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

ST7920 SPI mode #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
from the dfrobot example, fix current SPI interface

void WriteCommand(int CMD)
{
   int H_data,L_data;
   H_data = CMD;
   H_data &= 0xf0;           //ÆÁ±ÎµÍ4λµÄÊý¾Ý
   L_data = CMD;             //xxxx0000¸ñʽ
   L_data &= 0x0f;           //ÆÁ±Î¸ß4λµÄÊý¾Ý
   L_data <<= 4;             //xxxx0000¸ñʽ
   WriteByte(0xf8);          //RS=0£¬Ð´ÈëµÄÊÇÖ¸Á
   WriteByte(H_data);
   WriteByte(L_data);
}

void WriteData(int CMD)
{
   int H_data,L_data;
   H_data = CMD;
   H_data &= 0xf0;           //ÆÁ±ÎµÍ4λµÄÊý¾Ý
   L_data = CMD;             //xxxx0000¸ñʽ
   L_data &= 0x0f;           //ÆÁ±Î¸ß4λµÄÊý¾Ý
   L_data <<= 4;             //xxxx0000¸ñʽ
   WriteByte(0xfa);          //RS=1£¬Ð´ÈëµÄÊÇÊý¾Ý
   WriteByte(H_data);
   WriteByte(L_data);
}

Original issue reported on code.google.com by olikr...@gmail.com on 24 Jan 2012 at 11:12

GoogleCodeExporter commented 8 years ago
RS = CS (chip select)
RW = SI (Serial In)
E = SCLK (Clock)

Original comment by olikr...@gmail.com on 24 Jan 2012 at 8:24

GoogleCodeExporter commented 8 years ago
implemented & tested

Original comment by olikr...@gmail.com on 24 Jan 2012 at 11:34