![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sad radi
Dependencies: BSP_DISCO_F469NIfdsf LCD_DISCO_F469NI mbed
Fork of PrintGear by
Diff: Gear.cpp
- Revision:
- 1:b6c19373bd01
- Parent:
- 0:a549a6b9b62e
--- a/Gear.cpp Mon Oct 23 15:07:35 2017 +0000 +++ b/Gear.cpp Tue Oct 24 08:50:14 2017 +0000 @@ -1,4 +1,5 @@ #include "Gear.h" +#include "mbed.h" #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte)\ (byte & 0x80 ? '1' : '0'),\ @@ -10,11 +11,12 @@ (byte & 0x02 ? '1' : '0'),\ (byte & 0x01 ? '1' : '0') -const uint8_t StartXPos=200; -const uint8_t StartYPos=20; +extern LCD_DISCO_F469NI lcd; +const uint32_t StartXPos=330; +const uint32_t StartYPos=70; -GEAR Gear1={80,120,GearBitmap1}; +GEAR Gear1={160,328,GearBitmap1}; /* GEAR Gear2 {0,0,GearBitmap2}; GEAR Gear3 {0,0,GearBitmap3}; GEAR Gear4 {0,0,GearBitmap4}; @@ -24,19 +26,23 @@ void PrintGear(GEAR Gear){ - uint8_t width=Gear.width; - uint8_t height=Gear.height; - uint8_t horpos,vertpos; + uint32_t width=Gear.width; + uint32_t height=Gear.height; + uint32_t horpos,vertpos; uint8_t bitloc; - char pos[8]; + char pos[50]; + //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') { - DrawPixel(200+horpos*8+bitloc,20+vertpos,000000); + lcd.DrawPixel(StartXPos+horpos*8+bitloc,StartYPos+vertpos,0xFFF00000); + //wait_us(50); + //lcd.FillRect(StartXPos,StartYPos,StartXPos+horpos,StartYPos+vertpos); } } } } + }; \ No newline at end of file