Apply clang format for samples files (#833)

Apply clang format for c source files under samples folder
This commit is contained in:
Wenyong Huang
2021-11-15 12:48:35 +08:00
committed by GitHub
parent 37a14c9825
commit 3ded9ece83
58 changed files with 1261 additions and 957 deletions

View File

@ -13,7 +13,7 @@
* DEFINES
*********************/
#ifndef MONITOR_ZOOM
#define MONITOR_ZOOM 1
#define MONITOR_ZOOM 1
#endif
/**********************
@ -42,17 +42,18 @@ static int16_t last_y = 0;
/**
* Initialize the mouse
*/
void mouse_init(void)
{
}
void
mouse_init(void)
{}
/**
* Get the current position and state of the mouse
* @param data store the mouse data here
* @return false: because the points are not buffered, so no more data to be read
* @return false: because the points are not buffered, so no more data to be
* read
*/
bool mouse_read(lv_indev_data_t * data)
bool
mouse_read(lv_indev_data_t *data)
{
/*Store the collected data*/
data->point.x = last_x;
@ -65,27 +66,27 @@ bool mouse_read(lv_indev_data_t * data)
/**
* It will be called from the main SDL thread
*/
void mouse_handler(SDL_Event * event)
void
mouse_handler(SDL_Event *event)
{
switch (event->type) {
case SDL_MOUSEBUTTONUP:
if (event->button.button == SDL_BUTTON_LEFT)
left_button_down = false;
break;
case SDL_MOUSEBUTTONDOWN:
if (event->button.button == SDL_BUTTON_LEFT) {
left_button_down = true;
case SDL_MOUSEBUTTONUP:
if (event->button.button == SDL_BUTTON_LEFT)
left_button_down = false;
break;
case SDL_MOUSEBUTTONDOWN:
if (event->button.button == SDL_BUTTON_LEFT) {
left_button_down = true;
last_x = event->motion.x / MONITOR_ZOOM;
last_y = event->motion.y / MONITOR_ZOOM;
}
break;
case SDL_MOUSEMOTION:
last_x = event->motion.x / MONITOR_ZOOM;
last_y = event->motion.y / MONITOR_ZOOM;
}
break;
case SDL_MOUSEMOTION:
last_x = event->motion.x / MONITOR_ZOOM;
last_y = event->motion.y / MONITOR_ZOOM;
break;
break;
}
}
/**********************

View File

@ -43,18 +43,22 @@ extern "C" {
/**
* Initialize the mouse
*/
void mouse_init(void);
void
mouse_init(void);
/**
* Get the current position and state of the mouse
* @param data store the mouse data here
* @return false: because the points are not buffered, so no more data to be read
* @return false: because the points are not buffered, so no more data to be
* read
*/
bool mouse_read(lv_indev_data_t * data);
bool
mouse_read(lv_indev_data_t *data);
/**
* It will be called from the main SDL thread
*/
void mouse_handler(SDL_Event *event);
void
mouse_handler(SDL_Event *event);
/**********************
* MACROS