ST7735(パラレル)を基板化したい。1(未完了プロジェクト?)



目的
手間の軽減と美観の為に基板化するんだ!!


こんな感じ

[o_cop616.jpg]

![o_cop616.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/9f6b6a3f-5d68-3790-dde1-4e0903d04def.jpeg)





[o_cop578.jpg]

![o_cop578.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/5584016c-b4d7-e4e0-f792-a22f1af1b1bc.jpeg)

[o_cop525.jpg]

![o_cop525.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/9c7ef110-561d-762d-1da8-bca37b4cd72e.jpeg)

[o_cop589.jpg]

![o_cop589.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/a22ec5d1-ff6b-2002-7da0-d1ff6fa16d9a.jpeg)

[o_cop590.jpg]

![o_cop590.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/0bd28857-2c7a-3b1f-7110-4656a38df070.jpeg)

[o_cop591.jpg]

![o_cop591.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/28636450-cb82-a60e-1f54-9eece47a8187.jpeg)

[o_cop650.jpg]

![o_cop650.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/b80e87c6-3781-89d9-35ad-d5599bb2adbd.jpeg)


-------------------------------------------------

試作

[o_cop575.jpg]

![o_cop575.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/3288ff23-798d-d72d-8518-bf7b80849738.jpeg)

[o_cop576.jpg]

![o_cop576.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/081e8cb7-cdee-53b5-f367-defb4fa4f1c7.jpeg)

[o_cop577.jpg]

![o_cop577.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/307e6edf-f95c-931e-4396-96605872838a.jpeg)

[o_cop588.jpg]

![o_cop588.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/f363540f-6e4f-5ae4-6543-24f54a938d48.jpeg)


```c++


//GPIO_st7735_TEST_MINI1_071_1

//GPIO
#define GPIO_A4(s) digitalWrite(A4,s)
#define GPIO_A5(s) digitalWrite(A5,s)
#define GPIO_D3(s) digitalWrite(3,s)
#define GPIO_D2(s) digitalWrite(2,s)

void GPIO_8BIT(int s)
{
  digitalWrite(A0, (s >> 7) & 0x01);
  digitalWrite( 7, (s >> 6) & 0x01);
  digitalWrite(A1, (s >> 5) & 0x01);
  digitalWrite( 6, (s >> 4) & 0x01);
  digitalWrite(A2, (s >> 3) & 0x01);
  digitalWrite( 5, (s >> 2) & 0x01);
  digitalWrite(A3, (s >> 1) & 0x01);
  digitalWrite( 4, s & 0x01);
} //GPIO_8BIT

//コマンドの書き込み
void LCD_Write_CMD(int a)
{
  GPIO_A5(0); //A0=0;
  GPIO_8BIT(a);//P1=a; data
  GPIO_D3(0);//WRB=0;
  GPIO_D3(1);//WRB=1;
} //LCD_Write_CMD


//データ書き込み
void LCD_Write_Data(int a)
{
  GPIO_A5(1);//A0=1;
  GPIO_8BIT(a);//P1=a; data
  GPIO_D3(0);//WRB=0;
  GPIO_D3(1);//WRB=1;
} //LCD_Write_Data


//液晶の初期化処理
void TXDT144TF_ST7735S_Init(void)
{

  //----------  ST7735S Reset Sequence  --------//

  GPIO_D2(1);//LCD_RESET=1;

  delay(1); //Delay 1ms

  GPIO_D2(0);//LCD_RESET=0;

  delay(1); //Delay 1ms

  GPIO_D2(1);//LCD_RESET=1;

  delay(120); //Delay 120ms

  LCD_Write_CMD(0x01);//SOFTWARE RESET
  delay(50);

  LCD_Write_CMD(0x11);//SLEEP OUT
  delay(200);

  LCD_Write_CMD(0x29);//display on
  delay(100);

  LCD_Write_CMD(0x3a);//Interface pixel format
  LCD_Write_Data(0x05);//16bit mode
  delay(100);

  LCD_Write_CMD(0x36);//RGB-RGR format
  LCD_Write_Data(0x08);//RGB mode
  delay(100);


  //画面の書き込み開始
  LCD_Write_CMD(0x2C); //memory write

for(int i=0;i<128*10;i++){
  LCD_Write_Data(0xff);
  LCD_Write_Data(0xff);
}

//RGB
for(int i=0;i<128*10;i++){
  LCD_Write_Data(0b11111000); //red
  LCD_Write_Data(0b00000000);
}

} //TXDT144TF_ST7735S_Init


//初期化
void setup() {

  //ポートのモード設定
  //アウトプットモード
  pinMode(13, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);

  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);


  //ポートの初期化
  GPIO_A4(1);//RD=1
  GPIO_D3(0);//WR=0
  GPIO_A5(0);//RS=0
  GPIO_D2(1);//RESET=1

  delay(500); //0.5秒待つ

  //液晶の初期化処理
  TXDT144TF_ST7735S_Init();

} //setup


//メインループ
void loop() {

  digitalWrite(13, HIGH);
  delay(200); //0.2秒待つ

  digitalWrite(13, LOW);
  delay(200); //0.2秒待つ

} //loop

```