Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
+137
-147
@@ -35,9 +35,8 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
|
||||
|
||||
void u8g2_SetBitmapMode(u8g2_t *u8g2, uint8_t is_transparent) {
|
||||
u8g2->bitmap_transparency = is_transparent;
|
||||
void u8g2_SetBitmapMode(u8g2_t* u8g2, uint8_t is_transparent) {
|
||||
u8g2->bitmap_transparency = is_transparent;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -47,172 +46,163 @@ void u8g2_SetBitmapMode(u8g2_t *u8g2, uint8_t is_transparent) {
|
||||
Only draw pixels which are set.
|
||||
*/
|
||||
|
||||
void u8g2_DrawHorizontalBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b)
|
||||
{
|
||||
uint8_t mask;
|
||||
uint8_t color = u8g2->draw_color;
|
||||
uint8_t ncolor = (color == 0 ? 1 : 0);
|
||||
void u8g2_DrawHorizontalBitmap(
|
||||
u8g2_t* u8g2,
|
||||
u8g2_uint_t x,
|
||||
u8g2_uint_t y,
|
||||
u8g2_uint_t len,
|
||||
const uint8_t* b) {
|
||||
uint8_t mask;
|
||||
uint8_t color = u8g2->draw_color;
|
||||
uint8_t ncolor = (color == 0 ? 1 : 0);
|
||||
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if ( u8g2_IsIntersection(u8g2, x, y, x+len, y+1) == 0 )
|
||||
return;
|
||||
if(u8g2_IsIntersection(u8g2, x, y, x + len, y + 1) == 0) return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
mask = 128;
|
||||
while(len > 0)
|
||||
{
|
||||
if ( *b & mask ) {
|
||||
u8g2->draw_color = color;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
} else if ( u8g2->bitmap_transparency == 0 ) {
|
||||
u8g2->draw_color = ncolor;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
}
|
||||
|
||||
x++;
|
||||
mask >>= 1;
|
||||
if ( mask == 0 )
|
||||
{
|
||||
mask = 128;
|
||||
b++;
|
||||
mask = 128;
|
||||
while(len > 0) {
|
||||
if(*b & mask) {
|
||||
u8g2->draw_color = color;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
} else if(u8g2->bitmap_transparency == 0) {
|
||||
u8g2->draw_color = ncolor;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
}
|
||||
|
||||
x++;
|
||||
mask >>= 1;
|
||||
if(mask == 0) {
|
||||
mask = 128;
|
||||
b++;
|
||||
}
|
||||
len--;
|
||||
}
|
||||
len--;
|
||||
}
|
||||
u8g2->draw_color = color;
|
||||
u8g2->draw_color = color;
|
||||
}
|
||||
|
||||
|
||||
/* u8glib compatible bitmap draw function */
|
||||
void u8g2_DrawBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t cnt, u8g2_uint_t h, const uint8_t *bitmap)
|
||||
{
|
||||
u8g2_uint_t w;
|
||||
w = cnt;
|
||||
w *= 8;
|
||||
void u8g2_DrawBitmap(
|
||||
u8g2_t* u8g2,
|
||||
u8g2_uint_t x,
|
||||
u8g2_uint_t y,
|
||||
u8g2_uint_t cnt,
|
||||
u8g2_uint_t h,
|
||||
const uint8_t* bitmap) {
|
||||
u8g2_uint_t w;
|
||||
w = cnt;
|
||||
w *= 8;
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if ( u8g2_IsIntersection(u8g2, x, y, x+w, y+h) == 0 )
|
||||
return;
|
||||
if(u8g2_IsIntersection(u8g2, x, y, x + w, y + h) == 0) return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g2_DrawHorizontalBitmap(u8g2, x, y, w, bitmap);
|
||||
bitmap += cnt;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void u8g2_DrawHXBM(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b)
|
||||
{
|
||||
uint8_t mask;
|
||||
uint8_t color = u8g2->draw_color;
|
||||
uint8_t ncolor = (color == 0 ? 1 : 0);
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if ( u8g2_IsIntersection(u8g2, x, y, x+len, y+1) == 0 )
|
||||
return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
mask = 1;
|
||||
while(len > 0) {
|
||||
if ( *b & mask ) {
|
||||
u8g2->draw_color = color;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
} else if ( u8g2->bitmap_transparency == 0 ) {
|
||||
u8g2->draw_color = ncolor;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
while(h > 0) {
|
||||
u8g2_DrawHorizontalBitmap(u8g2, x, y, w, bitmap);
|
||||
bitmap += cnt;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
x++;
|
||||
mask <<= 1;
|
||||
if ( mask == 0 )
|
||||
{
|
||||
mask = 1;
|
||||
b++;
|
||||
}
|
||||
len--;
|
||||
}
|
||||
u8g2->draw_color = color;
|
||||
}
|
||||
|
||||
|
||||
void u8g2_DrawXBM(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h, const uint8_t *bitmap)
|
||||
{
|
||||
u8g2_uint_t blen;
|
||||
blen = w;
|
||||
blen += 7;
|
||||
blen >>= 3;
|
||||
void u8g2_DrawHXBM(u8g2_t* u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t* b) {
|
||||
uint8_t mask;
|
||||
uint8_t color = u8g2->draw_color;
|
||||
uint8_t ncolor = (color == 0 ? 1 : 0);
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if ( u8g2_IsIntersection(u8g2, x, y, x+w, y+h) == 0 )
|
||||
return;
|
||||
if(u8g2_IsIntersection(u8g2, x, y, x + len, y + 1) == 0) return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g2_DrawHXBM(u8g2, x, y, w, bitmap);
|
||||
bitmap += blen;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void u8g2_DrawHXBMP(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b)
|
||||
{
|
||||
uint8_t mask;
|
||||
uint8_t color = u8g2->draw_color;
|
||||
uint8_t ncolor = (color == 0 ? 1 : 0);
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if ( u8g2_IsIntersection(u8g2, x, y, x+len, y+1) == 0 )
|
||||
return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
mask = 1;
|
||||
while(len > 0)
|
||||
{
|
||||
if( u8x8_pgm_read(b) & mask ) {
|
||||
u8g2->draw_color = color;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
} else if( u8g2->bitmap_transparency == 0 ) {
|
||||
u8g2->draw_color = ncolor;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
mask = 1;
|
||||
while(len > 0) {
|
||||
if(*b & mask) {
|
||||
u8g2->draw_color = color;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
} else if(u8g2->bitmap_transparency == 0) {
|
||||
u8g2->draw_color = ncolor;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
}
|
||||
x++;
|
||||
mask <<= 1;
|
||||
if(mask == 0) {
|
||||
mask = 1;
|
||||
b++;
|
||||
}
|
||||
len--;
|
||||
}
|
||||
|
||||
x++;
|
||||
mask <<= 1;
|
||||
if ( mask == 0 )
|
||||
{
|
||||
mask = 1;
|
||||
b++;
|
||||
}
|
||||
len--;
|
||||
}
|
||||
u8g2->draw_color = color;
|
||||
u8g2->draw_color = color;
|
||||
}
|
||||
|
||||
|
||||
void u8g2_DrawXBMP(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h, const uint8_t *bitmap)
|
||||
{
|
||||
u8g2_uint_t blen;
|
||||
blen = w;
|
||||
blen += 7;
|
||||
blen >>= 3;
|
||||
void u8g2_DrawXBM(
|
||||
u8g2_t* u8g2,
|
||||
u8g2_uint_t x,
|
||||
u8g2_uint_t y,
|
||||
u8g2_uint_t w,
|
||||
u8g2_uint_t h,
|
||||
const uint8_t* bitmap) {
|
||||
u8g2_uint_t blen;
|
||||
blen = w;
|
||||
blen += 7;
|
||||
blen >>= 3;
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if ( u8g2_IsIntersection(u8g2, x, y, x+w, y+h) == 0 )
|
||||
return;
|
||||
if(u8g2_IsIntersection(u8g2, x, y, x + w, y + h) == 0) return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g2_DrawHXBMP(u8g2, x, y, w, bitmap);
|
||||
bitmap += blen;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
|
||||
while(h > 0) {
|
||||
u8g2_DrawHXBM(u8g2, x, y, w, bitmap);
|
||||
bitmap += blen;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
void u8g2_DrawHXBMP(u8g2_t* u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t* b) {
|
||||
uint8_t mask;
|
||||
uint8_t color = u8g2->draw_color;
|
||||
uint8_t ncolor = (color == 0 ? 1 : 0);
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if(u8g2_IsIntersection(u8g2, x, y, x + len, y + 1) == 0) return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
mask = 1;
|
||||
while(len > 0) {
|
||||
if(u8x8_pgm_read(b) & mask) {
|
||||
u8g2->draw_color = color;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
} else if(u8g2->bitmap_transparency == 0) {
|
||||
u8g2->draw_color = ncolor;
|
||||
u8g2_DrawHVLine(u8g2, x, y, 1, 0);
|
||||
}
|
||||
|
||||
x++;
|
||||
mask <<= 1;
|
||||
if(mask == 0) {
|
||||
mask = 1;
|
||||
b++;
|
||||
}
|
||||
len--;
|
||||
}
|
||||
u8g2->draw_color = color;
|
||||
}
|
||||
|
||||
void u8g2_DrawXBMP(
|
||||
u8g2_t* u8g2,
|
||||
u8g2_uint_t x,
|
||||
u8g2_uint_t y,
|
||||
u8g2_uint_t w,
|
||||
u8g2_uint_t h,
|
||||
const uint8_t* bitmap) {
|
||||
u8g2_uint_t blen;
|
||||
blen = w;
|
||||
blen += 7;
|
||||
blen >>= 3;
|
||||
#ifdef U8G2_WITH_INTERSECTION
|
||||
if(u8g2_IsIntersection(u8g2, x, y, x + w, y + h) == 0) return;
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
while(h > 0) {
|
||||
u8g2_DrawHXBMP(u8g2, x, y, w, bitmap);
|
||||
bitmap += blen;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user