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
+55 -45
View File
@@ -35,58 +35,68 @@
#include "u8g2.h"
void u8g2_DrawLine(u8g2_t* u8g2, u8g2_uint_t x1, u8g2_uint_t y1, u8g2_uint_t x2, u8g2_uint_t y2) {
u8g2_uint_t tmp;
u8g2_uint_t x, y;
u8g2_uint_t dx, dy;
u8g2_int_t err;
u8g2_int_t ystep;
void u8g2_DrawLine(u8g2_t *u8g2, u8g2_uint_t x1, u8g2_uint_t y1, u8g2_uint_t x2, u8g2_uint_t y2)
{
u8g2_uint_t tmp;
u8g2_uint_t x,y;
u8g2_uint_t dx, dy;
u8g2_int_t err;
u8g2_int_t ystep;
uint8_t swapxy = 0;
uint8_t swapxy = 0;
/* no intersection check at the moment, should be added... */
/* no intersection check at the moment, should be added... */
if ( x1 > x2 ) dx = x1-x2; else dx = x2-x1;
if ( y1 > y2 ) dy = y1-y2; else dy = y2-y1;
if(x1 > x2)
dx = x1 - x2;
else
dx = x2 - x1;
if(y1 > y2)
dy = y1 - y2;
else
dy = y2 - y1;
if ( dy > dx )
{
swapxy = 1;
tmp = dx; dx =dy; dy = tmp;
tmp = x1; x1 =y1; y1 = tmp;
tmp = x2; x2 =y2; y2 = tmp;
}
if ( x1 > x2 )
{
tmp = x1; x1 =x2; x2 = tmp;
tmp = y1; y1 =y2; y2 = tmp;
}
err = dx >> 1;
if ( y2 > y1 ) ystep = 1; else ystep = -1;
y = y1;
if(dy > dx) {
swapxy = 1;
tmp = dx;
dx = dy;
dy = tmp;
tmp = x1;
x1 = y1;
y1 = tmp;
tmp = x2;
x2 = y2;
y2 = tmp;
}
if(x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
tmp = y1;
y1 = y2;
y2 = tmp;
}
err = dx >> 1;
if(y2 > y1)
ystep = 1;
else
ystep = -1;
y = y1;
#ifndef U8G2_16BIT
if ( x2 == 255 )
x2--;
#ifndef U8G2_16BIT
if(x2 == 255) x2--;
#else
if ( x2 == 0xffff )
x2--;
if(x2 == 0xffff) x2--;
#endif
for( x = x1; x <= x2; x++ )
{
if ( swapxy == 0 )
u8g2_DrawPixel(u8g2, x, y);
else
u8g2_DrawPixel(u8g2, y, x);
err -= (uint8_t)dy;
if ( err < 0 )
{
y += (u8g2_uint_t)ystep;
err += (u8g2_uint_t)dx;
for(x = x1; x <= x2; x++) {
if(swapxy == 0)
u8g2_DrawPixel(u8g2, x, y);
else
u8g2_DrawPixel(u8g2, y, x);
err -= (uint8_t)dy;
if(err < 0) {
y += (u8g2_uint_t)ystep;
err += (u8g2_uint_t)dx;
}
}
}
}