sad radi
Dependencies: BSP_DISCO_F469NIfdsf LCD_DISCO_F469NI mbed
Fork of PrintGearUSpesno by
Gear.cpp@2:2c90cdf71847, 2017-10-26 (annotated)
- Committer:
- formulas
- Date:
- Thu Oct 26 19:40:28 2017 +0000
- Revision:
- 2:2c90cdf71847
- Parent:
- 1:b6c19373bd01
sadasd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
formulas | 0:a549a6b9b62e | 1 | #include "Gear.h" |
formulas | 2:2c90cdf71847 | 2 | #include "LogoBitmap.h" |
formulas | 0:a549a6b9b62e | 3 | #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" |
formulas | 0:a549a6b9b62e | 4 | #define BYTE_TO_BINARY(byte)\ |
formulas | 0:a549a6b9b62e | 5 | (byte & 0x80 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 6 | (byte & 0x40 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 7 | (byte & 0x20 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 8 | (byte & 0x10 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 9 | (byte & 0x08 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 10 | (byte & 0x04 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 11 | (byte & 0x02 ? '1' : '0'),\ |
formulas | 0:a549a6b9b62e | 12 | (byte & 0x01 ? '1' : '0') |
formulas | 0:a549a6b9b62e | 13 | |
formulas | 2:2c90cdf71847 | 14 | const uint8_t StartXPos=200; |
formulas | 2:2c90cdf71847 | 15 | const uint8_t StartYPos=20; |
formulas | 1:b6c19373bd01 | 16 | extern LCD_DISCO_F469NI lcd; |
formulas | 0:a549a6b9b62e | 17 | |
formulas | 1:b6c19373bd01 | 18 | GEAR Gear1={160,328,GearBitmap1}; |
formulas | 0:a549a6b9b62e | 19 | /* GEAR Gear2 {0,0,GearBitmap2}; |
formulas | 0:a549a6b9b62e | 20 | GEAR Gear3 {0,0,GearBitmap3}; |
formulas | 0:a549a6b9b62e | 21 | GEAR Gear4 {0,0,GearBitmap4}; |
formulas | 0:a549a6b9b62e | 22 | GEAR Gear5 {0,0,GearBitmap5}; |
formulas | 0:a549a6b9b62e | 23 | GEAR Gear6 {0,0,GearBitmap6}; |
formulas | 0:a549a6b9b62e | 24 | */ |
formulas | 0:a549a6b9b62e | 25 | |
formulas | 0:a549a6b9b62e | 26 | |
formulas | 0:a549a6b9b62e | 27 | void PrintGear(GEAR Gear){ |
formulas | 2:2c90cdf71847 | 28 | uint16_t width=Gear.width; |
formulas | 2:2c90cdf71847 | 29 | uint16_t height=Gear.height; |
formulas | 2:2c90cdf71847 | 30 | uint16_t horpos,vertpos; |
formulas | 2:2c90cdf71847 | 31 | uint16_t bitloc; |
formulas | 2:2c90cdf71847 | 32 | char pos[9]; |
formulas | 1:b6c19373bd01 | 33 | //uint8_t dbg[50]; |
formulas | 0:a549a6b9b62e | 34 | for(vertpos=0;vertpos<height;vertpos++){ |
formulas | 0:a549a6b9b62e | 35 | for(horpos=0;horpos<width/8;horpos++){ |
formulas | 0:a549a6b9b62e | 36 | sprintf(pos,BYTE_TO_BINARY_PATTERN,BYTE_TO_BINARY(Gear.GearBitmap[vertpos*(width/8)+horpos])); |
formulas | 0:a549a6b9b62e | 37 | for(bitloc=0;bitloc<8;bitloc++) { |
formulas | 0:a549a6b9b62e | 38 | if (pos[bitloc]=='1') { |
formulas | 1:b6c19373bd01 | 39 | lcd.DrawPixel(StartXPos+horpos*8+bitloc,StartYPos+vertpos,0xFFF00000); |
formulas | 2:2c90cdf71847 | 40 | |
formulas | 0:a549a6b9b62e | 41 | } |
formulas | 0:a549a6b9b62e | 42 | } |
formulas | 0:a549a6b9b62e | 43 | } |
formulas | 0:a549a6b9b62e | 44 | } |
formulas | 1:b6c19373bd01 | 45 | |
formulas | 2:2c90cdf71847 | 46 | }; |
formulas | 2:2c90cdf71847 | 47 | |
formulas | 2:2c90cdf71847 | 48 | void PrintLogo(){ |
formulas | 2:2c90cdf71847 | 49 | uint16_t width=147; |
formulas | 2:2c90cdf71847 | 50 | uint16_t height=94; |
formulas | 2:2c90cdf71847 | 51 | uint16_t horpos,vertpos; |
formulas | 2:2c90cdf71847 | 52 | for(horpos=0;horpos<width;horpos++){ |
formulas | 2:2c90cdf71847 | 53 | for(vertpos=0;vertpos<height;vertpos++){ |
formulas | 2:2c90cdf71847 | 54 | lcd.DrawPixel(StartXPos+horpos,StartYPos+vertpos,LogoBitmap[horpos*height+vertpos]); |
formulas | 2:2c90cdf71847 | 55 | } |
formulas | 2:2c90cdf71847 | 56 | } |
formulas | 0:a549a6b9b62e | 57 | }; |