valjda je to to
Dependencies: BSP_DISCO_F469NIfdsf LCD_DISCO_F469NI mbed
Diff: Gear.cpp
- Revision:
- 0:a549a6b9b62e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gear.cpp Mon Oct 23 15:07:35 2017 +0000 @@ -0,0 +1,42 @@ +#include "Gear.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; + + +GEAR Gear1={80,120,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){ + uint8_t width=Gear.width; + uint8_t height=Gear.height; + uint8_t horpos,vertpos; + uint8_t bitloc; + char pos[8]; + 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') { + DrawPixel(200+horpos*8+bitloc,20+vertpos,000000); + } + } + } + } +}; \ No newline at end of file