From 3443c77d39697c2827f972a3b923dc2f30c2df51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Mon, 21 Jun 2021 13:15:27 +0200 Subject: [PATCH] docs: correct formatting --- image-viewer/include/coords.h | 55 +++---- image-viewer/include/cursor.h | 37 ++--- image-viewer/include/image.h | 57 +++---- image-viewer/include/image_loader.h | 49 +++--- image-viewer/include/image_viewer.h | 27 ++-- lib-gui/include/gui.h | 170 +++++++++++---------- lib-gui/include/gui_component_line.h | 27 ++-- lib-gui/include/gui_component_text.h | 26 ++-- lib-gui/include/gui_component_text_view.h | 50 +++--- lib-gui/include/renderer.h | 85 ++++++----- lib-pheripherals/include/direction.h | 5 +- lib-pheripherals/include/input.h | 38 ++--- lib-pheripherals/include/logger.h | 42 ++--- lib-pheripherals/include/mzapo_led_strip.h | 84 +++++----- lib-pheripherals/include/mzapo_phys.h | 6 +- lib-pheripherals/include/mzapo_rgb_led.h | 129 ++++++++-------- lib-pheripherals/include/nonblocking_io.h | 14 +- lib-pheripherals/include/xwin_sdl.h | 16 +- text-viewer/include/text_viewer.h | 16 +- 19 files changed, 479 insertions(+), 454 deletions(-) diff --git a/image-viewer/include/coords.h b/image-viewer/include/coords.h index 31fd9adce38e2ae4efea1d4d98996c83bc4253e1..0a60db3b05d49fd2dd53af62835e6cfc53da8ba1 100644 --- a/image-viewer/include/coords.h +++ b/image-viewer/include/coords.h @@ -1,6 +1,6 @@ -#include -#include "image.h" #include "display_utils.h" +#include "image.h" +#include typedef struct { int32_t x; @@ -9,48 +9,49 @@ typedef struct { /** * @brief Create coords with given x and y coordinates - * + * * @param x x coordinate * @param y y coordinate - * @return coords_t + * @return coords_t */ coords_t coords_create(int32_t x, int32_t y); /** * @brief Get begin coords on screen of given image and scale - * - * @param image - * @param zoom - * @return coords_t + * + * @param image + * @param zoom + * @return coords_t */ -coords_t coords_get_image_screen_beg_coord( - image_t *image, image_zoom_t zoom); +coords_t coords_get_image_screen_beg_coord(image_t *image, image_zoom_t zoom); /** * @brief Get end coords on screen of given image and scale - * - * @param image - * @param zoom - * @return coords_t + * + * @param image + * @param zoom + * @return coords_t */ coords_t coords_get_image_screen_end_coords(image_t *image, image_zoom_t zoom); /** - * @brief Map image coords to screen coords for given image and zoom - * - * @param image - * @param zoom - * @param image_coords - * @return coords_t + * @brief Map image coords to screen coords for given image and zoom + * + * @param image + * @param zoom + * @param image_coords + * @return coords_t */ -coords_t image_get_screen_coords(image_t *image, image_zoom_t zoom, coords_t image_coords); +coords_t image_get_screen_coords(image_t *image, image_zoom_t zoom, + coords_t image_coords); /** * @brief Map screen coords to image coords for given image and zoom - * - * @param image - * @param zoom - * @param screen_coords - * @return coords_t + * + * @param image + * @param zoom + * @param screen_coords + * @return coords_t */ -coords_t image_get_image_coords(image_t *image, image_zoom_t zoom, coords_t screen_coords); +coords_t image_get_image_coords(image_t *image, image_zoom_t zoom, + coords_t screen_coords); diff --git a/image-viewer/include/cursor.h b/image-viewer/include/cursor.h index 9e47600098ea9bb4ee105e75a30d155211ce1662..c049b93cf997a2129dfe1d6239f84cea1c198248 100644 --- a/image-viewer/include/cursor.h +++ b/image-viewer/include/cursor.h @@ -1,11 +1,11 @@ #ifndef __CURSOR_H__ #define __CURSOR_H__ +#include "direction.h" #include "display_utils.h" #include "image.h" -#include "direction.h" -#include #include +#include #define CURSOR_WIDTH 11 @@ -24,49 +24,52 @@ extern const display_pixel_t CURSOR_OUTLINE_COLOR; /** * @brief Create cursor - * - * @return cursor_t + * + * @return cursor_t */ cursor_t cursor_create(); /** * @brief Center cursor within region - * - * @param cursor + * + * @param cursor * @param region within to center the cursor */ void cursor_center(cursor_t *cursor, image_region_t region); /** * @brief Move cursor in given direction within region given - * - * @param cursor + * + * @param cursor * @param region to move cursor within, if cursor is outside, move it inside * @param direction what direction to move cursor to * @param amount how many steps to move * @return true cursor was moved * @return false cursor was not moved */ -bool cursor_move(cursor_t *cursor, image_region_t region, direction_t direction, int16_t amount); +bool cursor_move(cursor_t *cursor, image_region_t region, direction_t direction, + int16_t amount); /** * @brief Show cursor on display screen - * - * @param cursor + * + * @param cursor * @param image image to map image coords to screen coords * @param zoom zoom to map image coords to screen coords - * @param display + * @param display */ -void cursor_show(cursor_t *cursor, image_t *image, image_zoom_t zoom, display_t *display); +void cursor_show(cursor_t *cursor, image_t *image, image_zoom_t zoom, + display_t *display); /** * @brief Hide cursor shown on display - * - * @param cursor + * + * @param cursor * @param image image to map image coords to screen coords * @param zoom zoom to map image coords to screen coords - * @param display + * @param display */ -void cursor_hide(cursor_t *cursor, image_t *image, image_zoom_t zoom, display_t *display); +void cursor_hide(cursor_t *cursor, image_t *image, image_zoom_t zoom, + display_t *display); #endif // __CURSOR_H__ diff --git a/image-viewer/include/image.h b/image-viewer/include/image.h index 1008c4d96ee57ffc90b68b9b07026a7e2bd3bc9a..ea16768192194cb101df81a9f2b3dde881848828 100644 --- a/image-viewer/include/image.h +++ b/image-viewer/include/image.h @@ -1,16 +1,16 @@ #ifndef __IMAGE_H__ #define __IMAGE_H__ -#include -#include #include +#include #include +#include #include #include -#include "display_utils.h" #include "direction.h" +#include "display_utils.h" typedef enum { IMG_UNKNOWN, @@ -55,33 +55,33 @@ typedef struct { /** * @brief Create image with given path - * + * * @param path path to image file - * @return image_t + * @return image_t */ image_t image_create(char *path); /** * @brief Clean up image data - * - * @param image + * + * @param image */ void image_destroy(image_t *image); /** * @brief Get image pixel on coords - * - * @param image + * + * @param image * @param x x coordinate of pixel * @param y y coordinate of pixel - * @return display_pixel_t + * @return display_pixel_t */ display_pixel_t image_get_pixel(image_t *image, uint16_t x, uint16_t y); /** * @brief Set image pixel on coords - * - * @param image + * + * @param image * @param x x coords of pixel * @param y y coords of pixel * @param pixel pixel to set @@ -91,42 +91,43 @@ void image_set_pixel(image_t *image, uint16_t x, uint16_t y, /** * @brief Create image region - * + * * @param x begin x coord * @param y begin y coord * @param width width of the region * @param height height of the region - * @return image_region_t + * @return image_region_t */ -image_region_t image_region_create(uint16_t x, uint16_t y, uint16_t width, uint16_t height); +image_region_t image_region_create(uint16_t x, uint16_t y, uint16_t width, + uint16_t height); bool image_region_move_within(image_region_t *to_move, direction_t direction, int amount, image_region_t *border); /** * @brief Write image data to display data - * - * @param image - * @param display - * @param scale - * @return image_zoom_t + * + * @param image + * @param display + * @param scale + * @return image_zoom_t */ image_zoom_t image_write_to_display(image_t *image, display_t *display, - image_zoom_t scale); + image_zoom_t scale); /** * @brief Get initial zoom to show whole image on the display - * - * @param image - * @return image_zoom_t + * + * @param image + * @return image_zoom_t */ image_zoom_t image_get_initial_zoom(image_t *image); /** * @brief Get shown region from image and zoom - * - * @param image - * @param zoom - * @return image_region_t + * + * @param image + * @param zoom + * @return image_region_t */ image_region_t image_get_zoom_region(image_t *image, image_zoom_t zoom); diff --git a/image-viewer/include/image_loader.h b/image-viewer/include/image_loader.h index 34607296b9edc16eca808fbdff2d71f67970fa9f..93632a75fd88967457166ccbedbddab7203f8502 100644 --- a/image-viewer/include/image_loader.h +++ b/image-viewer/include/image_loader.h @@ -7,52 +7,53 @@ typedef void (*image_load_callback)(void *state, double process); /** * @brief Load image from any supported types - * - * @param image - * @param callback - * @param state - * @return image_error_t + * + * @param image + * @param callback + * @param state + * @return image_error_t */ -image_error_t image_loader_load(image_t *image, image_load_callback callback, void *state); +image_error_t image_loader_load(image_t *image, image_load_callback callback, + void *state); /** * @brief Load image from ppm format - * - * @param image - * @param callback - * @param state - * @return image_error_t + * + * @param image + * @param callback + * @param state + * @return image_error_t */ image_error_t image_loader_load_ppm(image_t *image, image_load_callback callback, void *state); /** * @brief Load image from jpeg format - * - * @param image - * @param callback - * @param state - * @return image_error_t + * + * @param image + * @param callback + * @param state + * @return image_error_t */ image_error_t image_loader_load_jpeg(image_t *image, image_load_callback callback, void *state); /** * @brief Load image from png - * - * @param image - * @param callback - * @param state - * @return image_error_t + * + * @param image + * @param callback + * @param state + * @return image_error_t */ image_error_t image_loader_load_png(image_t *image, image_load_callback callback, void *state); /** * @brief Deduce image type from magic number - * - * @param image - * @return image_error_t + * + * @param image + * @return image_error_t */ image_error_t image_deduce_type(image_t *image); diff --git a/image-viewer/include/image_viewer.h b/image-viewer/include/image_viewer.h index d1b2c9a25a7d747936a4c745438b548e0baa29b1..cd51cacc0631b8c9e7a8396fe39f12a1a6effba3 100644 --- a/image-viewer/include/image_viewer.h +++ b/image-viewer/include/image_viewer.h @@ -1,12 +1,12 @@ #ifndef __IMAGE_VIEWER_H__ #define __IMAGE_VIEWER_H__ -#include -#include "image.h" -#include "display_utils.h" #include "cursor.h" +#include "display_utils.h" +#include "image.h" #include "logger.h" #include "mzapo_led_strip.h" +#include typedef enum { MOD_CURSOR, @@ -36,34 +36,35 @@ typedef struct { /** * @brief Create image viewer - * + * * @param filename file with image * @param display display to show image on * @param logger logger to log to * @param ledstrip ledstrip to show loading progress and position in image - * @return image_viewer_t + * @return image_viewer_t */ -image_viewer_t image_viewer_create(char *filename, display_t *display, logger_t *logger, mzapo_ledstrip_t ledstrip); +image_viewer_t image_viewer_create(char *filename, display_t *display, + logger_t *logger, mzapo_ledstrip_t ledstrip); /** * @brief Clean up image viewer data - * - * @param viewer + * + * @param viewer */ void image_viewer_destroy(image_viewer_t *viewer); /** * @brief Start render loop with handling input - * - * @param viewer - * @param reg_knobs_base base address of reg knobs + * + * @param viewer + * @param reg_knobs_base base address of reg knobs */ void image_viewer_start_loop(image_viewer_t *viewer, void *reg_knobs_base); /** * @brief Display image on display - * - * @param viewer + * + * @param viewer */ void image_viewer_display_image(image_viewer_t *viewer); diff --git a/lib-gui/include/gui.h b/lib-gui/include/gui.h index 1f1bfaa494e4bb0c87761adbcd80eeed351668f6..6b8a506e930eb7ca5a0f1f8a097590f328bb3c17 100644 --- a/lib-gui/include/gui.h +++ b/lib-gui/include/gui.h @@ -93,206 +93,210 @@ struct gui_t { /** * @brief Create gui state - * - * @param logger - * @param commands - * @param renderer - * @param pheripherals - * @return gui_t + * + * @param logger + * @param commands + * @param renderer + * @param pheripherals + * @return gui_t */ -gui_t gui_create(logger_t *logger, commands_t *commands, - renderer_t *renderer, mzapo_pheripherals_t *pheripherals); +gui_t gui_create(logger_t *logger, commands_t *commands, renderer_t *renderer, + mzapo_pheripherals_t *pheripherals); /** * @brief Render all elements in gui - * - * @param gui + * + * @param gui */ void gui_render(gui_t *gui); /** * @brief Update all elements in gui - * - * @param gui + * + * @param gui */ void gui_update(gui_t *gui); /** * @brief Set gui active window - * - * @param gui - * @param window + * + * @param gui + * @param window */ void gui_set_active_window(gui_t *gui, window_t *window); // gui_window.c /** * @brief Create new gui window - * + * * @param containers array of containers of static size * @param size maximal number of the containers - * @return window_t + * @return window_t */ window_t gui_window_create(container_t *containers, uint16_t size); /** * @brief Add container to window - * - * @param window - * @param container - * @return container_t* + * + * @param window + * @param container + * @return container_t* */ container_t *gui_window_add_container(window_t *window, container_t container); // gui_container.c /** * @brief Render all elements inside container - * - * @param gui - * @param container + * + * @param gui + * @param container */ void gui_container_render(gui_t *gui, container_t *container); /** * @brief Update all elements inside container - * - * @param gui - * @param container + * + * @param gui + * @param container */ void gui_container_update(gui_t *gui, container_t *container); // gui_component.c /** * @brief Create gui component - * + * * @param x begin x coord * @param y begin y coord * @param w width * @param h height - * @param render - * @param update - * @return component_t + * @param render + * @param update + * @return component_t */ -component_t gui_component_create(int16_t x, int16_t y, uint16_t w, uint16_t h, render_function render, update_function update); +component_t gui_component_create(int16_t x, int16_t y, uint16_t w, uint16_t h, + render_function render, + update_function update); /** * @brief Check whether component is within screen so it may be rendered - * - * @param gui - * @param container - * @param component - * @return true - * @return false + * + * @param gui + * @param container + * @param component + * @return true + * @return false */ bool gui_is_component_visible(gui_t *gui, container_t *container, component_t *component); /** * @brief Render gui component - * - * @param gui - * @param container - * @param component + * + * @param gui + * @param container + * @param component */ void gui_component_render(gui_t *gui, container_t *container, component_t *component); /** - * @brief Update gui component - * - * @param gui - * @param container - * @param component + * @brief Update gui component + * + * @param gui + * @param container + * @param component */ void gui_component_update(gui_t *gui, container_t *container, component_t *component); /** * @brief Get absolute position of component - * - * @param container - * @param component - * @return coords_t + * + * @param container + * @param component + * @return coords_t */ coords_t gui_component_get_absolute_position(container_t *container, component_t *component); /** * @brief Get position on screen - * - * @param container - * @param component - * @return coords_t + * + * @param container + * @param component + * @return coords_t */ coords_t gui_component_get_screen_position(container_t *container, - component_t *component); + component_t *component); // gui_one_container.c /** * @brief Create ONE container that holds only one component - * - * @param x - * @param y - * @return container_t + * + * @param x + * @param y + * @return container_t */ container_t gui_one_container_create(int16_t x, int16_t y); /** * @brief Set ONE container component - * - * @param container - * @param component + * + * @param container + * @param component * @return component_t* set component */ component_t *gui_one_container_set_component(container_t *container, - component_t component); + component_t component); /** * @brief Get ONE container component if it is set - * - * @param container - * @return component_t* + * + * @param container + * @return component_t* */ component_t *gui_one_container_get_component(container_t *container); /** * @brief Render ONE container - * - * @param gui - * @param container + * + * @param gui + * @param container */ void gui_one_container_render(gui_t *gui, container_t *container); /** * @brief Update ONE container - * - * @param gui - * @param container + * + * @param gui + * @param container */ void gui_one_container_update(gui_t *gui, container_t *container); // gui_group_container.c /** * @brief Create GROUP container holding n components - * - * @param x - * @param y + * + * @param x + * @param y * @param components array of components of fixed size * @param components_size size of components - * @return container_t + * @return container_t */ -container_t gui_group_container_create(int16_t x, int16_t y, component_t *components, uint16_t components_size); +container_t gui_group_container_create(int16_t x, int16_t y, + component_t *components, + uint16_t components_size); /** * @brief Add component to GROUP container - * - * @param container - * @param component + * + * @param container + * @param component * @return component_t* - * @return NULL if container is full + * @return NULL if container is full */ component_t *gui_group_container_add_component(container_t *container, - component_t component); + component_t component); void gui_group_container_render(gui_t *gui, container_t *container); void gui_group_container_update(gui_t *gui, container_t *container); diff --git a/lib-gui/include/gui_component_line.h b/lib-gui/include/gui_component_line.h index 96818d72ae7152bab896029f2970973b96451976..08c90c945cf1a22da90d83725adbf34297c9705c 100644 --- a/lib-gui/include/gui_component_line.h +++ b/lib-gui/include/gui_component_line.h @@ -2,32 +2,33 @@ /** * @brief Create gui line component - * - * @param color + * + * @param color * @param x base x coordinate * @param y base y coordinate * @param w width * @param h height - * @return component_t + * @return component_t */ -component_t gui_line_create(const display_pixel_t *color, int16_t x, int16_t y, int16_t w, int16_t h); +component_t gui_line_create(const display_pixel_t *color, int16_t x, int16_t y, + int16_t w, int16_t h); /** * @brief Render function of gui line component - * - * @param container - * @param component - * @param gui + * + * @param container + * @param component + * @param gui */ void gui_line_render(container_t *container, component_t *component, - gui_t *gui); + gui_t *gui); /** * @brief Update function of gui line component - * - * @param container - * @param component - * @param gui + * + * @param container + * @param component + * @param gui */ void gui_line_update(container_t *container, component_t *component, gui_t *gui); diff --git a/lib-gui/include/gui_component_text.h b/lib-gui/include/gui_component_text.h index 5bdb732963a10f4958a1b60f93c5688489b82ec8..12db55bb36bca0227ba66004de2b5225e450d486 100644 --- a/lib-gui/include/gui_component_text.h +++ b/lib-gui/include/gui_component_text.h @@ -12,33 +12,33 @@ typedef struct { /** * @brief Create text component - * - * @param text + * + * @param text * @param x base x coordinate * @param y base y coordinate * @param w width * @param h height - * @return component_t + * @return component_t */ -component_t gui_text_create(text_t *text, int16_t x, int16_t y, - int16_t w, int16_t h); +component_t gui_text_create(text_t *text, int16_t x, int16_t y, int16_t w, + int16_t h); /** * @brief Render function of gui text component - * - * @param container - * @param component - * @param gui + * + * @param container + * @param component + * @param gui */ void gui_text_render(container_t *container, component_t *component, gui_t *gui); /** * @brief Update function of gui text component - * - * @param container - * @param component - * @param gui + * + * @param container + * @param component + * @param gui */ void gui_text_update(container_t *container, component_t *component, gui_t *gui); diff --git a/lib-gui/include/gui_component_text_view.h b/lib-gui/include/gui_component_text_view.h index 3226939b7f9a01629d8982e45eb6b0e7590e256f..07f98e6ffea718673c6208d89a56712a95d02df8 100644 --- a/lib-gui/include/gui_component_text_view.h +++ b/lib-gui/include/gui_component_text_view.h @@ -19,39 +19,39 @@ typedef struct { /** * @brief Create multiline text for state of text view - * - * @param font - * @param color - * @param text - * @return multiline_text_t* + * + * @param font + * @param color + * @param text + * @return multiline_text_t* */ multiline_text_t *gui_multiline_text_create(font_t *font, display_pixel_t color, char *text); /** * @brief Create text view component - * - * @param gui + * + * @param gui * @param text multiline text state * @param x base x coordinate * @param y base y coordinate - * @return component_t + * @return component_t */ component_t gui_text_view_create(gui_t *gui, multiline_text_t *text, int16_t x, int16_t y); /** * @brief Get number of lines scrolled from text view - * - * @param component - * @return uint16_t + * + * @param component + * @return uint16_t */ uint16_t gui_text_view_get_lines_scrolled(component_t *component); /** * @brief Scroll text view by x, y - * - * @param text_view + * + * @param text_view * @param x x coordinate to scroll by * @param y y coordinate to scroll by */ @@ -59,34 +59,34 @@ void gui_text_view_scroll(component_t *text_view, int32_t x, int32_t y); /** * @brief Reset scroll to 0, 0 - * - * @param text_view + * + * @param text_view */ void gui_text_view_reset_scroll(component_t *text_view); /** * @brief Full scroll to the end of file - * - * @param text_view + * + * @param text_view */ void gui_text_view_full_scroll(component_t *text_view); /** * @brief Render function of gui text view component - * - * @param container - * @param component - * @param gui + * + * @param container + * @param component + * @param gui */ void gui_text_view_render(container_t *container, component_t *component, gui_t *gui); /** * @brief Update function of gui text view component - * - * @param container - * @param component - * @param gui + * + * @param container + * @param component + * @param gui */ void gui_text_view_update(container_t *container, component_t *component, gui_t *gui); diff --git a/lib-gui/include/renderer.h b/lib-gui/include/renderer.h index 2534d5a1b7fe8f3a805762cef5572e8141411afe..977a31f3bb9560622aaec28150af1cbea025e0c0 100644 --- a/lib-gui/include/renderer.h +++ b/lib-gui/include/renderer.h @@ -1,9 +1,9 @@ #ifndef __RENDERER_H__ #define __RENDERER_H__ -#include "gui.h" #include "display_utils.h" #include "font.h" +#include "gui.h" struct renderer_t { display_t *display; @@ -17,85 +17,89 @@ struct renderer_t { /** * @brief Create renderer for given display - * - * @param display - * @return renderer_t + * + * @param display + * @return renderer_t */ renderer_t renderer_create(display_t *display); /** * @brief Clear display data - * - * @param renderer + * + * @param renderer */ void renderer_clear(renderer_t *renderer); /** * @brief Render data to display - * - * @param renderer + * + * @param renderer */ void renderer_render(renderer_t *renderer); /** * @brief Render string on display char by char - * - * @param renderer + * + * @param renderer * @param x begin x coord * @param y begin y coord - * @param length length of the text to be rendered / or the whole text if 0 or greater than text length - * @param font - * @param text - * @param color - * @return size2d_t + * @param length length of the text to be rendered / or the whole text if 0 or + * greater than text length + * @param font + * @param text + * @param color + * @return size2d_t */ size2d_t renderer_write_string(renderer_t *renderer, uint16_t x, uint16_t y, - uint16_t length, font_t *font, char *text, display_pixel_t color); + uint16_t length, font_t *font, char *text, + display_pixel_t color); /** * @brief Render render one character - * - * @param renderer + * + * @param renderer * @param x begin x coord * @param y begin y coord - * @param font + * @param font * @param c character - * @param color - * @return size2d_t + * @param color + * @return size2d_t */ size2d_t renderer_write_char(renderer_t *renderer, uint16_t x, uint16_t y, font_t *font, char c, display_pixel_t color); /** * @brief Render filled rectangle - * - * @param renderer + * + * @param renderer * @param x base x coord * @param y base y coord * @param width width of the rectangle * @param height height of the rectangle - * @param color + * @param color */ void renderer_render_rectangle(renderer_t *renderer, uint16_t x, uint16_t y, - uint16_t width, uint16_t height, display_pixel_t color); + uint16_t width, uint16_t height, + display_pixel_t color); /** * @brief Render rectangle border - * - * @param renderer + * + * @param renderer * @param x base x coord * @param y base y coord * @param width width of the rectangle * @param height height of the rectangle - * @param color + * @param color */ void renderer_render_border(renderer_t *renderer, uint16_t x, uint16_t y, - uint16_t width, uint16_t height, display_pixel_t color); + uint16_t width, uint16_t height, + display_pixel_t color); /** * @brief Translate coordinate system of the renderer - * - * @param renderer + * + * @param renderer * @param x translate x coord * @param y translate y coord */ @@ -103,24 +107,25 @@ void renderer_translate(renderer_t *renderer, uint16_t x, uint16_t y); /** * @brief Clear translation - * - * @param renderer + * + * @param renderer */ void renderer_clear_translate(renderer_t *renderer); /** * @brief Set draw area size so nothing is drawn outside - * - * @param renderer - * @param width - * @param height + * + * @param renderer + * @param width + * @param height */ -void renderer_set_draw_area(renderer_t *renderer, uint16_t width, uint16_t height); +void renderer_set_draw_area(renderer_t *renderer, uint16_t width, + uint16_t height); /** * @brief Reset draw area - * - * @param renderer + * + * @param renderer */ void renderer_reset_draw_area(renderer_t *renderer); diff --git a/lib-pheripherals/include/direction.h b/lib-pheripherals/include/direction.h index b821607c58a1c63a70f83bfbf2ca698fa9749a12..0e80bede77f8832b4dd8ee66b445528ccb05343b 100644 --- a/lib-pheripherals/include/direction.h +++ b/lib-pheripherals/include/direction.h @@ -12,12 +12,13 @@ typedef enum { /** * @brief Step direction by amount to direction - * + * * @param direction what direction to step * @param x where to save x value * @param y where to save y value * @param amount step size */ -void direction_move_xy(direction_t direction, int32_t *x, int32_t *y, int16_t amount); +void direction_move_xy(direction_t direction, int32_t *x, int32_t *y, + int16_t amount); #endif // __DIRECTION_H__ diff --git a/lib-pheripherals/include/input.h b/lib-pheripherals/include/input.h index 935e945a44875d323405822d8651be14ccce5c2e..6b75278a97a5b44051bf66a58e451de95cbeebc3 100644 --- a/lib-pheripherals/include/input.h +++ b/lib-pheripherals/include/input.h @@ -1,8 +1,8 @@ #ifndef __INPUT_H__ #define __INPUT_H__ -#include #include +#include #include #define ROTATION_ENCODERS_COUNT 3 @@ -31,7 +31,7 @@ typedef struct { } rotation_encoder_state_t; typedef struct { - void* base_address; + void *base_address; rotation_encoder_state_t encoders_state[ROTATION_ENCODERS_COUNT]; } rotation_encoders_t; @@ -50,43 +50,47 @@ typedef struct { } commands_t; /** - * @brief Create and initialize commands structure to use for handling input - * + * @brief Create and initialize commands structure to use for handling input + * * @param array of commands with lifetime at least as big as commands_t lifetime * @param size maximum number of commands in array * @param reg_knobs_base address of reg knobs in memory to get their data - * @return commands_t + * @return commands_t */ commands_t commands_create(command_t *array, uint8_t size, void *reg_knobs_base); /** - * @brief Add new command to commands to handle input with - * - * @param commands + * @brief Add new command to commands to handle input with + * + * @param commands * @param type what type of input to look for - * @param filter depending on the type this means either a char key or index of rotation encoder + * @param filter depending on the type this means either a char key or index of + * rotation encoder * @param fun function that will be called when correct input is received - * @param state state to pass to fun on command call with lifetime bigger than command + * @param state state to pass to fun on command call with lifetime bigger than + * command * @return true on success * @return false on error (full list) */ -bool commands_register(commands_t *commands, input_type_t type, - char filter, command_fun fun, void *state); +bool commands_register(commands_t *commands, input_type_t type, char filter, + command_fun fun, void *state); /** - * @brief Delete/Unregister command from commands so its function is not called anymore - * + * @brief Delete/Unregister command from commands so its function is not called + * anymore + * * @param commands commands to delete from * @param command command to delete - * @return true command found and deleted + * @return true command found and deleted * @return false command not found */ bool commands_unregister(commands_t *commands, command_t *command); /** - * @brief Check new state of input and if conditions for any of the commands are met, call its function - * + * @brief Check new state of input and if conditions for any of the commands are + * met, call its function + * * @param commands * @return short number of commands called or -1 in case of an error */ diff --git a/lib-pheripherals/include/logger.h b/lib-pheripherals/include/logger.h index 904cd2315118db5a2a41277b95a974b57fb6b483..b688b3aaae2d835c05383a8784d08ee5630cdf2f 100644 --- a/lib-pheripherals/include/logger.h +++ b/lib-pheripherals/include/logger.h @@ -4,8 +4,8 @@ #include #define DEBUG_PREFIX "[DEBG]" -#define INFO_PREFIX "[INFO]" -#define WARN_PREFIX "[WARN]" +#define INFO_PREFIX "[INFO]" +#define WARN_PREFIX "[WARN]" #define ERROR_PREFIX "[ERRO]" typedef enum LogLevel { @@ -30,38 +30,42 @@ struct logger_t { /** * @brief Create logger_t - * - * @param minimalLevel minimal level to log, levels below this one will not be logged + * + * @param minimalLevel minimal level to log, levels below this one will not be + * logged * @param debugFile file to output debug level to * @param infoFile file to output input level to * @param warningFile file to output warning level to * @param errorFile file to output error level to - * @param childLogger child logger that will be called every log to use for duplicating to another file - * @return logger_t + * @param childLogger child logger that will be called every log to use for + * duplicating to another file + * @return logger_t */ -logger_t logger_create(LogLevel minimalLevel, FILE *debugFile, FILE *infoFile, FILE *warningFile, - FILE *errorFile, logger_t *childLogger); +logger_t logger_create(LogLevel minimalLevel, FILE *debugFile, FILE *infoFile, + FILE *warningFile, FILE *errorFile, + logger_t *childLogger); /** * @brief Log given message - * + * * @param logger * @param level level of log * @param file name of file __FILE__ * @param function name of function __FUNCTION__ * @param line number of line __LINE__ - * @param message message with format like printf + * @param message message with format like printf * @param ... arguments to printf */ -void logger_log(logger_t *logger, LogLevel level, const char *file, const char *function, int line, const char *const message, ...); +void logger_log(logger_t *logger, LogLevel level, const char *file, + const char *function, int line, const char *const message, ...); /** * @brief Log given debug message - * + * * @param logger * @param file name of file __FILE__ * @param function name of function __FUNCTION__ * @param line number of line __LINE__ - * @param message message with format like printf + * @param message message with format like printf * @param ... arguments to printf */ void logger_debug(logger_t *logger, const char *file, const char *function, @@ -69,12 +73,12 @@ void logger_debug(logger_t *logger, const char *file, const char *function, /** * @brief Log given info message - * + * * @param logger * @param file name of file __FILE__ * @param function name of function __FUNCTION__ * @param line number of line __LINE__ - * @param message message with format like printf + * @param message message with format like printf * @param ... arguments to printf */ void logger_info(logger_t *logger, const char *file, const char *function, @@ -82,12 +86,12 @@ void logger_info(logger_t *logger, const char *file, const char *function, /** * @brief Log given warn message - * + * * @param logger * @param file name of file __FILE__ * @param function name of function __FUNCTION__ * @param line number of line __LINE__ - * @param message message with format like printf + * @param message message with format like printf * @param ... arguments to printf */ void logger_warn(logger_t *logger, const char *file, const char *function, @@ -95,12 +99,12 @@ void logger_warn(logger_t *logger, const char *file, const char *function, /** * @brief Log given error message - * + * * @param logger * @param file name of file __FILE__ * @param function name of function __FUNCTION__ * @param line number of line __LINE__ - * @param message message with format like printf + * @param message message with format like printf * @param ... arguments to printf */ void logger_error(logger_t *logger, const char *file, const char *function, diff --git a/lib-pheripherals/include/mzapo_led_strip.h b/lib-pheripherals/include/mzapo_led_strip.h index 626e74b80d642b78c497ede94c3b0f8be6c3b81c..b17649d964aba92a1e5e568b82985022999bd97f 100644 --- a/lib-pheripherals/include/mzapo_led_strip.h +++ b/lib-pheripherals/include/mzapo_led_strip.h @@ -9,47 +9,49 @@ extern "C" { #endif - typedef struct { - volatile uint32_t *mem_base; - uint8_t load; - - uint8_t on_index; - uint8_t on_around_index; - - uint32_t strip; - } mzapo_ledstrip_t; - - /** - * @brief Create ledstrip with state - * - * @param mem_base virtual memory address where ledstrip data are saved - * @return mzapo_ledstrip_t - */ - mzapo_ledstrip_t ledstrip_create(volatile uint32_t *mem_base); - - /** - * @brief Turn off all leds on ledstrip - * - * @param ledstrip - */ - void ledstrip_clear(mzapo_ledstrip_t *ledstrip); - - /** - * @brief Turn on led on index and some around it - * - * @param ledstrip - * @param index what led to turn on - * @param around how many leds around to left and right to turn on (around * 2 + 1 leds will be turned on) - */ - void ledstrip_turn_on(mzapo_ledstrip_t *ledstrip, uint8_t index, uint8_t around); - - /** - * @brief Turn on leds from 0 to steps to indicate progress bar - * - * @param ledstrip - * @param steps how many steps out of LED_STRIP_COUNT - */ - void ledstrip_progress_bar_step(mzapo_ledstrip_t *ledstrip, int8_t steps); +typedef struct { + volatile uint32_t *mem_base; + uint8_t load; + + uint8_t on_index; + uint8_t on_around_index; + + uint32_t strip; +} mzapo_ledstrip_t; + +/** + * @brief Create ledstrip with state + * + * @param mem_base virtual memory address where ledstrip data are saved + * @return mzapo_ledstrip_t + */ +mzapo_ledstrip_t ledstrip_create(volatile uint32_t *mem_base); + +/** + * @brief Turn off all leds on ledstrip + * + * @param ledstrip + */ +void ledstrip_clear(mzapo_ledstrip_t *ledstrip); + +/** + * @brief Turn on led on index and some around it + * + * @param ledstrip + * @param index what led to turn on + * @param around how many leds around to left and right to turn on (around * 2 + + * 1 leds will be turned on) + */ +void ledstrip_turn_on(mzapo_ledstrip_t *ledstrip, uint8_t index, + uint8_t around); + +/** + * @brief Turn on leds from 0 to steps to indicate progress bar + * + * @param ledstrip + * @param steps how many steps out of LED_STRIP_COUNT + */ +void ledstrip_progress_bar_step(mzapo_ledstrip_t *ledstrip, int8_t steps); #ifdef __cplusplus } /* extern "C"*/ diff --git a/lib-pheripherals/include/mzapo_phys.h b/lib-pheripherals/include/mzapo_phys.h index 9a1ccc5413c317a3b92fbb55ca202e1e691dc05d..630ae92393c35eaf9db648c91d2eccd5f932a2ee 100644 --- a/lib-pheripherals/include/mzapo_phys.h +++ b/lib-pheripherals/include/mzapo_phys.h @@ -23,11 +23,11 @@ extern "C" { /** * @brief Map physical address to virtual space to use pheripherals - * + * * @param region_base start of the region to map * @param region_size Size of the whole region * @param opt_cached if false, synchronize data - * @return void* + * @return void* */ void *map_phys_address(off_t region_base, size_t region_size, int opt_cached); @@ -35,4 +35,4 @@ void *map_phys_address(off_t region_base, size_t region_size, int opt_cached); } /* extern "C"*/ #endif -#endif /*MZAPO_PHYS_H*/ +#endif /*MZAPO_PHYS_H*/ diff --git a/lib-pheripherals/include/mzapo_rgb_led.h b/lib-pheripherals/include/mzapo_rgb_led.h index 3d41c4e80422bbfc32576b90f419af9add4d7a1d..d5c78c2045f8a64b81470207708b1dbc68440d7f 100644 --- a/lib-pheripherals/include/mzapo_rgb_led.h +++ b/lib-pheripherals/include/mzapo_rgb_led.h @@ -3,84 +3,81 @@ #include "display_utils.h" -typedef enum { - LED_LEFT, - LED_RIGHT -} mzapo_rgb_leds_t; +typedef enum { LED_LEFT, LED_RIGHT } mzapo_rgb_leds_t; #ifdef __cplusplus extern "C" { #endif - typedef struct { - uint8_t blue; - uint8_t green; - uint8_t red; - } __attribute__((__packed__)) rgb_led_pixel_t; +typedef struct { + uint8_t blue; + uint8_t green; + uint8_t red; +} __attribute__((__packed__)) rgb_led_pixel_t; - typedef struct { - volatile rgb_led_pixel_t *mem_base; - } mzapo_rgb_led_t; +typedef struct { + volatile rgb_led_pixel_t *mem_base; +} mzapo_rgb_led_t; - /** - * @brief Create rgb leds with state - * - * @param mem_base virtual memory address where rgb leds data begin - * @return mzapo_rgb_led_t - */ - mzapo_rgb_led_t rgb_led_create(unsigned char *mem_base); +/** + * @brief Create rgb leds with state + * + * @param mem_base virtual memory address where rgb leds data begin + * @return mzapo_rgb_led_t + */ +mzapo_rgb_led_t rgb_led_create(unsigned char *mem_base); - /** - * @brief Set given rgb led to rgb, 000 for turn off - * - * @param rgb_led - * @param id what led to change - * @param r red (min 0, max 255) - * @param g green (min 0, max 255) - * @param b blue (min 0, max 255) - */ - void rgb_led_set(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id, uint8_t r, - uint8_t g, uint8_t b); +/** + * @brief Set given rgb led to rgb, 000 for turn off + * + * @param rgb_led + * @param id what led to change + * @param r red (min 0, max 255) + * @param g green (min 0, max 255) + * @param b blue (min 0, max 255) + */ +void rgb_led_set(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id, uint8_t r, + uint8_t g, uint8_t b); - /** - * @brief Set given rgb led to full red - * - * @param rgb_led - * @param id what led to change - */ - void rgb_led_set_red(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); +/** + * @brief Set given rgb led to full red + * + * @param rgb_led + * @param id what led to change + */ +void rgb_led_set_red(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); - /** - * @brief Set given rgb led to full green - * - * @param rgb_led - * @param id what led to change - */ - void rgb_led_set_green(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); +/** + * @brief Set given rgb led to full green + * + * @param rgb_led + * @param id what led to change + */ +void rgb_led_set_green(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); - /** - * @brief Set given rgb led to full blue - * - * @param rgb_led - * @param id what led to change - */ - void rgb_led_set_blue(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); +/** + * @brief Set given rgb led to full blue + * + * @param rgb_led + * @param id what led to change + */ +void rgb_led_set_blue(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); - /** - * @brief Get given rgb led color - * - * @param rgb_led - * @param id what led to get data from - * @return rgb_led_pixel_t - */ - rgb_led_pixel_t rgb_led_get(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); +/** + * @brief Get given rgb led color + * + * @param rgb_led + * @param id what led to get data from + * @return rgb_led_pixel_t + */ +rgb_led_pixel_t rgb_led_get(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); - /** - * @brief Set given rgb led to 0 - turn off - * - * @param rgb_led - * @param id what led to change - */ - void rgb_led_clear(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); +/** + * @brief Set given rgb led to 0 - turn off + * + * @param rgb_led + * @param id what led to change + */ +void rgb_led_clear(mzapo_rgb_led_t *rgb_led, mzapo_rgb_leds_t id); #ifdef __cplusplus } /* extern "C"*/ diff --git a/lib-pheripherals/include/nonblocking_io.h b/lib-pheripherals/include/nonblocking_io.h index e7c88e6e440c715a558657ac96a1d324e9615ed2..0a4bbe76683714470fb506f7285d03446df0b5ee 100644 --- a/lib-pheripherals/include/nonblocking_io.h +++ b/lib-pheripherals/include/nonblocking_io.h @@ -3,34 +3,34 @@ #include #include -#include #include +#include /** * @brief Set file to nonblocking using cfmakeraw - * + * * @param file to set * @param old termios struct to save old data to - * @return int + * @return int */ int file_set_nonblocking(int file, struct termios *old); /** * @brief Set file to old termios data - * + * * @param file to set * @param old termios struct to load old data from - * @return int + * @return int */ int file_set_blocking(int file, struct termios *old); /** * @brief Read from nonblocking file, if no data, return 0 instead of -1 - * + * * @param file to read from * @param max_size size of buffer * @param data buffer to write data to - * @return int + * @return int */ int file_read_nonblocking(int file, size_t max_size, uint8_t *data); diff --git a/lib-pheripherals/include/xwin_sdl.h b/lib-pheripherals/include/xwin_sdl.h index b0ddc5bebf70e4235984f0278e0a5658548e1de3..dd75a6fb77547f4418f3a0ea8176b08f32bf28e5 100644 --- a/lib-pheripherals/include/xwin_sdl.h +++ b/lib-pheripherals/include/xwin_sdl.h @@ -1,28 +1,28 @@ #ifndef __XWIN_SDL_H__ #define __XWIN_SDL_H__ -#include #include +#include #include /** * @brief Init SDL window - * + * * @param w width * @param h height - * @return int + * @return int */ int xwin_init(uint16_t w, uint16_t h); /** * @brief Close SDL window - * + * */ void xwin_close(); /** * @brief Redraw SDL window with img data in format rgb888 stacked together - * + * * @param w width of img * @param h height of img * @param img data with rgb888 stacked together @@ -31,8 +31,8 @@ void xwin_redraw(uint16_t w, uint16_t h, uint8_t *img); /** * @brief Poll event to show OS window is responsive - * - * @param event + * + * @param event * @return true event was polled * @return false no event found */ @@ -40,7 +40,7 @@ bool xwin_poll_event(SDL_Event *event); /** * @brief Save image of the window to file - * + * * @param output_name where to save the image */ void xwin_save_image(char *output_name); diff --git a/text-viewer/include/text_viewer.h b/text-viewer/include/text_viewer.h index 02d064270dba5abdd54c6805fd557791a8d0c40a..6498f95ed7b23672a330adad2247061b8111487d 100644 --- a/text-viewer/include/text_viewer.h +++ b/text-viewer/include/text_viewer.h @@ -29,35 +29,35 @@ typedef struct { /** * @brief Create text viewer struct - * + * * @param path path to file to open * @param pheripherals initialized pheripherals of mzapo * @param logger * @param font to display text with - * @return text_viewer_t + * @return text_viewer_t */ text_viewer_t text_viewer_create(char *path, mzapo_pheripherals_t pheripherals, logger_t *logger, font_t font); /** * @brief Cleans up text viewer data - * + * * @param text_viewer Text viewer to clean up */ void text_viewer_destroy(text_viewer_t *text_viewer); /** * @brief Load text file and parse it into memory - * - * @param text_viewer - * @return file_error_t + * + * @param text_viewer + * @return file_error_t */ file_error_t text_viewer_load_file(text_viewer_t *text_viewer); /** * @brief Start application - GUI render loop with input handling - * - * @param text_viewer + * + * @param text_viewer */ void text_viewer_start_loop(text_viewer_t *text_viewer);