0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LPC812MAXとSSD1306で「アイテム」を表示(8x8)(Keil Studio)

Posted at

x ライブラリの追加が出来る人

x なぜかMBEDオンラインコンパイラが終わってしまったのでkeilに移行

x 過去ログをみよ

o_cop337.jpg

o_cop338.jpg

o_cop339.jpg

o_cop340.jpg



//oled_test2_16x24_812_1

#include "mbed.h"
#include "SSD1308.h"

//i2c initialization
//       SDA    SCL
I2C i2c(P0_10, P0_11); //812

// ビットマップデータ
char databytes1[8] = 

{

0b01100110,
0b10101111,
0b10111111,
0b11011111,

0b01111110,
0b01111110,
0b00111100,
0b00011000

};


int gop[8][8] = {
    {0,0,0,0,  0,0,0,0}, 
    {0,0,0,0,  0,0,0,0},
    {0,0,0,0,  0,0,0,0}, 
    {0,0,0,0,  0,0,0,0}, 

    {0,0,0,0,  0,0,0,0},
    {0,0,0,0,  0,0,0,0}, 
    {0,0,0,0,  0,0,0,0}, 
    {0,0,0,0,  0,0,0,0}
};


  unsigned char bbh[]
// 1122 
 ={0,0,
   0,0,
   0,0,
   0,0}; 


void p_m270(char ttt[]) {
    
   char cc;
    
  for(int ii=0;ii<8;ii++)   { 
    
  cc = ttt[ii];

  gop[ii][7] = cc & 0x1; cc = cc >> 1;
  gop[ii][6] = cc & 0x1; cc = cc >> 1;
  gop[ii][5] = cc & 0x1; cc = cc >> 1;
  gop[ii][4] = cc & 0x1; cc = cc >> 1;

  gop[ii][3] = cc & 0x1; cc = cc >> 1;
  gop[ii][2] = cc & 0x1; cc = cc >> 1;
  gop[ii][1] = cc & 0x1; cc = cc >> 1;
  gop[ii][0] = cc & 0x1;

  }//for
    
}//p_0


void p_out(unsigned char ttt[]) {
    
  char cc;
    
  for(int ii=0;ii<8;ii++)   { 
    
  cc = 0;

  cc = cc + (gop[0][ii] * 1   );
  cc = cc + (gop[1][ii] * 2   );
  cc = cc + (gop[2][ii] * 4   );
  cc = cc + (gop[3][ii] * 8   );

  cc = cc + (gop[4][ii] * 16  );
  cc = cc + (gop[5][ii] * 32  );
  cc = cc + (gop[6][ii] * 64  );
  cc = cc + (gop[7][ii] * 128 );

  ttt[ii] = cc;


  }//for
    
}//p_out


//メイン関数
int main()
{

    wait_ms(500); //0.5秒の待ち

    // Instantiate OLED
    SSD1308 oled = SSD1308( &i2c , SSD1308_SA0);


int o_row=0;
int o_col=0;


  p_m270(databytes1); 
  p_out(bbh);


    oled.writeBitmap( (uint8_t *)bbh,
                o_row, (o_row + 1 - 1),
                o_col, (o_col + 8 - 1));



    while(1) {}

}//main




0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?