Skip to content
Snippets Groups Projects
Commit 7bd6f1cf authored by Mateusz Zalega's avatar Mateusz Zalega
Browse files

coding style: reformatted files modified by the fb & gfx refactor

parent 7cf1d51c
No related branches found
No related tags found
1 merge request!70fb & gfx rework
Pipeline #1854 passed
......@@ -51,8 +51,9 @@ int main(void)
card10_init();
card10_diag();
gfx_copy_region_raw(&display_screen, 0, 0, 160, 80,
2, (const void *)(Heart));
gfx_copy_region_raw(
&display_screen, 0, 0, 160, 80, 2, (const void *)(Heart)
);
gfx_update(&display_screen);
/* TODO: Move this to its own function */
......
......@@ -73,8 +73,15 @@ int epic_disp_line(
return cl;
} else {
/* TODO add linestyle support to gfx code */
gfx_thick_line(&display_screen, xstart, ystart, xend, yend,
pixelsize, color);
gfx_thick_line(
&display_screen,
xstart,
ystart,
xend,
yend,
pixelsize,
color
);
return 0;
}
}
......@@ -94,12 +101,25 @@ int epic_disp_rect(
switch (fillstyle) {
case FILLSTYLE_EMPTY:
gfx_rectangle(&display_screen, xstart, ystart, xend - xstart,
yend - ystart, pixelsize, color);
gfx_rectangle(
&display_screen,
xstart,
ystart,
xend - xstart,
yend - ystart,
pixelsize,
color
);
break;
case FILLSTYLE_FILLED:
gfx_rectangle_fill(&display_screen, xstart, ystart,
xend - xstart, yend - ystart, color);
gfx_rectangle_fill(
&display_screen,
xstart,
ystart,
xend - xstart,
yend - ystart,
color
);
break;
}
return 0;
......
......@@ -65,8 +65,9 @@ int main(void)
gas_sensor.power_mode = BME680_FORCED_MODE;
/* Set the required sensor settings needed */
set_required_settings = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_FILTER_SEL
| BME680_GAS_SENSOR_SEL;
set_required_settings = BME680_OST_SEL | BME680_OSP_SEL |
BME680_OSH_SEL | BME680_FILTER_SEL |
BME680_GAS_SENSOR_SEL;
/* Set the desired sensor configuration */
rslt = bme680_set_sensor_settings(set_required_settings, &gas_sensor);
......@@ -82,8 +83,10 @@ int main(void)
struct bme680_field_data data;
rslt = bme680_get_sensor_data(&data, &gas_sensor);
printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ", data.temperature / 100.0l,
data.pressure / 100.0l, data.humidity / 1000.0l );
printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ",
data.temperature / 100.0l,
data.pressure / 100.0l,
data.humidity / 1000.0l);
char buf[128];
sprintf(buf, "T: %.2Lf degC", data.temperature / 100.0l);
......@@ -101,7 +104,15 @@ int main(void)
if (data.status & BME680_GASM_VALID_MSK) {
printf(", G: %ld ohms", data.gas_resistance);
sprintf(buf, "G: %ld ohms", data.gas_resistance);
gfx_puts(&Font16, &display_screen, 0, 48, buf, white, black);
gfx_puts(
&Font16,
&display_screen,
0,
48,
buf,
white,
black
);
}
gfx_update(&display_screen);
......
......@@ -41,28 +41,6 @@ int main(void)
card10_init();
pmic_set_button_callback(pmic_button);
printf("Erasing bootloader.\n");
Paint_DrawString_EN(
0, 16 * 0, "Erasing bootloader", &Font16, 0x0000, 0xffff
);
LCD_Update();
ICC_Disable();
int ret = FLC_MultiPageErase(0x10000000, 0x10000000 + 1024 * 64 - 1);
if (ret != E_NO_ERROR) {
printf("FLC_MultiPageErase failed with %d\n", ret);
Paint_DrawString_EN(
0, 16 * 1, "Fail.", &Font16, 0x0000, 0xffff
);
LCD_Update();
while (1)
;
}
card10_init();
pmic_set_button_callback(pmic_button);
printf("Erasing bootloader.\n");
txt_puts(&display_textb, "Erasing bootloader.\n");
......@@ -72,18 +50,23 @@ int main(void)
if (ret != E_NO_ERROR) {
printf("FLC_MultiPageErase failed with %d\n", ret);
txt_puts(&display_textb, "Fail.\n");
while(1);
while (1)
;
}
printf("Writing bootloader.\n");
txt_puts(&display_textb, "Writing bootloader.\n");
ret = FLC_Write(0x10000000, sizeof(bootloader_data), (uint32_t *)bootloader_data);
ret = FLC_Write(
0x10000000,
sizeof(bootloader_data),
(uint32_t *)bootloader_data
);
if (ret != E_NO_ERROR) {
printf("FLC_Write failed with %d\n", ret);
txt_puts(&display_textb, "Fail.\n");
while(1);
while (1)
;
}
ICC_Enable();
......
......@@ -22,8 +22,9 @@ int main(void)
card10_init();
card10_diag();
gfx_copy_region_raw(&display_screen, 0, 0, 160, 80, 2,
(const void *)(Heart));
gfx_copy_region_raw(
&display_screen, 0, 0, 160, 80, 2, (const void *)(Heart)
);
gfx_update(&display_screen);
// Release core1
......
......@@ -158,9 +158,10 @@ static void clear(void)
static void set(uint8_t index, int8_t val)
{
if(val < -Y_SCALE) val = -Y_SCALE;
if(val > Y_SCALE) val = Y_SCALE;
if (val < -Y_SCALE)
val = -Y_SCALE;
if (val > Y_SCALE)
val = Y_SCALE;
int8_t pos = Y_OFFSET + val;
......@@ -195,11 +196,20 @@ void update(void)
int16_t scale = max / Y_SCALE + 1;
char buf[128];
sprintf(buf, "Switch: %d Pull: %d Scale: %d", ecg_switch, internal_pull, scale);
gfx_puts(&Font8, &display_screen, 0, 0, buf,
sprintf(buf,
"Switch: %d Pull: %d Scale: %d",
ecg_switch,
internal_pull,
scale);
gfx_puts(
&Font8,
&display_screen,
0,
0,
buf,
gfx_color(&display_screen, WHITE),
gfx_color(&display_screen, BLACK));
gfx_color(&display_screen, BLACK)
);
for (int i = 0; i < SIZE_X; i++) {
set(i, (samples[i] / scale));
......
......@@ -30,8 +30,9 @@ int main(void)
card10_init();
card10_diag();
gfx_copy_region_raw(&display_screen, 0, 0, 160, 80, 2,
(const void *)(Heart));
gfx_copy_region_raw(
&display_screen, 0, 0, 160, 80, 2, (const void *)(Heart)
);
gfx_update(&display_screen);
for (int i = 0; i < 11; i++) {
......
......@@ -69,27 +69,25 @@ void draw_arrow(int angle, int color)
}
/***** Functions *****/
static void sensors_callback_orientation(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id)
{
static void sensors_callback_orientation(
bhy_data_generic_t *sensor_data, bhy_virtual_sensor_t sensor_id
) {
static int prev = -1;
printf("azimuth=%05d, pitch=%05d, roll=%05d status=%d\n",
sensor_data->data_vector.x * 360 / 32768,
sensor_data->data_vector.y * 360 / 32768,
sensor_data->data_vector.z * 360 / 32768,
sensor_data->data_vector.status
);
sensor_data->data_vector.status);
int angle = sensor_data->data_vector.x * 360 / 32768;
if (angle != prev) {
gfx_clear(&display_screen);
int colors[] = {
gfx_color(&display_screen, RED),
int colors[] = { gfx_color(&display_screen, RED),
gfx_color(&display_screen, YELLOW),
gfx_color(&display_screen, YELLOW),
gfx_color(&display_screen, GREEN)
};
gfx_color(&display_screen, GREEN) };
int color = colors[sensor_data->data_vector.status];
draw_arrow(sensor_data->data_vector.x * 360 / 32768, color);
......@@ -98,8 +96,15 @@ static void sensors_callback_orientation(bhy_data_generic_t * sensor_data, bhy_v
//Paint_DrawString_EN(0, 0, buf, &Font12, BLACK, color);
sprintf(buf, "%3d", angle);
gfx_puts(&Font24, &display_screen, 0, 30, buf, color,
gfx_color(&display_screen, BLACK));
gfx_puts(
&Font24,
&display_screen,
0,
30,
buf,
color,
gfx_color(&display_screen, BLACK)
);
gfx_circle(&display_screen, 57, 35, 4, 2, color);
gfx_update(&display_screen);
......
......@@ -37,10 +37,24 @@ int main(void)
gfx_thick_line(&display_screen, 100, 10, 70, 40, 2, yellow);
gfx_circle(&display_screen, 85, 25, 22, 2, green);
gfx_copy_region_raw(&display_screen, 120, 0, 40, 40, 2,
(const void *)(gImage_40X40));
gfx_copy_region_raw(&display_screen, 0, 0, 160, 80, 2,
(const void *)(gImage_160X80));
gfx_copy_region_raw(
&display_screen,
120,
0,
40,
40,
2,
(const void *)(gImage_40X40)
);
gfx_copy_region_raw(
&display_screen,
0,
0,
160,
80,
2,
(const void *)(gImage_160X80)
);
gfx_update(&display_screen);
DEV_Delay_ms(3000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment