rad1o: apply Linux kernel style clang-format

This commit is contained in:
schneider
2022-01-10 23:42:52 +01:00
parent 7bf55dc983
commit 8a013172b2
14 changed files with 3994 additions and 3989 deletions

View File

@ -96,17 +96,21 @@ uint8_t* rad1o_pk_decode(const uint8_t* ldata, int* len)
*bufptr |= 1 << (7 - pos); *bufptr |= 1 << (7 - pos);
}; };
pos++; pos++;
if (((bufptr - charBuf) % height) == (height - 1) && (pos == hoff)) { if (((bufptr - charBuf) % height) == (height - 1) &&
(pos == hoff)) {
// Finish incomplete last byte per column // Finish incomplete last byte per column
pos = 8; pos = 8;
}; };
if (pos == 8) { if (pos == 8) {
bufptr++; bufptr++;
if ((bufptr - charBuf) % height == 0) { // End of column? if ((bufptr - charBuf) % height ==
0) { // End of column?
while (repeat > 0) { while (repeat > 0) {
for (int y = 0; y < height; y++) { for (int y = 0; y < height;
bufptr[0] = bufptr[-height]; y++) {
bufptr[0] =
bufptr[-height];
bufptr++; bufptr++;
}; };
repeat--; repeat--;

View File

@ -44,15 +44,9 @@ static void select()
uint8_t serial_clock_rate = 1; uint8_t serial_clock_rate = 1;
uint8_t clock_prescale_rate = 12; uint8_t clock_prescale_rate = 12;
ssp_init(LCD_SSP, ssp_init(LCD_SSP, SSP_DATA_9BITS, SSP_FRAME_SPI, SSP_CPOL_0_CPHA_0,
SSP_DATA_9BITS, serial_clock_rate, clock_prescale_rate, SSP_MODE_NORMAL,
SSP_FRAME_SPI, SSP_MASTER, SSP_SLAVE_OUT_ENABLE);
SSP_CPOL_0_CPHA_0,
serial_clock_rate,
clock_prescale_rate,
SSP_MODE_NORMAL,
SSP_MASTER,
SSP_SLAVE_OUT_ENABLE);
gpio_clear(&gpio_lcd_cs); gpio_clear(&gpio_lcd_cs);
} }
@ -98,11 +92,13 @@ void rad1o_lcdInit(void)
0x25, 0x3a, // set contrast 0x25, 0x3a, // set contrast
0x29, // display on 0x29, // display on
0x03, // BSTRON (booster voltage) 0x03, // BSTRON (booster voltage)
0x2A, 1, RESX, 0x2A, 1, RESX, 0x2B, 1, RESY
0x2B, 1, RESY
}; };
uint16_t initseq_c = ~(/* commands: 1, data: 0 */ uint16_t initseq_c = ~(/* commands: 1, data: 0 */
(1 << 0) | (1 << 1) | (0 << 2) | (1 << 3) | (0 << 4) | (1 << 5) | (0 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (0 << 10) | (0 << 11) | (1 << 12) | (0 << 13) | (0 << 14) | 0); (1 << 0) | (1 << 1) | (0 << 2) | (1 << 3) |
(0 << 4) | (1 << 5) | (0 << 6) | (1 << 7) |
(1 << 8) | (1 << 9) | (0 << 10) | (0 << 11) |
(1 << 12) | (0 << 13) | (0 << 14) | 0);
write(0, 0x01); /* most color displays need the pause */ write(0, 0x01); /* most color displays need the pause */
delayms(10); delayms(10);

View File

@ -35,17 +35,18 @@ int rad1o_getFontHeight(void)
return 8; // XXX: Should be done right. return 8; // XXX: Should be done right.
} }
static int static int _getIndex(int c)
_getIndex(int c)
{ {
#define ERRCHR (font->u8FirstChar + 1) #define ERRCHR (font->u8FirstChar + 1)
/* Does this font provide this character? */ /* Does this font provide this character? */
if (c < font->u8FirstChar) if (c < font->u8FirstChar)
c = ERRCHR; c = ERRCHR;
if (c > font->u8LastChar && efont.type != FONT_EXTERNAL && font->charExtra == NULL) if (c > font->u8LastChar && efont.type != FONT_EXTERNAL &&
font->charExtra == NULL)
c = ERRCHR; c = ERRCHR;
if (c > font->u8LastChar && (efont.type == FONT_EXTERNAL || font->charExtra != NULL)) { if (c > font->u8LastChar &&
(efont.type == FONT_EXTERNAL || font->charExtra != NULL)) {
int cc = 0; int cc = 0;
while (font->charExtra[cc] < c) while (font->charExtra[cc] < c)
cc++; cc++;
@ -90,13 +91,15 @@ int rad1o_DoChar(int sx, int sy, int c)
for (int y = 0; y < c; y++) for (int y = 0; y < c; y++)
toff += font->charInfo[y].widthBits; toff += font->charInfo[y].widthBits;
width = font->charInfo[c].widthBits; width = font->charInfo[c].widthBits;
if (font->au8FontTable[toff] >> 4 == 15) { // It's a raw character! if (font->au8FontTable[toff] >> 4 ==
15) { // It's a raw character!
preblank = font->au8FontTable[toff + 1]; preblank = font->au8FontTable[toff + 1];
postblank = font->au8FontTable[toff + 2]; postblank = font->au8FontTable[toff + 2];
data = &font->au8FontTable[toff + 3]; data = &font->au8FontTable[toff + 3];
width = (width - 3 / height); width = (width - 3 / height);
} else { } else {
data = rad1o_pk_decode(&font->au8FontTable[toff], &width); data = rad1o_pk_decode(
&font->au8FontTable[toff], &width);
} }
} else { } else {
toff = (c)*font->u8Width * 1; toff = (c)*font->u8Width * 1;

View File

@ -3399,18 +3399,17 @@ const FONT_CHAR_INFO Ubuntu18ptLengths[] = {
{ 30 }, /* € */ { 30 }, /* € */
}; };
const uint16_t Ubuntu18ptExtra[] = { const uint16_t Ubuntu18ptExtra[] = { 196, 214, 220, 223, 228,
196, 214, 220, 223, 228, 246, 252, 8364, 65535 246, 252, 8364, 65535 };
};
/* Font info */ /* Font info */
const struct FONT_DEF Font_Ubuntu18pt = { const struct FONT_DEF Font_Ubuntu18pt = { 1, /* width (1 == comressed) */
1, /* width (1 == comressed) */
26, /* character height */ 26, /* character height */
32, /* first char */ 32, /* first char */
126, /* last char */ 126, /* last char */
Ubuntu18ptBitmaps, Ubuntu18ptLengths, Ubuntu18ptExtra Ubuntu18ptBitmaps,
}; Ubuntu18ptLengths,
Ubuntu18ptExtra };
/* Font metadata: /* Font metadata:
* Name: Ubuntu Regular 18pt * Name: Ubuntu Regular 18pt

View File

@ -271,12 +271,14 @@ static void rad1o_ui_set_bb_tx_vga_gain(const uint32_t gain_db)
ui_update(); ui_update();
} }
static void rad1o_ui_set_first_if_frequency(const uint64_t frequency __attribute__((unused))) static void rad1o_ui_set_first_if_frequency(const uint64_t frequency
__attribute__((unused)))
{ {
// Not implemented // Not implemented
} }
static void rad1o_ui_set_filter(const rf_path_filter_t filter __attribute__((unused))) static void rad1o_ui_set_filter(const rf_path_filter_t filter
__attribute__((unused)))
{ {
// Not implemented // Not implemented
} }
@ -286,7 +288,8 @@ static void rad1o_ui_set_antenna_bias(bool antenna_bias __attribute__((unused)))
// Not implemented // Not implemented
} }
static void rad1o_ui_set_clock_source(clock_source_t source __attribute__((unused))) static void rad1o_ui_set_clock_source(clock_source_t source
__attribute__((unused)))
{ {
// Not implemented // Not implemented
} }