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:
あく
2022-01-05 19:10:18 +03:00
committed by GitHub
parent c98e54da10
commit 389ff92cc1
899 changed files with 379245 additions and 373421 deletions
+189 -221
View File
@@ -58,7 +58,6 @@
UC1701
*/
#ifdef U8G2_WITH_HVLINE_SPEED_OPTIMIZATION
/*
@@ -69,125 +68,111 @@
asumption:
all clipping done
*/
void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
uint16_t offset;
uint8_t *ptr;
uint8_t bit_pos, mask;
uint8_t or_mask, xor_mask;
void u8g2_ll_hvline_vertical_top_lsb(
u8g2_t* u8g2,
u8g2_uint_t x,
u8g2_uint_t y,
u8g2_uint_t len,
uint8_t dir) {
uint16_t offset;
uint8_t* ptr;
uint8_t bit_pos, mask;
uint8_t or_mask, xor_mask;
#ifdef __unix
uint8_t *max_ptr = u8g2->tile_buf_ptr + u8g2_GetU8x8(u8g2)->display_info->tile_width*u8g2->tile_buf_height*8;
uint8_t* max_ptr = u8g2->tile_buf_ptr +
u8g2_GetU8x8(u8g2)->display_info->tile_width * u8g2->tile_buf_height * 8;
#endif
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = y; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 1;
mask <<= bit_pos;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
or_mask = 0;
xor_mask = 0;
if ( u8g2->draw_color <= 1 )
or_mask = mask;
if ( u8g2->draw_color != 1 )
xor_mask = mask;
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = y; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 1;
mask <<= bit_pos;
or_mask = 0;
xor_mask = 0;
if(u8g2->draw_color <= 1) or_mask = mask;
if(u8g2->draw_color != 1) xor_mask = mask;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset &= ~7;
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
ptr += x;
if ( dir == 0 )
{
do
{
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset &= ~7;
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
ptr += x;
if(dir == 0) {
do {
#ifdef __unix
assert(ptr < max_ptr);
assert(ptr < max_ptr);
#endif
*ptr |= or_mask;
*ptr ^= xor_mask;
ptr++;
len--;
} while( len != 0 );
}
else
{
do
{
*ptr |= or_mask;
*ptr ^= xor_mask;
ptr++;
len--;
} while(len != 0);
} else {
do {
#ifdef __unix
assert(ptr < max_ptr);
assert(ptr < max_ptr);
#endif
*ptr |= or_mask;
*ptr ^= xor_mask;
bit_pos++;
bit_pos &= 7;
*ptr |= or_mask;
*ptr ^= xor_mask;
len--;
bit_pos++;
bit_pos &= 7;
if ( bit_pos == 0 )
{
ptr+=u8g2->pixel_buf_width; /* 6 Jan 17: Changed u8g2->width to u8g2->pixel_buf_width, issue #148 */
if ( u8g2->draw_color <= 1 )
or_mask = 1;
if ( u8g2->draw_color != 1 )
xor_mask = 1;
}
else
{
or_mask <<= 1;
xor_mask <<= 1;
}
} while( len != 0 );
}
len--;
if(bit_pos == 0) {
ptr +=
u8g2->pixel_buf_width; /* 6 Jan 17: Changed u8g2->width to u8g2->pixel_buf_width, issue #148 */
if(u8g2->draw_color <= 1) or_mask = 1;
if(u8g2->draw_color != 1) xor_mask = 1;
} else {
or_mask <<= 1;
xor_mask <<= 1;
}
} while(len != 0);
}
}
#else /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */
/*
x,y position within the buffer
*/
static void u8g2_draw_pixel_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y)
{
uint16_t offset;
uint8_t *ptr;
uint8_t bit_pos, mask;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = y; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 1;
mask <<= bit_pos;
static void u8g2_draw_pixel_vertical_top_lsb(u8g2_t* u8g2, u8g2_uint_t x, u8g2_uint_t y) {
uint16_t offset;
uint8_t* ptr;
uint8_t bit_pos, mask;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset &= ~7;
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
ptr += x;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = y; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 1;
mask <<= bit_pos;
if ( u8g2->draw_color <= 1 )
*ptr |= mask;
if ( u8g2->draw_color != 1 )
*ptr ^= mask;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset &= ~7;
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
ptr += x;
if(u8g2->draw_color <= 1) *ptr |= mask;
if(u8g2->draw_color != 1) *ptr ^= mask;
}
/*
@@ -198,29 +183,27 @@ static void u8g2_draw_pixel_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_u
asumption:
all clipping done
*/
void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
if ( dir == 0 )
{
do
{
u8g2_draw_pixel_vertical_top_lsb(u8g2, x, y);
x++;
len--;
} while( len != 0 );
}
else
{
do
{
u8g2_draw_pixel_vertical_top_lsb(u8g2, x, y);
y++;
len--;
} while( len != 0 );
}
void u8g2_ll_hvline_vertical_top_lsb(
u8g2_t* u8g2,
u8g2_uint_t x,
u8g2_uint_t y,
u8g2_uint_t len,
uint8_t dir) {
if(dir == 0) {
do {
u8g2_draw_pixel_vertical_top_lsb(u8g2, x, y);
x++;
len--;
} while(len != 0);
} else {
do {
u8g2_draw_pixel_vertical_top_lsb(u8g2, x, y);
y++;
len--;
} while(len != 0);
}
}
#endif /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */
/*=================================================*/
@@ -240,101 +223,87 @@ void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y,
all clipping done
*/
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
void u8g2_ll_hvline_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
uint16_t offset;
uint8_t *ptr;
uint8_t bit_pos;
uint8_t mask;
uint8_t tile_width = u8g2_GetU8x8(u8g2)->display_info->tile_width;
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
void u8g2_ll_hvline_horizontal_right_lsb(
u8g2_t* u8g2,
u8g2_uint_t x,
u8g2_uint_t y,
u8g2_uint_t len,
uint8_t dir) {
uint16_t offset;
uint8_t* ptr;
uint8_t bit_pos;
uint8_t mask;
uint8_t tile_width = u8g2_GetU8x8(u8g2)->display_info->tile_width;
bit_pos = x; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 128;
mask >>= bit_pos;
bit_pos = x; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 128;
mask >>= bit_pos;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset *= tile_width;
offset += x>>3;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
if ( dir == 0 )
{
do
{
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset *= tile_width;
offset += x >> 3;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
if ( u8g2->draw_color <= 1 )
*ptr |= mask;
if ( u8g2->draw_color != 1 )
*ptr ^= mask;
mask >>= 1;
if ( mask == 0 )
{
mask = 128;
ptr++;
}
//x++;
len--;
} while( len != 0 );
}
else
{
do
{
if ( u8g2->draw_color <= 1 )
*ptr |= mask;
if ( u8g2->draw_color != 1 )
*ptr ^= mask;
ptr += tile_width;
//y++;
len--;
} while( len != 0 );
}
if(dir == 0) {
do {
if(u8g2->draw_color <= 1) *ptr |= mask;
if(u8g2->draw_color != 1) *ptr ^= mask;
mask >>= 1;
if(mask == 0) {
mask = 128;
ptr++;
}
//x++;
len--;
} while(len != 0);
} else {
do {
if(u8g2->draw_color <= 1) *ptr |= mask;
if(u8g2->draw_color != 1) *ptr ^= mask;
ptr += tile_width;
//y++;
len--;
} while(len != 0);
}
}
#else /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */
/*
x,y position within the buffer
*/
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
static void u8g2_draw_pixel_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y)
{
uint16_t offset;
uint8_t *ptr;
uint8_t bit_pos, mask;
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
static void u8g2_draw_pixel_horizontal_right_lsb(u8g2_t* u8g2, u8g2_uint_t x, u8g2_uint_t y) {
uint16_t offset;
uint8_t* ptr;
uint8_t bit_pos, mask;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = x; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 128;
mask >>= bit_pos;
x >>= 3;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
offset += x;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = x; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 128;
mask >>= bit_pos;
x >>= 3;
if ( u8g2->draw_color <= 1 )
*ptr |= mask;
if ( u8g2->draw_color != 1 )
*ptr ^= mask;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
offset += x;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
if(u8g2->draw_color <= 1) *ptr |= mask;
if(u8g2->draw_color != 1) *ptr ^= mask;
}
/*
@@ -345,27 +314,26 @@ static void u8g2_draw_pixel_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8
asumption:
all clipping done
*/
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
void u8g2_ll_hvline_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
if ( dir == 0 )
{
do
{
u8g2_draw_pixel_horizontal_right_lsb(u8g2, x, y);
x++;
len--;
} while( len != 0 );
}
else
{
do
{
u8g2_draw_pixel_horizontal_right_lsb(u8g2, x, y);
y++;
len--;
} while( len != 0 );
}
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
void u8g2_ll_hvline_horizontal_right_lsb(
u8g2_t* u8g2,
u8g2_uint_t x,
u8g2_uint_t y,
u8g2_uint_t len,
uint8_t dir) {
if(dir == 0) {
do {
u8g2_draw_pixel_horizontal_right_lsb(u8g2, x, y);
x++;
len--;
} while(len != 0);
} else {
do {
u8g2_draw_pixel_horizontal_right_lsb(u8g2, x, y);
y++;
len--;
} while(len != 0);
}
}
#endif /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */