「時計」32x32のキャラクター表示　LPC812とSSD1306

「時計」32x32のキャラクター表示　LPC812とSSD1306

x めんどいので過去ログをみよ


![o_cop341.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/082d7ba3-754b-b8c3-046a-399174de6860.jpeg)


![o_cop342.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/ca659cd0-3bc6-9b1c-ed47-701dc69a9a55.jpeg)


![o_cop343.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/01865887-4bbd-611b-222e-589b296c2cd6.jpeg)


```c++

//oled_test2_16x24_812_1

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

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

// ビットマップデータ
char databytes1[] =
    {
        0xc0, 0x00, 0x00, 0x03, 0xbf, 0xf0, 0x0f, 0xfd, 0x7f, 0xce, 0x73, 0xfe,
        0x7f, 0x3f, 0x7c, 0xfe, 0x7e, 0xff, 0x7f, 0x7e, 0x7d, 0xfb, 0x7f, 0xbe,
        0x7b, 0xea, 0xff, 0xde, 0x77, 0xeb, 0x7f, 0xee, 0x77, 0xf7, 0xff, 0xee,
        0x6f, 0xfb, 0xff, 0xf6, 0x6f, 0xfb, 0xff, 0xf6, 0x6f, 0xfb, 0xff, 0xf6,
        0x5f, 0xfd, 0xff, 0xfa, 0x5e, 0xfd, 0xff, 0x3a, 0x5d, 0x7e, 0xff, 0xba,
        0x42, 0x7e, 0xff, 0x02, 0x5f, 0x7d, 0x7f, 0x3a, 0x5f, 0xfd, 0xff, 0xfa,
        0x5f, 0xfb, 0xff, 0xfa, 0x6f, 0xf7, 0xff, 0xf6, 0x6f, 0xef, 0xff, 0xf6,
        0x6f, 0xff, 0x7f, 0xf6, 0x77, 0xfe, 0xff, 0xee, 0x77, 0xfe, 0x7f, 0xee,
        0x7b, 0xfe, 0xbf, 0xde, 0x7d, 0xfe, 0x7f, 0xbe, 0x7e, 0xfe, 0xff, 0x7e,
        0x7f, 0x3e, 0xfc, 0xfe, 0x7f, 0xce, 0xf3, 0xfe, 0x7f, 0xf0, 0x0f, 0xfe,
        0x7f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00
    };

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_m270


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 p_row = 0;
  int p_col = 0;

  int o_row = 0;
  int o_col = 0;
  int kk = 0;

  o_row = p_row;

  for (int ii = 0; ii < 4; ii++) {

    o_col = p_col;

    for (int jj = 0; jj < 4; jj++) {

      char koi[8];

      koi[0] = *(databytes1 + kk + 0);
      koi[1] = *(databytes1 + kk + 4);
      koi[2] = *(databytes1 + kk + 8);
      koi[3] = *(databytes1 + kk + 12);

      koi[4] = *(databytes1 + kk + 16);
      koi[5] = *(databytes1 + kk + 20);
      koi[6] = *(databytes1 + kk + 24);
      koi[7] = *(databytes1 + kk + 28);

      kk = kk + 1;

      p_m270(koi);
      p_out(bbh);

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

      o_col = o_col + 8;

    } // for jj

    o_row = o_row + 1;

    kk = kk + 7 * 4;

  } // for ii

  while (1) {}

} // main



```