// Vplot(x, y, c) (x,y)にドットをプロット c...0:黒, 1:白, 2:反転 // Vline(x1, y1, x2, y2, c) (x1,y1)と(x2,y2)を結ぶ直線 c...0:黒, 1:白, 2:反転 // Vputc4x6(x, y, c) (x,y)に4x6ドットの数字文字 c...0:黒, 1:白, 2:反転 // 4×6ドットの数字フォント prog_uint8_t font4x6[][6]={ 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b11100000, 0b10100000, 0b10100000, 0b10100000, 0b11100000, 0b00000000, 0b01000000, 0b11000000, 0b01000000, 0b01000000, 0b11100000, 0b00000000, 0b11100000, 0b00100000, 0b11100000, 0b10000000, 0b11100000, 0b00000000, 0b11100000, 0b00100000, 0b11100000, 0b00100000, 0b11100000, 0b00000000, 0b10100000, 0b10100000, 0b10100000, 0b11100000, 0b00100000, 0b00000000, 0b11100000, 0b10000000, 0b11100000, 0b00100000, 0b11100000, 0b00000000, 0b11100000, 0b10000000, 0b11100000, 0b10100000, 0b11100000, 0b00000000, 0b11100000, 0b10100000, 0b00100000, 0b00100000, 0b00100000, 0b00000000, 0b11100000, 0b10100000, 0b11100000, 0b10100000, 0b11100000, 0b00000000, 0b11100000, 0b10100000, 0b11100000, 0b00100000, 0b11100000 }; void Vplot(uint8_t x, uint8_t y, uint8_t c){ // ドットのプロット #if SCREEN_W == 48 uint16_t i=(x>>3) + (y<<2)+(y<<1); // i=x/8 + y*(SCREEN_W/8) #elif SCREEN_W == 64 uint16_t i=(x>>3) + (y<<3); // i=x/8 + y*(SCREEN_W/8) #elif SCREEN_W == 96 uint16_t i=(x>>3) + (y<<3)+(y<<2); // i=x/8 + y*(SCREEN_W/8) #endif if(c==0) vram[i]&= ~(1<<(7-x&7)); // black else if(c==1) vram[i]|= (1<<(7-x&7)); // white else if(c==2) vram[i]^= (1<<(7-x&7)); // invert } uint8_t Vline(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2,uint8_t c){ // 直線 uint8_t x,y; if(x2>=x1) for(x=x1;x<=x2;x++) Vplot(x,y1,c); else for(x=x2;x<=x1;x++) Vplot(x,y1,c); if(y2>=y1) for(y=y1;y<=y2;y++) Vplot(x2,y,c); else for(y=y2;y<=y1;y++) Vplot(x2,y,c); } void Vputc4x6(uint8_t x, uint8_t y, uint8_t c){ // 4x6数字文字の描画 uint8_t j; #if SCREEN_W == 48 uint16_t i=(x>>3) + (y<<2)+(y<<1); // i=x/8 + y*(SCREEN_W/8) #elif SCREEN_W == 64 uint16_t i=(x>>3) + (y<<3); // i=x/8 + y*(SCREEN_W/8) #elif SCREEN_W == 96 uint16_t i=(x>>3) + (y<<3)+(y<<2); // i=x/8 + y*(SCREEN_W/8) #endif if(c>='0' && c<='9') c=c-'0'+1; // '0'〜'9' else c=0; for(j=0;j<6;j++,i+=SCREEN_W/8){ if(x&7) vram[i]=(vram[i]&0xf0)|(pgm_read_byte(&font4x6[c][j])>>4); else vram[i]=(vram[i]&0x0f)|pgm_read_byte(&font4x6[c][j]); } }