/*****************************(abc907-18325.c)***
* OLEDライブラリーテスト
*************************************************/
#include "mcc_generated_files/mcc.h"
#include "myProject.h" // i2C_SSD1306.hの宣言を追加
#define VBA
char RBuf[BFSIZE]; // BFSIZEはmyProject.hで宣言
uint8_t SFlg;
//---- test data -----
char msg0[] = "Test Print!";
const char hk[10][16] ={
{ 0x00,0xF8,0x04,0x02,0xC2,0x24,0xF8,0x00,
0x00,0x0F,0x14,0x23,0x20,0x10,0x0F,0x00 }, // 0
{ 0x00,0x10,0x08,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00 }, // 1
{ 0x00,0x18,0x04,0x02,0x82,0x44,0x38,0x00,
0x00,0x38,0x26,0x21,0x20,0x20,0x20,0x00 }, // 2
{ 0x18,0x04,0x82,0x82,0x82,0x44,0x38,0x00,
0x0C,0x10,0x20,0x20,0x20,0x11,0x0E,0x00 }, // 3
{ 0x00,0xC0,0x30,0x0C,0xFE,0x00,0x00,0x00,
0x03,0x02,0x02,0x02,0x3F,0x02,0x02,0x00 }, // 4
{ 0xE0,0x5E,0x22,0x22,0x22,0x42,0x80,0x00,
0x0C,0x10,0x20,0x20,0x20,0x10,0x0F,0x00 }, // 5
{ 0xF0,0x8C,0x42,0x42,0x42,0x84,0x00,0x00,
0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00 }, // 6
{ 0x02,0x02,0x02,0x02,0xE2,0x1A,0x06,0x00,
0x00,0x00,0x00,0x7E,0x01,0x00,0x00,0x00 }, // 7
{ 0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,
0x0E,0x11,0x20,0x20,0x20,0x11,0x0E,0x00 }, // 8
{ 0x78,0x84,0x02,0x02,0x02,0x84,0xF8,0x00,
0x08,0x10,0x21,0x21,0x21,0x10,0x0F,0x00 } // 9
};
const char kj[2][32]={
{ 0x00,0x10,0x60,0x01,0x06,0x04,0xE4,0x24,
0x2F,0x24,0xE4,0x24,0x2F,0x24,0xE4,0x04,
0x00,0xC0,0x30,0x0C,0x03,0x90,0x95,0x55,
0x55,0x35,0x1F,0x35,0x55,0x55,0x91,0x90 }, // 漢
{ 0x00,0x1C,0x04,0x04,0x24,0x24,0x24,0x24,
0xA7,0xA4,0x64,0x24,0x04,0x04,0x1C,0x00,
0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x82,
0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02 }, // 字
};
//---- test program ----
void test_Msg(){
i2cOLED_posPX(0,68);
i2cOLED_str(msg0);
}
void test_HanK(){
uint8_t i;
for(i = 0; i <= 9; i++)
i2cOLED_Ptn(5,i*8,2,8,(char *)hk[i]);
}
void test_Kanj(){
uint8_t i;
for(i = 0; i < 2; i++)
i2cOLED_Ptn(5,90+i*16,2,16,(char *)kj[i]);
}
void test_Ascii(){
char c;
i2cOLED_posPX(0,0);
for(c = 0x30; c <= 0x39; c++) i2cOLED_chr(c);
i2cOLED_posPX(2,0);
for(c = 0x41; c <= 0x50; c++) i2cOLED_chr(c);
i2cOLED_posPX(3,0);
for(c = 0x61; c <= 0x71; c++) i2cOLED_chr(c);
}
/*--------------------------------------------------
* Main application
*------------------------------------------------*/
void main(void){
uint8_t cmd;
SYSTEM_Initialize();
INTERRUPT_GlobalInterruptEnable();
INTERRUPT_PeripheralInterruptEnable();
i2cOLED_init();
puts("ready!\n");
while (1) {
if(SFlg){
cmd = RBuf[0];
#ifndef VBA
puts("\r");
#endif
switch(cmd){
case 'T': ssd1306_test(); break;
case 'C': i2cOLED_Clr(0,7,0); break;
case 'L': i2cOLED_LnClr(4,0x08); break;
case 'E': i2cOLED_LnClr(7,0xD0); break;
case 'F': test_Ascii(); break;
case 'S': test_Msg(); break;
case 'H': test_HanK(); break;
case 'K': test_Kanj(); break;
}
SFlg = 0;
}
IO_RA4_Toggle();
__delay_ms(500);
}
}/
**=== End of File ===*/
|