![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sad radi
Dependencies: BSP_DISCO_F469NIfdsf LCD_DISCO_F469NI mbed
Fork of PrintGearUSpesno by
Gear.cpp
- Committer:
- formulas
- Date:
- 2017-10-26
- Revision:
- 2:2c90cdf71847
- Parent:
- 1:b6c19373bd01
File content as of revision 2:2c90cdf71847:
#include "Gear.h" #include "LogoBitmap.h" #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte)\ (byte & 0x80 ? '1' : '0'),\ (byte & 0x40 ? '1' : '0'),\ (byte & 0x20 ? '1' : '0'),\ (byte & 0x10 ? '1' : '0'),\ (byte & 0x08 ? '1' : '0'),\ (byte & 0x04 ? '1' : '0'),\ (byte & 0x02 ? '1' : '0'),\ (byte & 0x01 ? '1' : '0') const uint8_t StartXPos=200; const uint8_t StartYPos=20; extern LCD_DISCO_F469NI lcd; GEAR Gear1={160,328,GearBitmap1}; /* GEAR Gear2 {0,0,GearBitmap2}; GEAR Gear3 {0,0,GearBitmap3}; GEAR Gear4 {0,0,GearBitmap4}; GEAR Gear5 {0,0,GearBitmap5}; GEAR Gear6 {0,0,GearBitmap6}; */ void PrintGear(GEAR Gear){ uint16_t width=Gear.width; uint16_t height=Gear.height; uint16_t horpos,vertpos; uint16_t bitloc; char pos[9]; //uint8_t dbg[50]; for(vertpos=0;vertpos<height;vertpos++){ for(horpos=0;horpos<width/8;horpos++){ sprintf(pos,BYTE_TO_BINARY_PATTERN,BYTE_TO_BINARY(Gear.GearBitmap[vertpos*(width/8)+horpos])); for(bitloc=0;bitloc<8;bitloc++) { if (pos[bitloc]=='1') { lcd.DrawPixel(StartXPos+horpos*8+bitloc,StartYPos+vertpos,0xFFF00000); } } } } }; void PrintLogo(){ uint16_t width=147; uint16_t height=94; uint16_t horpos,vertpos; for(horpos=0;horpos<width;horpos++){ for(vertpos=0;vertpos<height;vertpos++){ lcd.DrawPixel(StartXPos+horpos,StartYPos+vertpos,LogoBitmap[horpos*height+vertpos]); } } };