[FL-1906] Documentation: add Doxyfile, prepare sources for doxygen. (#741)
* Documentation: add Doxyfile, prepare sources for doxygen. * Update ReadMe and remove obsolete CLA * Add contribution guide * Contributing: update text * Correct spelling
This commit is contained in:
		
							parent
							
								
									1208a5077f
								
							
						
					
					
						commit
						89a6c09a7a
					
				
							
								
								
									
										71
									
								
								CONTRIBUTING.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								CONTRIBUTING.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,71 @@
 | 
				
			|||||||
 | 
					# Welcome to FlipperZero contributing guide <!-- omit in toc -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thank you for investing your time in contributing to our project! 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Read our [Code of Coduct](CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## New contributor guide
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See the [ReadMe](ReadMe.md) to get an overview of the project. Here are some helpful resources to get you comfortable with open source contribution:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
 | 
				
			||||||
 | 
					- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
 | 
				
			||||||
 | 
					- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
 | 
				
			||||||
 | 
					- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Getting started
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Before writing code and creating PR make sure that it aligns with our mission and guidlines:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- All our devices are intended for research and education.
 | 
				
			||||||
 | 
					- PR that contains code intended to commit crimes is not going to be accepted.
 | 
				
			||||||
 | 
					- Your PR must contain code compatiable with project [LICENSE](LICENSE).
 | 
				
			||||||
 | 
					- PR will only be merged if it pass CI/CD.
 | 
				
			||||||
 | 
					- PR will only be merged if it pass review by code owner.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Feel free to ask questions in issues if you're not sure.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Issues
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Create a new issue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you found a problem, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/flipperdevices/flipperzero-firmware/issues/new/choose). 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Solve an issue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Scan through our [existing issues](https://github.com/flipperdevices/flipperzero-firmware/issues) to find one that interests you.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Make Changes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. Fork the repository.
 | 
				
			||||||
 | 
					- Using GitHub Desktop:
 | 
				
			||||||
 | 
					  - [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
 | 
				
			||||||
 | 
					  - Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Using the command line:
 | 
				
			||||||
 | 
					  - [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. Install build requirements
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3. Create a working branch and start with your changes!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Commit your update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Commit the changes once you are happy with them. Make sure that code compilation is not broken and passes tests. Check syntax and formatting.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Pull Request
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When you're done making the changes, open a pull request, often referred to as a PR. 
 | 
				
			||||||
 | 
					- Fill out the "Ready for review" template so we can review your PR. This template helps reviewers understand your changes and the purpose of your pull request. 
 | 
				
			||||||
 | 
					- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.
 | 
				
			||||||
 | 
					- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge.
 | 
				
			||||||
 | 
					Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request for additional information.
 | 
				
			||||||
 | 
					- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
 | 
				
			||||||
 | 
					- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
 | 
				
			||||||
 | 
					- If you run into any merge issues, checkout this [git tutorial](https://lab.github.com/githubtraining/managing-merge-conflicts) to help you resolve merge conflicts and other issues.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Your PR is merged!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Congratulations :tada::tada: The FlipperDevices team thanks you :sparkles:.
 | 
				
			||||||
@ -162,6 +162,7 @@ Finally, you will have **`firmware/.obj/f6/full.dfu`** file that can be distribu
 | 
				
			|||||||
- core - core libraries: home for furi
 | 
					- core - core libraries: home for furi
 | 
				
			||||||
- debug - debug helpers, plugins and tools
 | 
					- debug - debug helpers, plugins and tools
 | 
				
			||||||
- docker - docker image sources (used for automated firmware build)
 | 
					- docker - docker image sources (used for automated firmware build)
 | 
				
			||||||
 | 
					- documentation - documentation generation system configs and input files
 | 
				
			||||||
- firmware - firmware for flipper
 | 
					- firmware - firmware for flipper
 | 
				
			||||||
  * targets - targets' hal and implementation
 | 
					  * targets - targets' hal and implementation
 | 
				
			||||||
- lib - different libraries and drivers that apps and firmware uses
 | 
					- lib - different libraries and drivers that apps and firmware uses
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,16 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file cli.h
 | 
				
			||||||
 | 
					 * Cli API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <m-string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <m-string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    CliSymbolAsciiSOH = 0x01,
 | 
					    CliSymbolAsciiSOH = 0x01,
 | 
				
			||||||
    CliSymbolAsciiETX = 0x03,
 | 
					    CliSymbolAsciiETX = 0x03,
 | 
				
			||||||
@ -21,30 +26,29 @@ typedef enum {
 | 
				
			|||||||
} CliSymbols;
 | 
					} CliSymbols;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    CliCommandFlagDefault = 0, /** Default, loader lock is used */
 | 
					    CliCommandFlagDefault = 0, /**< Default, loader lock is used */
 | 
				
			||||||
    CliCommandFlagParallelSafe =
 | 
					    CliCommandFlagParallelSafe =
 | 
				
			||||||
        (1 << 0), /** Safe to run in parallel with other apps, loader lock is not used */
 | 
					        (1 << 0), /**< Safe to run in parallel with other apps, loader lock is not used */
 | 
				
			||||||
    CliCommandFlagInsomniaSafe = (1 << 1), /** Safe to run with insomnia mode on */
 | 
					    CliCommandFlagInsomniaSafe = (1 << 1), /**< Safe to run with insomnia mode on */
 | 
				
			||||||
} CliCommandFlag;
 | 
					} CliCommandFlag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Cli type
 | 
					/** Cli type anonymous structure */
 | 
				
			||||||
 * Anonymous structure. Use cli_i.h if you need to go deeper.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef struct Cli Cli;
 | 
					typedef struct Cli Cli;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Cli callback function pointer.
 | 
					/** Cli callback function pointer. Implement this interface and use
 | 
				
			||||||
 * Implement this interface and use add_cli_command
 | 
					 * add_cli_command
 | 
				
			||||||
 * @param args - string with what was passed after command
 | 
					 * @param      args     string with what was passed after command
 | 
				
			||||||
 * @param context - pointer to whatever you gave us on cli_add_command
 | 
					 * @param      context  pointer to whatever you gave us on cli_add_command
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*CliCallback)(Cli* cli, string_t args, void* context);
 | 
					typedef void (*CliCallback)(Cli* cli, string_t args, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Add cli command
 | 
					/** Add cli command Registers you command callback
 | 
				
			||||||
 * Registers you command callback
 | 
					 *
 | 
				
			||||||
 * @param cli - pointer to cli instance
 | 
					 * @param      cli       pointer to cli instance
 | 
				
			||||||
 * @param name - command name
 | 
					 * @param      name      command name
 | 
				
			||||||
 * @param callback - callback function
 | 
					 * @param      flags     CliCommandFlag
 | 
				
			||||||
 * @param context - pointer to whatever we need to pass to callback
 | 
					 * @param      callback  callback function
 | 
				
			||||||
 | 
					 * @param      context   pointer to whatever we need to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void cli_add_command(
 | 
					void cli_add_command(
 | 
				
			||||||
    Cli* cli,
 | 
					    Cli* cli,
 | 
				
			||||||
@ -53,51 +57,56 @@ void cli_add_command(
 | 
				
			|||||||
    CliCallback callback,
 | 
					    CliCallback callback,
 | 
				
			||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Print unified cmd usage tip
 | 
					/** Print unified cmd usage tip
 | 
				
			||||||
 * @param cmd - cmd name
 | 
					 *
 | 
				
			||||||
 * @param usage - usage tip
 | 
					 * @param      cmd    cmd name
 | 
				
			||||||
 * @param arg - arg passed by user
 | 
					 * @param      usage  usage tip
 | 
				
			||||||
 | 
					 * @param      arg    arg passed by user
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
void cli_print_usage(const char* cmd, const char* usage, const char* arg);
 | 
					void cli_print_usage(const char* cmd, const char* usage, const char* arg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Delete cli command
 | 
					/** Delete cli command
 | 
				
			||||||
 * @param cli - pointer to cli instance
 | 
					 *
 | 
				
			||||||
 * @param name - command name
 | 
					 * @param      cli   pointer to cli instance
 | 
				
			||||||
 | 
					 * @param      name  command name
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void cli_delete_command(Cli* cli, const char* name);
 | 
					void cli_delete_command(Cli* cli, const char* name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Read from terminal
 | 
					/** Read from terminal Do it only from inside of cli call.
 | 
				
			||||||
 * Do it only from inside of cli call.
 | 
					 *
 | 
				
			||||||
 * @param cli - Cli instance
 | 
					 * @param      cli     Cli instance
 | 
				
			||||||
 * @param buffer - pointer to buffer
 | 
					 * @param      buffer  pointer to buffer
 | 
				
			||||||
 * @param size - size of buffer in bytes
 | 
					 * @param      size    size of buffer in bytes
 | 
				
			||||||
 * @return bytes written
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     bytes written
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t cli_read(Cli* cli, uint8_t* buffer, size_t size);
 | 
					size_t cli_read(Cli* cli, uint8_t* buffer, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Not blocking check for interrupt command received
 | 
					/** Not blocking check for interrupt command received
 | 
				
			||||||
 * @param cli - Cli instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      cli   Cli instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if received
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool cli_cmd_interrupt_received(Cli* cli);
 | 
					bool cli_cmd_interrupt_received(Cli* cli);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Write to terminal
 | 
					/** Write to terminal Do it only from inside of cli call.
 | 
				
			||||||
 * Do it only from inside of cli call.
 | 
					 *
 | 
				
			||||||
 * @param cli - Cli instance
 | 
					 * @param      cli     Cli instance
 | 
				
			||||||
 * @param buffer - pointer to buffer
 | 
					 * @param      buffer  pointer to buffer
 | 
				
			||||||
 * @param size - size of buffer in bytes
 | 
					 * @param      size    size of buffer in bytes
 | 
				
			||||||
 * @return bytes written
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void cli_write(Cli* cli, const uint8_t* buffer, size_t size);
 | 
					void cli_write(Cli* cli, const uint8_t* buffer, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Read character
 | 
					/** Read character
 | 
				
			||||||
 * @param cli - Cli instance
 | 
					 *
 | 
				
			||||||
 * @return char
 | 
					 * @param      cli   Cli instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     char
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
char cli_getc(Cli* cli);
 | 
					char cli_getc(Cli* cli);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* New line 
 | 
					/** New line Send new ine sequence
 | 
				
			||||||
 * Send new ine sequence
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void cli_nl();
 | 
					void cli_nl();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file canvas.h
 | 
				
			||||||
 | 
					 * GUI: Canvas API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
@ -8,13 +13,16 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Color enumeration */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    ColorWhite = 0x00,
 | 
					    ColorWhite = 0x00,
 | 
				
			||||||
    ColorBlack = 0x01,
 | 
					    ColorBlack = 0x01,
 | 
				
			||||||
} Color;
 | 
					} Color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Fonts enumeration */
 | 
				
			||||||
typedef enum { FontPrimary, FontSecondary, FontKeyboard } Font;
 | 
					typedef enum { FontPrimary, FontSecondary, FontKeyboard } Font;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Alignment enumeration */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    AlignLeft,
 | 
					    AlignLeft,
 | 
				
			||||||
    AlignRight,
 | 
					    AlignRight,
 | 
				
			||||||
@ -23,59 +31,85 @@ typedef enum {
 | 
				
			|||||||
    AlignCenter,
 | 
					    AlignCenter,
 | 
				
			||||||
} Align;
 | 
					} Align;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Canvas Orientation */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    CanvasOrientationHorizontal,
 | 
					    CanvasOrientationHorizontal,
 | 
				
			||||||
    CanvasOrientationVertical,
 | 
					    CanvasOrientationVertical,
 | 
				
			||||||
} CanvasOrientation;
 | 
					} CanvasOrientation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Canvas anonymouse structure */
 | 
				
			||||||
typedef struct Canvas Canvas;
 | 
					typedef struct Canvas Canvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get Canvas width
 | 
				
			||||||
 * Canvas width
 | 
					 *
 | 
				
			||||||
 * @return width in pixels.
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     width in pixels.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t canvas_width(Canvas* canvas);
 | 
					uint8_t canvas_width(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get Canvas height
 | 
				
			||||||
 * Canvas height
 | 
					 *
 | 
				
			||||||
 * @return height in pixels.
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     height in pixels.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t canvas_height(Canvas* canvas);
 | 
					uint8_t canvas_height(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get current font height
 | 
				
			||||||
 * Get current font height
 | 
					 *
 | 
				
			||||||
 * @return height in pixels.
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     height in pixels.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t canvas_current_font_height(Canvas* canvas);
 | 
					uint8_t canvas_current_font_height(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Clear canvas
 | 
				
			||||||
 * Clear canvas, clear rendering buffer
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_clear(Canvas* canvas);
 | 
					void canvas_clear(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Set drawing color
 | 
				
			||||||
 * Set drawing color
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      color   Color
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_set_color(Canvas* canvas, Color color);
 | 
					void canvas_set_color(Canvas* canvas, Color color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Invert drawing color
 | 
				
			||||||
 * Invert drawing color
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_invert_color(Canvas* canvas);
 | 
					void canvas_invert_color(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Set drawing font
 | 
				
			||||||
 * Set drawing font
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      font    Font
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_set_font(Canvas* canvas, Font font);
 | 
					void canvas_set_font(Canvas* canvas, Font font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw string at position of baseline defined by x, y.
 | 
				
			||||||
 * Draw string at position of baseline defined by x, y.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       anchor point x coordinate
 | 
				
			||||||
 | 
					 * @param      y       anchor point y coordinate
 | 
				
			||||||
 | 
					 * @param      str     C-string
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str);
 | 
					void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw aligned string defined by x, y.
 | 
				
			||||||
 * Draw aligned string defined by x, y.
 | 
					 *
 | 
				
			||||||
 * Align calculated from position of baseline, string width and ascent (height of the glyphs above the baseline)
 | 
					 * Align calculated from position of baseline, string width and ascent (height
 | 
				
			||||||
 | 
					 * of the glyphs above the baseline)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas      Canvas instance
 | 
				
			||||||
 | 
					 * @param      x           anchor point x coordinate
 | 
				
			||||||
 | 
					 * @param      y           anchor point y coordinate
 | 
				
			||||||
 | 
					 * @param      horizontal  horizontal alignment
 | 
				
			||||||
 | 
					 * @param      vertical    vertical alignment
 | 
				
			||||||
 | 
					 * @param      str         C-string
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_str_aligned(
 | 
					void canvas_draw_str_aligned(
 | 
				
			||||||
    Canvas* canvas,
 | 
					    Canvas* canvas,
 | 
				
			||||||
@ -85,22 +119,30 @@ void canvas_draw_str_aligned(
 | 
				
			|||||||
    Align vertical,
 | 
					    Align vertical,
 | 
				
			||||||
    const char* str);
 | 
					    const char* str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get string width
 | 
				
			||||||
 * Get string width
 | 
					 *
 | 
				
			||||||
 * @return width in pixels.
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      str     C-string
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     width in pixels.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint16_t canvas_string_width(Canvas* canvas, const char* str);
 | 
					uint16_t canvas_string_width(Canvas* canvas, const char* str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get glyph width
 | 
					/** Get glyph width
 | 
				
			||||||
 * @return width in pixels
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param[in]  symbol  character
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     width in pixels
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t canvas_glyph_width(Canvas* canvas, char symbol);
 | 
					uint8_t canvas_glyph_width(Canvas* canvas, char symbol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Draw animation at position defined by x,y.
 | 
					/** Draw animation at position defined by x,y.
 | 
				
			||||||
 * @param canvas - canvas instance
 | 
					 *
 | 
				
			||||||
 * @param x - x coordinate
 | 
					 * @param      canvas          Canvas instance
 | 
				
			||||||
 * @param y - y coordinate
 | 
					 * @param      x               x coordinate
 | 
				
			||||||
 * @param icon_animation - data pointer to IconAnimation
 | 
					 * @param      y               y coordinate
 | 
				
			||||||
 | 
					 * @param      icon_animation  IconAnimation instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_icon_animation(
 | 
					void canvas_draw_icon_animation(
 | 
				
			||||||
    Canvas* canvas,
 | 
					    Canvas* canvas,
 | 
				
			||||||
@ -109,15 +151,22 @@ void canvas_draw_icon_animation(
 | 
				
			|||||||
    IconAnimation* icon_animation);
 | 
					    IconAnimation* icon_animation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Draw icon at position defined by x,y.
 | 
					/** Draw icon at position defined by x,y.
 | 
				
			||||||
 * @param canvas - canvas instance
 | 
					 *
 | 
				
			||||||
 * @param x - x coordinate
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 * @param y - y coordinate
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 * @param icon - data pointer to Icon
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      icon    Icon instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon);
 | 
					void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw XBM bitmap
 | 
				
			||||||
 * Draw xbm icon of width, height at position defined by x,y.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      w       bitmap width
 | 
				
			||||||
 | 
					 * @param      h       bitmap height
 | 
				
			||||||
 | 
					 * @param      bitmap  pointer to XBM bitmap data
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_xbm(
 | 
					void canvas_draw_xbm(
 | 
				
			||||||
    Canvas* canvas,
 | 
					    Canvas* canvas,
 | 
				
			||||||
@ -127,48 +176,86 @@ void canvas_draw_xbm(
 | 
				
			|||||||
    uint8_t h,
 | 
					    uint8_t h,
 | 
				
			||||||
    const uint8_t* bitmap);
 | 
					    const uint8_t* bitmap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw dot at x,y
 | 
				
			||||||
 * Draw dot at x,y
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y);
 | 
					void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw box of width, height at x,y
 | 
				
			||||||
 * Draw box of width, height at x,y
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      width   box width
 | 
				
			||||||
 | 
					 * @param      height  box height
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
 | 
					void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw frame of width, height at x,y
 | 
				
			||||||
 * Draw frame of width, height at x,y
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      width   frame width
 | 
				
			||||||
 | 
					 * @param      height  frame height
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
 | 
					void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw line from x1,y1 to x2,y2
 | 
				
			||||||
 * Draw line from x1,y1 to x2,y2
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x1      x1 coordinate
 | 
				
			||||||
 | 
					 * @param      y1      y1 coordinate
 | 
				
			||||||
 | 
					 * @param      x2      x2 coordinate
 | 
				
			||||||
 | 
					 * @param      y2      y2 coordinate
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
 | 
					void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw circle at x,y with radius r
 | 
				
			||||||
 * Draw circle at x,y with radius r
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      r       radius
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_circle(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r);
 | 
					void canvas_draw_circle(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw disc at x,y with radius r
 | 
				
			||||||
 * Draw disc at x,y with radius r
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      r       radius
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r);
 | 
					void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw glyph
 | 
				
			||||||
 * Draw glyph
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      ch      character
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_glyph(Canvas* canvas, uint8_t x, uint8_t y, uint16_t ch);
 | 
					void canvas_draw_glyph(Canvas* canvas, uint8_t x, uint8_t y, uint16_t ch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Set transparency mode
 | 
				
			||||||
 * Set transparency mode
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      alpha   transparency mode
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_set_bitmap_mode(Canvas* canvas, bool alpha);
 | 
					void canvas_set_bitmap_mode(Canvas* canvas, bool alpha);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw rounded-corner frame of width, height at x,y, with round value raduis
 | 
				
			||||||
 * Draw rounded-corner frame of width, height at x,y, with round value raduis
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      width   frame width
 | 
				
			||||||
 | 
					 * @param      height  frame height
 | 
				
			||||||
 | 
					 * @param      radius  frame corner radius
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_rframe(
 | 
					void canvas_draw_rframe(
 | 
				
			||||||
    Canvas* canvas,
 | 
					    Canvas* canvas,
 | 
				
			||||||
@ -178,8 +265,14 @@ void canvas_draw_rframe(
 | 
				
			|||||||
    uint8_t height,
 | 
					    uint8_t height,
 | 
				
			||||||
    uint8_t radius);
 | 
					    uint8_t radius);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Draw rounded-corner box of width, height at x,y, with round value raduis
 | 
				
			||||||
 * Draw rounded-corner box of width, height at x,y, with round value raduis
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 * @param      x       x coordinate
 | 
				
			||||||
 | 
					 * @param      y       y coordinate
 | 
				
			||||||
 | 
					 * @param      width   box width
 | 
				
			||||||
 | 
					 * @param      height  box height
 | 
				
			||||||
 | 
					 * @param      radius  box corner radius
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_draw_rbox(
 | 
					void canvas_draw_rbox(
 | 
				
			||||||
    Canvas* canvas,
 | 
					    Canvas* canvas,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,15 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file canvas_i.h
 | 
				
			||||||
 | 
					 * GUI: internal Canvas API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "canvas.h"
 | 
					#include "canvas.h"
 | 
				
			||||||
#include <u8g2.h>
 | 
					#include <u8g2.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Canvas structure
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
struct Canvas {
 | 
					struct Canvas {
 | 
				
			||||||
    u8g2_t fb;
 | 
					    u8g2_t fb;
 | 
				
			||||||
    CanvasOrientation orientation;
 | 
					    CanvasOrientation orientation;
 | 
				
			||||||
@ -12,40 +19,53 @@ struct Canvas {
 | 
				
			|||||||
    uint8_t height;
 | 
					    uint8_t height;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Allocate memory and initialize canvas
 | 
				
			||||||
 * Allocate memory and initialize canvas
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Canvas instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Canvas* canvas_init();
 | 
					Canvas* canvas_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Free canvas memory
 | 
				
			||||||
 * Free canvas memory
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_free(Canvas* canvas);
 | 
					void canvas_free(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Reset canvas drawing tools configuration
 | 
				
			||||||
 * Reset canvas drawing tools configuration
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_reset(Canvas* canvas);
 | 
					void canvas_reset(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Commit canvas. Send buffer to display
 | 
				
			||||||
 * Commit canvas. Send buffer to display
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_commit(Canvas* canvas);
 | 
					void canvas_commit(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get canvas buffer.
 | 
				
			||||||
 * Get canvas buffer.
 | 
					 *
 | 
				
			||||||
 * @return pointer to buffer
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to buffer
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t* canvas_get_buffer(Canvas* canvas);
 | 
					uint8_t* canvas_get_buffer(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get canvas buffer size.
 | 
				
			||||||
 * Get canvas buffer size.
 | 
					 *
 | 
				
			||||||
 * @return size of canvas in bytes
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     size of canvas in bytes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t canvas_get_buffer_size(Canvas* canvas);
 | 
					size_t canvas_get_buffer_size(Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Set drawing region relative to real screen buffer
 | 
				
			||||||
 * Set drawing region relative to real screen buffer
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas    Canvas instance
 | 
				
			||||||
 | 
					 * @param      offset_x  x coordinate offset
 | 
				
			||||||
 | 
					 * @param      offset_y  y coordinate offset
 | 
				
			||||||
 | 
					 * @param      width     width
 | 
				
			||||||
 | 
					 * @param      height    height
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_frame_set(
 | 
					void canvas_frame_set(
 | 
				
			||||||
    Canvas* canvas,
 | 
					    Canvas* canvas,
 | 
				
			||||||
@ -54,12 +74,17 @@ void canvas_frame_set(
 | 
				
			|||||||
    uint8_t width,
 | 
					    uint8_t width,
 | 
				
			||||||
    uint8_t height);
 | 
					    uint8_t height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Set canvas orientation
 | 
				
			||||||
 * Set canvas orientation
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas       Canvas instance
 | 
				
			||||||
 | 
					 * @param      orientation  CanvasOrientation
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation);
 | 
					void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Get canvas orientation
 | 
				
			||||||
 * Get canvas orientation
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      canvas  Canvas instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     CanvasOrientation
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
CanvasOrientation canvas_get_orientation(const Canvas* canvas);
 | 
					CanvasOrientation canvas_get_orientation(const Canvas* canvas);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,11 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file elements.h
 | 
				
			||||||
 | 
					 * GUI: Elements API
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Canvas helpers and UI building blocks.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file gui.h
 | 
				
			||||||
 | 
					 * GUI: main API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "view_port.h"
 | 
					#include "view_port.h"
 | 
				
			||||||
@ -7,60 +12,74 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Gui layers */
 | 
					/** Gui layers */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    GuiLayerNone, /* Special layer for internal use only */
 | 
					    GuiLayerNone, /**< Special layer for internal use only */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GuiLayerStatusBarLeft, /* Status bar left-side layer, auto-layout */
 | 
					    GuiLayerStatusBarLeft, /**< Status bar left-side layer, auto-layout */
 | 
				
			||||||
    GuiLayerStatusBarRight, /* Status bar right-side layer, auto-layout */
 | 
					    GuiLayerStatusBarRight, /**< Status bar right-side layer, auto-layout */
 | 
				
			||||||
    GuiLayerMain, /* Main layer, status bar is shown */
 | 
					    GuiLayerMain, /**< Main layer, status bar is shown */
 | 
				
			||||||
    GuiLayerFullscreen, /* Fullscreen layer */
 | 
					    GuiLayerFullscreen, /**< Fullscreen layer */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GuiLayerMAX /* Don't use or move, special value */
 | 
					    GuiLayerMAX /**< Don't use or move, special value */
 | 
				
			||||||
} GuiLayer;
 | 
					} GuiLayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Gui frame buffer callback */
 | 
					/** Gui Canvas Commit Callback */
 | 
				
			||||||
typedef void (*GuiCanvasCommitCallback)(uint8_t* data, size_t size, void* context);
 | 
					typedef void (*GuiCanvasCommitCallback)(uint8_t* data, size_t size, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct Gui Gui;
 | 
					typedef struct Gui Gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Add view_port to view_port tree
 | 
				
			||||||
 * Add view_port to view_port tree
 | 
					 *
 | 
				
			||||||
 * @remarks thread safe
 | 
					 * @remark     thread safe
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      gui        Gui instance
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param[in]  layer      GuiLayer where to place view_port
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer);
 | 
					void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Remove view_port from rendering tree
 | 
				
			||||||
 * Remove view_port from rendering tree
 | 
					 *
 | 
				
			||||||
 * @remarks thread safe
 | 
					 * @remark     thread safe
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      gui        Gui instance
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_remove_view_port(Gui* gui, ViewPort* view_port);
 | 
					void gui_remove_view_port(Gui* gui, ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Send ViewPort to the front
 | 
					/** Send ViewPort to the front
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Places selected ViewPort to the top of the drawing stack
 | 
					 * Places selected ViewPort to the top of the drawing stack
 | 
				
			||||||
 * @param gui - Gui instance
 | 
					 *
 | 
				
			||||||
 * @param view_port - ViewPort instance
 | 
					 * @param      gui        Gui instance
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_send_view_port_front(Gui* gui, ViewPort* view_port);
 | 
					void gui_send_view_port_front(Gui* gui, ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Send ViewPort to the back
 | 
					/** Send ViewPort to the back
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Places selected ViewPort to the bottom of the drawing stack
 | 
					 * Places selected ViewPort to the bottom of the drawing stack
 | 
				
			||||||
 * @param gui - Gui instance
 | 
					 *
 | 
				
			||||||
 * @param view_port - ViewPort instance
 | 
					 * @param      gui        Gui instance
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_send_view_port_back(Gui* gui, ViewPort* view_port);
 | 
					void gui_send_view_port_back(Gui* gui, ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set gui canvas commit callback
 | 
					/** Set gui canvas commit callback
 | 
				
			||||||
 * This callback will be called upon Canvas commit
 | 
					 *
 | 
				
			||||||
 * Callback dispatched from GUI thread and is time critical
 | 
					 * This callback will be called upon Canvas commit Callback dispatched from GUI
 | 
				
			||||||
 * @param gui - Gui instance
 | 
					 * thread and is time critical
 | 
				
			||||||
 * @param callback - GuiCanvasCommitCallback
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      gui       Gui instance
 | 
				
			||||||
 | 
					 * @param      callback  GuiCanvasCommitCallback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_set_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback);
 | 
					void gui_set_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set gui canvas commit callback context
 | 
					/** Set gui canvas commit callback context
 | 
				
			||||||
 * @param gui - Gui instance
 | 
					 *
 | 
				
			||||||
 * @param context - pointer to context
 | 
					 * @param      gui      Gui instance
 | 
				
			||||||
 | 
					 * @param      context  pointer to context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_set_framebuffer_callback_context(Gui* gui, void* context);
 | 
					void gui_set_framebuffer_callback_context(Gui* gui, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file gui_i.h
 | 
				
			||||||
 | 
					 * GUI: main API internals
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "gui.h"
 | 
					#include "gui.h"
 | 
				
			||||||
@ -31,6 +36,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST);
 | 
					ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Gui structure */
 | 
				
			||||||
struct Gui {
 | 
					struct Gui {
 | 
				
			||||||
    // Thread and lock
 | 
					    // Thread and lock
 | 
				
			||||||
    osThreadId_t thread;
 | 
					    osThreadId_t thread;
 | 
				
			||||||
@ -54,8 +60,9 @@ struct Gui {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
 | 
					ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Update GUI, request redraw
 | 
					/** Update GUI, request redraw
 | 
				
			||||||
 * @param gui, Gui instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      gui   Gui instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void gui_update(Gui* gui);
 | 
					void gui_update(Gui* gui);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -67,4 +74,4 @@ void gui_unlock(Gui* gui);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void gui_cli_screen_stream_callback(uint8_t* data, size_t size, void* context);
 | 
					void gui_cli_screen_stream_callback(uint8_t* data, size_t size, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui_cli_screen_stream(Cli* cli, string_t args, void* context);
 | 
					void gui_cli_screen_stream(Cli* cli, string_t args, void* context);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file icon.h
 | 
				
			||||||
 | 
					 * GUI: Icon API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
@ -8,10 +13,28 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef struct Icon Icon;
 | 
					typedef struct Icon Icon;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get icon width 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  instance  pointer to Icon data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     width in pixels
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint8_t icon_get_width(const Icon* instance);
 | 
					uint8_t icon_get_width(const Icon* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get icon height
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  instance  pointer to Icon data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     height in pixels
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint8_t icon_get_height(const Icon* instance);
 | 
					uint8_t icon_get_height(const Icon* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get Icon XBM bitmap data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  instance  pointer to Icon data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to XBM bitmap data
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t* icon_get_data(const Icon* instance);
 | 
					const uint8_t* icon_get_data(const Icon* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,28 +1,48 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file icon_animation.h
 | 
				
			||||||
 | 
					 * GUI: IconAnimation API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					#include <assets_icons.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assets_icons.h>
 | 
					/** Icon Animation */
 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct IconAnimation IconAnimation;
 | 
					typedef struct IconAnimation IconAnimation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Icon Animation Callback. Used for update notification */
 | 
				
			||||||
typedef void (*IconAnimationCallback)(IconAnimation* instance, void* context);
 | 
					typedef void (*IconAnimationCallback)(IconAnimation* instance, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate icon animation instance with const icon data.
 | 
					/** Allocate icon animation instance with const icon data.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 * always returns Icon or stops system if not enough memory
 | 
					 * always returns Icon or stops system if not enough memory
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  icon  pointer to Icon data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     IconAnimation instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
IconAnimation* icon_animation_alloc(const Icon* icon);
 | 
					IconAnimation* icon_animation_alloc(const Icon* icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Release icon animation instance
 | 
					/** Release icon animation instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void icon_animation_free(IconAnimation* instance);
 | 
					void icon_animation_free(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get icon animation width
 | 
					/** Set IconAnimation update callback
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Normally you do not need to use this function, use view_tie_icon_animation
 | 
				
			||||||
 | 
					 * instead.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 | 
					 * @param[in]  callback  IconAnimationCallback
 | 
				
			||||||
 | 
					 * @param      context   callback context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void icon_animation_set_update_callback(
 | 
					void icon_animation_set_update_callback(
 | 
				
			||||||
    IconAnimation* instance,
 | 
					    IconAnimation* instance,
 | 
				
			||||||
@ -30,22 +50,38 @@ void icon_animation_set_update_callback(
 | 
				
			|||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get icon animation width
 | 
					/** Get icon animation width
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     width in pixels
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t icon_animation_get_width(IconAnimation* instance);
 | 
					uint8_t icon_animation_get_width(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get icon animation height
 | 
					/** Get icon animation height
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     height in pixels
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t icon_animation_get_height(IconAnimation* instance);
 | 
					uint8_t icon_animation_get_height(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start icon animation
 | 
					/** Start icon animation
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void icon_animation_start(IconAnimation* instance);
 | 
					void icon_animation_start(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop icon animation
 | 
					/** Stop icon animation
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void icon_animation_stop(IconAnimation* instance);
 | 
					void icon_animation_stop(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Returns true if current frame is a last one
 | 
					/** Returns true if current frame is a last one
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if last frame
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool icon_animation_is_last_frame(IconAnimation* instance);
 | 
					bool icon_animation_is_last_frame(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file icon_animation_i.h
 | 
				
			||||||
 | 
					 * GUI: internal IconAnimation API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "icon_animation.h"
 | 
					#include "icon_animation.h"
 | 
				
			||||||
@ -13,11 +18,22 @@ struct IconAnimation {
 | 
				
			|||||||
    void* callback_context;
 | 
					    void* callback_context;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get pointer to current frame data */
 | 
					/** Get pointer to current frame data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to current frame XBM bitmap data
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t* icon_animation_get_data(IconAnimation* instance);
 | 
					const uint8_t* icon_animation_get_data(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Advance to next frame */
 | 
					/** Advance to next frame
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      instance  IconAnimation instance
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void icon_animation_next_frame(IconAnimation* instance);
 | 
					void icon_animation_next_frame(IconAnimation* instance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** IconAnimation timer callback */
 | 
					/** IconAnimation timer callback
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      context  pointer to IconAnimation
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void icon_animation_timer_callback(void* context);
 | 
					void icon_animation_timer_callback(void* context);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file icon_i.h
 | 
				
			||||||
 | 
					 * GUI: internal Icon API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "icon.h"
 | 
					#include "icon.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Icon {
 | 
					struct Icon {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file button_menu.h
 | 
				
			||||||
 | 
					 * GUI: ButtonMenu view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -6,40 +12,48 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ButtonMenu anonymous structure */
 | 
					/** ButtonMenu anonymous structure */
 | 
				
			||||||
typedef struct ButtonMenu ButtonMenu;
 | 
					typedef struct ButtonMenu ButtonMenu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** ButtonMenuItem anonymous structure */
 | 
				
			||||||
typedef struct ButtonMenuItem ButtonMenuItem;
 | 
					typedef struct ButtonMenuItem ButtonMenuItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Callback for any button menu actions */
 | 
					/** Callback for any button menu actions */
 | 
				
			||||||
typedef void (*ButtonMenuItemCallback)(void* context, int32_t index, InputType type);
 | 
					typedef void (*ButtonMenuItemCallback)(void* context, int32_t index, InputType type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Type of button. Difference in drawing buttons. */
 | 
					/** Type of button. Difference in drawing buttons. */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    ButtonMenuItemTypeCommon,
 | 
					    ButtonMenuItemTypeCommon,
 | 
				
			||||||
    ButtonMenuItemTypeControl,
 | 
					    ButtonMenuItemTypeControl,
 | 
				
			||||||
} ButtonMenuItemType;
 | 
					} ButtonMenuItemType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get button menu view
 | 
				
			||||||
 * @brief Get button menu view
 | 
					 *
 | 
				
			||||||
 * @param button_menu - ButtonMenu instance
 | 
					 * @param      button_menu  ButtonMenu instance
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* button_menu_get_view(ButtonMenu* button_menu);
 | 
					View* button_menu_get_view(ButtonMenu* button_menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Clean button menu
 | 
				
			||||||
 * @brief Clean button menu
 | 
					 *
 | 
				
			||||||
 * @param button_menu - ButtonMenu instance
 | 
					 * @param      button_menu  ButtonMenu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_menu_clean(ButtonMenu* button_menu);
 | 
					void button_menu_clean(ButtonMenu* button_menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Add item to button menu instance
 | 
				
			||||||
 * @brief Add item to button menu instance
 | 
					 *
 | 
				
			||||||
 * @param button_menu   - ButtonMenu instance
 | 
					 * @param      button_menu       ButtonMenu instance
 | 
				
			||||||
 * @param label         - text inside new button
 | 
					 * @param      label             text inside new button
 | 
				
			||||||
 * @param index         - value to distinct between buttons inside ButtonMenuItemCallback
 | 
					 * @param      index             value to distinct between buttons inside
 | 
				
			||||||
 * @param type          - type of button to create. Differ by button drawing.
 | 
					 *                               ButtonMenuItemCallback
 | 
				
			||||||
 *                      Control buttons have no frames, and have more squared borders.
 | 
					 * @param      callback          The callback
 | 
				
			||||||
 * @return              pointer to just-created item
 | 
					 * @param      type              type of button to create. Differ by button
 | 
				
			||||||
 | 
					 *                               drawing. Control buttons have no frames, and
 | 
				
			||||||
 | 
					 *                               have more squared borders.
 | 
				
			||||||
 | 
					 * @param      callback_context  The callback context
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to just-created item
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ButtonMenuItem* button_menu_add_item(
 | 
					ButtonMenuItem* button_menu_add_item(
 | 
				
			||||||
    ButtonMenu* button_menu,
 | 
					    ButtonMenu* button_menu,
 | 
				
			||||||
@ -49,29 +63,29 @@ ButtonMenuItem* button_menu_add_item(
 | 
				
			|||||||
    ButtonMenuItemType type,
 | 
					    ButtonMenuItemType type,
 | 
				
			||||||
    void* callback_context);
 | 
					    void* callback_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Allocate and initialize new instance of ButtonMenu model
 | 
				
			||||||
 * @brief Allocate and initialize new instance of ButtonMenu model
 | 
					 *
 | 
				
			||||||
 * @return          just-created ButtonMenu model
 | 
					 * @return     just-created ButtonMenu model
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ButtonMenu* button_menu_alloc(void);
 | 
					ButtonMenu* button_menu_alloc(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Free ButtonMenu element
 | 
				
			||||||
 * @brief Free ButtonMenu element
 | 
					 *
 | 
				
			||||||
 * @param button_menu - ButtonMenu instance
 | 
					 * @param      button_menu  ButtonMenu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_menu_free(ButtonMenu* button_menu);
 | 
					void button_menu_free(ButtonMenu* button_menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set ButtonMenu header on top of canvas
 | 
				
			||||||
 * @brief Set ButtonMenu header on top of canvas
 | 
					 *
 | 
				
			||||||
 * @param button_menu   - ButtonMenu instance
 | 
					 * @param      button_menu  ButtonMenu instance
 | 
				
			||||||
 * @param header        - header on the top of button menu
 | 
					 * @param      header       header on the top of button menu
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_menu_set_header(ButtonMenu* button_menu, const char* header);
 | 
					void button_menu_set_header(ButtonMenu* button_menu, const char* header);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set selected item
 | 
				
			||||||
 * @brief Set selected item
 | 
					 *
 | 
				
			||||||
 * @param button_menu   - ButtonMenu instance
 | 
					 * @param      button_menu  ButtonMenu instance
 | 
				
			||||||
 * @param index         - index of ButtonMenu to be selected
 | 
					 * @param      index        index of ButtonMenu to be selected
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_menu_set_selected_item(ButtonMenu* button_menu, uint32_t index);
 | 
					void button_menu_set_selected_item(ButtonMenu* button_menu, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file button_panel.h
 | 
				
			||||||
 | 
					 * GUI: ButtonPanel view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
@ -10,37 +16,39 @@ typedef struct ButtonPanel ButtonPanel;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** Callback type to call for handling selecting button_panel items */
 | 
					/** Callback type to call for handling selecting button_panel items */
 | 
				
			||||||
typedef void (*ButtonItemCallback)(void* context, uint32_t index);
 | 
					typedef void (*ButtonItemCallback)(void* context, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Callback type for additional drawings above main button_panel screen */
 | 
					/** Callback type for additional drawings above main button_panel screen */
 | 
				
			||||||
typedef void (*ButtonPanelDrawCallback)(Canvas* canvas, void* _model);
 | 
					typedef void (*ButtonPanelDrawCallback)(Canvas* canvas, void* _model);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Callback type to intercept input events of button_panel */
 | 
					/** Callback type to intercept input events of button_panel */
 | 
				
			||||||
typedef bool (*ButtonPanelInputCallback)(InputEvent* event, void* context);
 | 
					typedef bool (*ButtonPanelInputCallback)(InputEvent* event, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate new button_panel module.
 | 
					/** Allocate new button_panel module.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return  just-created module
 | 
					 * @return     ButtonPanel instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ButtonPanel* button_panel_alloc(void);
 | 
					ButtonPanel* button_panel_alloc(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free button_panel module.
 | 
					/** Free button_panel module.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module to free
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_free(ButtonPanel* button_panel);
 | 
					void button_panel_free(ButtonPanel* button_panel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free items from button_panel module. Preallocated matrix stays unchanged.
 | 
					/** Free items from button_panel module. Preallocated matrix stays unchanged.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module to clean
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_clean(ButtonPanel* button_panel);
 | 
					void button_panel_clean(ButtonPanel* button_panel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Reserve space for adding items.
 | 
					/** Reserve space for adding items.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * One does not simply use button_panel_add_item() without this function.
 | 
					 * One does not simply use button_panel_add_item() without this function. It
 | 
				
			||||||
 * It should be allocated space for it first.
 | 
					 * should be allocated space for it first.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module to modify
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 * @param   reserve_x - number of columns in button_panel
 | 
					 * @param      reserve_x     number of columns in button_panel
 | 
				
			||||||
 * @param   reserve_y - number of rows in button_panel
 | 
					 * @param      reserve_y     number of rows in button_panel
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y);
 | 
					void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -48,20 +56,20 @@ void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t re
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * Have to set element in bounds of allocated size by X and by Y.
 | 
					 * Have to set element in bounds of allocated size by X and by Y.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module
 | 
					 * @param      button_panel        ButtonPanel instance
 | 
				
			||||||
 * @param   index - value to pass to callback
 | 
					 * @param      index               value to pass to callback
 | 
				
			||||||
 * @param   matrix_place_x - coordinates by x-axis on virtual grid, it
 | 
					 * @param      matrix_place_x      coordinates by x-axis on virtual grid, it
 | 
				
			||||||
 *                           is only used for naviagation
 | 
					 *                                 is only used for naviagation
 | 
				
			||||||
 * @param   matrix_place_y - coordinates by y-axis on virtual grid, it
 | 
					 * @param      matrix_place_y      coordinates by y-axis on virtual grid, it
 | 
				
			||||||
 *                           is only used for naviagation
 | 
					 *                                 is only used for naviagation
 | 
				
			||||||
 * @param   x - x-coordinate to draw icon on
 | 
					 * @param      x                   x-coordinate to draw icon on
 | 
				
			||||||
 * @param   y - y-coordinate to draw icon on
 | 
					 * @param      y                   y-coordinate to draw icon on
 | 
				
			||||||
 * @param   icon_name - name of the icon to draw
 | 
					 * @param      icon_name           name of the icon to draw
 | 
				
			||||||
 * @param   icon_name_selected - name of the icon to draw when current
 | 
					 * @param      icon_name_selected  name of the icon to draw when current
 | 
				
			||||||
 *                               element is selected
 | 
					 *                                 element is selected
 | 
				
			||||||
 * @param   callback - function to call when specific element is selected
 | 
					 * @param      callback            function to call when specific element is
 | 
				
			||||||
 *                     (pressed Ok on selected item)
 | 
					 *                                 selected (pressed Ok on selected item)
 | 
				
			||||||
 * @param   callback_context - context to pass to callback
 | 
					 * @param      callback_context    context to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_add_item(
 | 
					void button_panel_add_item(
 | 
				
			||||||
    ButtonPanel* button_panel,
 | 
					    ButtonPanel* button_panel,
 | 
				
			||||||
@ -77,17 +85,19 @@ void button_panel_add_item(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** Get button_panel view.
 | 
					/** Get button_panel view.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module to get view from
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 * @return  acquired view
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     acquired view
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* button_panel_get_view(ButtonPanel* button_panel);
 | 
					View* button_panel_get_view(ButtonPanel* button_panel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add label to button_panel module.
 | 
					/** Add label to button_panel module.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   x - x-coordinate to place label
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 * @param   y - y-coordinate to place label
 | 
					 * @param      x             x-coordinate to place label
 | 
				
			||||||
 * @param   font - font to write label with
 | 
					 * @param      y             y-coordinate to place label
 | 
				
			||||||
 * @param   label_str - string label to write
 | 
					 * @param      font          font to write label with
 | 
				
			||||||
 | 
					 * @param      label_str     string label to write
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_add_label(
 | 
					void button_panel_add_label(
 | 
				
			||||||
    ButtonPanel* button_panel,
 | 
					    ButtonPanel* button_panel,
 | 
				
			||||||
@ -101,9 +111,9 @@ void button_panel_add_label(
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * Used to add popup drawings after main draw callback is done.
 | 
					 * Used to add popup drawings after main draw callback is done.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module to modify
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 * @param   callback - callback function to set for draw event
 | 
					 * @param      callback      callback function to set for draw event
 | 
				
			||||||
 * @param   context - context to pass to callback
 | 
					 * @param      context       context to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_set_popup_draw_callback(
 | 
					void button_panel_set_popup_draw_callback(
 | 
				
			||||||
    ButtonPanel* button_panel,
 | 
					    ButtonPanel* button_panel,
 | 
				
			||||||
@ -112,12 +122,12 @@ void button_panel_set_popup_draw_callback(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** Set popup input callback for button_panel module.
 | 
					/** Set popup input callback for button_panel module.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Used to add popup input callback. It will intercept all input
 | 
					 * Used to add popup input callback. It will intercept all input events for
 | 
				
			||||||
 * events for current view.
 | 
					 * current view.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   button_panel - module to modify
 | 
					 * @param      button_panel  ButtonPanel instance
 | 
				
			||||||
 * @param   callback - function to overwrite main input callbacks
 | 
					 * @param      callback      function to overwrite main input callbacks
 | 
				
			||||||
 * @param   context - context to pass to callback
 | 
					 * @param      context       context to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void button_panel_set_popup_input_callback(
 | 
					void button_panel_set_popup_input_callback(
 | 
				
			||||||
    ButtonPanel* button_panel,
 | 
					    ButtonPanel* button_panel,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,59 +1,53 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file byte_input.h
 | 
				
			||||||
 | 
					 * GUI: ByteInput keyboard view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Byte input anonymous structure  */
 | 
				
			||||||
 * @brief Byte input anonymous structure 
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef struct ByteInput ByteInput;
 | 
					typedef struct ByteInput ByteInput;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** callback that is executed on save button press */
 | 
				
			||||||
 * @brief callback that is executed on save button press
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef void (*ByteInputCallback)(void* context);
 | 
					typedef void (*ByteInputCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** callback that is executed when byte buffer is changed */
 | 
				
			||||||
 * @brief callback that is executed when byte buffer is changed
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef void (*ByteChangedCallback)(void* context);
 | 
					typedef void (*ByteChangedCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 
 | 
					/** Allocate and initialize byte input. This byte input is used to enter bytes.
 | 
				
			||||||
 * @brief Allocate and initialize byte input. This byte input is used to enter bytes.
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @return     ByteInput instance pointer
 | 
				
			||||||
 * @return ByteInput instance pointer
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ByteInput* byte_input_alloc();
 | 
					ByteInput* byte_input_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 
 | 
					/** Deinitialize and free byte input
 | 
				
			||||||
 * @brief Deinitialize and free byte input
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      byte_input  Byte input instance
 | 
				
			||||||
 * @param byte_input Byte input instance
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void byte_input_free(ByteInput* byte_input);
 | 
					void byte_input_free(ByteInput* byte_input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 
 | 
					/** Get byte input view
 | 
				
			||||||
 * @brief Get byte input view
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      byte_input  byte input instance
 | 
				
			||||||
 * @param byte_input byte input instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* byte_input_get_view(ByteInput* byte_input);
 | 
					View* byte_input_get_view(ByteInput* byte_input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 
 | 
					/** Set byte input result callback
 | 
				
			||||||
 * @brief Set byte input result callback
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      byte_input        byte input instance
 | 
				
			||||||
 * @param byte_input byte input instance
 | 
					 * @param      input_callback    input callback fn
 | 
				
			||||||
 * @param input_callback input callback fn
 | 
					 * @param      changed_callback  changed callback fn
 | 
				
			||||||
 * @param changed_callback changed callback fn
 | 
					 * @param      callback_context  callback context
 | 
				
			||||||
 * @param callback_context callback context
 | 
					 * @param      bytes             buffer to use
 | 
				
			||||||
 * @param bytes buffer to use
 | 
					 * @param      bytes_count       buffer length
 | 
				
			||||||
 * @param bytes_count buffer length
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void byte_input_set_result_callback(
 | 
					void byte_input_set_result_callback(
 | 
				
			||||||
    ByteInput* byte_input,
 | 
					    ByteInput* byte_input,
 | 
				
			||||||
@ -63,11 +57,10 @@ void byte_input_set_result_callback(
 | 
				
			|||||||
    uint8_t* bytes,
 | 
					    uint8_t* bytes,
 | 
				
			||||||
    uint8_t bytes_count);
 | 
					    uint8_t bytes_count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set byte input header text
 | 
				
			||||||
 * @brief Set byte input header text
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      byte_input  byte input instance
 | 
				
			||||||
 * @param byte_input byte input instance
 | 
					 * @param      text        text to be shown
 | 
				
			||||||
 * @param text text to be shown
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void byte_input_set_header_text(ByteInput* byte_input, const char* text);
 | 
					void byte_input_set_header_text(ByteInput* byte_input, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,77 +1,95 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file dialog.h
 | 
				
			||||||
 | 
					 * GUI: Dialog view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Dialog anonymous structure */
 | 
					/** Dialog anonymous structure */
 | 
				
			||||||
typedef struct Dialog Dialog;
 | 
					typedef struct Dialog Dialog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Dialog result */
 | 
					/** Dialog result */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    DialogResultLeft,
 | 
					    DialogResultLeft,
 | 
				
			||||||
    DialogResultRight,
 | 
					    DialogResultRight,
 | 
				
			||||||
    DialogResultBack,
 | 
					    DialogResultBack,
 | 
				
			||||||
} DialogResult;
 | 
					} DialogResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Dialog result callback type
 | 
					/** Dialog result callback type
 | 
				
			||||||
 * @warning comes from GUI thread
 | 
					 * @warning    comes from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*DialogResultCallback)(DialogResult result, void* context);
 | 
					typedef void (*DialogResultCallback)(DialogResult result, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Allocate and initialize dialog
 | 
					/** Allocate and initialize dialog
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * This dialog used to ask simple questions like Yes/
 | 
					 * This dialog used to ask simple questions like Yes/
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Dialog instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Dialog* dialog_alloc();
 | 
					Dialog* dialog_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Deinitialize and free dialog
 | 
					/** Deinitialize and free dialog
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      dialog  Dialog instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_free(Dialog* dialog);
 | 
					void dialog_free(Dialog* dialog);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Get dialog view
 | 
					/** Get dialog view
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @param      dialog  Dialog instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* dialog_get_view(Dialog* dialog);
 | 
					View* dialog_get_view(Dialog* dialog);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set dialog result callback
 | 
					/** Set dialog result callback
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @param callback - result callback function
 | 
					 * @param      dialog    Dialog instance
 | 
				
			||||||
 | 
					 * @param      callback  result callback function
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_set_result_callback(Dialog* dialog, DialogResultCallback callback);
 | 
					void dialog_set_result_callback(Dialog* dialog, DialogResultCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set dialog context
 | 
					/** Set dialog context
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @param context - context pointer, will be passed to result callback
 | 
					 * @param      dialog   Dialog instance
 | 
				
			||||||
 | 
					 * @param      context  context pointer, will be passed to result callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_set_context(Dialog* dialog, void* context);
 | 
					void dialog_set_context(Dialog* dialog, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set dialog header text
 | 
					/** Set dialog header text
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog  Dialog instance
 | 
				
			||||||
 | 
					 * @param      text    text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_set_header_text(Dialog* dialog, const char* text);
 | 
					void dialog_set_header_text(Dialog* dialog, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set dialog text
 | 
					/** Set dialog text
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog  Dialog instance
 | 
				
			||||||
 | 
					 * @param      text    text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_set_text(Dialog* dialog, const char* text);
 | 
					void dialog_set_text(Dialog* dialog, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set left button text
 | 
					/** Set left button text
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog  Dialog instance
 | 
				
			||||||
 | 
					 * @param      text    text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_set_left_button_text(Dialog* dialog, const char* text);
 | 
					void dialog_set_left_button_text(Dialog* dialog, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set right button text
 | 
					/** Set right button text
 | 
				
			||||||
 * @param dialog - Dialog instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog  Dialog instance
 | 
				
			||||||
 | 
					 * @param      text    text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_set_right_button_text(Dialog* dialog, const char* text);
 | 
					void dialog_set_right_button_text(Dialog* dialog, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file dialog_ex.h
 | 
				
			||||||
 | 
					 * GUI: DialogEx view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
@ -21,40 +27,51 @@ typedef enum {
 | 
				
			|||||||
typedef void (*DialogExResultCallback)(DialogExResult result, void* context);
 | 
					typedef void (*DialogExResultCallback)(DialogExResult result, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate and initialize dialog
 | 
					/** Allocate and initialize dialog
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * This dialog used to ask simple questions
 | 
					 * This dialog used to ask simple questions
 | 
				
			||||||
 * @return DialogEx instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     DialogEx instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
DialogEx* dialog_ex_alloc();
 | 
					DialogEx* dialog_ex_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Deinitialize and free dialog
 | 
					/** Deinitialize and free dialog
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_free(DialogEx* dialog_ex);
 | 
					void dialog_ex_free(DialogEx* dialog_ex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get dialog view
 | 
					/** Get dialog view
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* dialog_ex_get_view(DialogEx* dialog_ex);
 | 
					View* dialog_ex_get_view(DialogEx* dialog_ex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set dialog result callback
 | 
					/** Set dialog result callback
 | 
				
			||||||
 * @param dialog_ex - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param callback - result callback function
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 | 
					 * @param      callback   result callback function
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_result_callback(DialogEx* dialog_ex, DialogExResultCallback callback);
 | 
					void dialog_ex_set_result_callback(DialogEx* dialog_ex, DialogExResultCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set dialog context
 | 
					/** Set dialog context
 | 
				
			||||||
 * @param dialog_ex - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param context - context pointer, will be passed to result callback
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 | 
					 * @param      context    context pointer, will be passed to result callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_context(DialogEx* dialog_ex, void* context);
 | 
					void dialog_ex_set_context(DialogEx* dialog_ex, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set dialog header text
 | 
					/** Set dialog header text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, dialog header will not be rendered
 | 
					 * If text is null, dialog header will not be rendered
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown, can be multiline
 | 
					 * @param      dialog_ex   DialogEx instance
 | 
				
			||||||
 * @param x, y - text position
 | 
					 * @param      text        text to be shown, can be multiline
 | 
				
			||||||
 * @param horizontal, vertical - text aligment
 | 
					 * @param      x           x position
 | 
				
			||||||
 | 
					 * @param      y           y position
 | 
				
			||||||
 | 
					 * @param      horizontal  horizontal text aligment
 | 
				
			||||||
 | 
					 * @param      vertical    vertical text aligment
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_header(
 | 
					void dialog_ex_set_header(
 | 
				
			||||||
    DialogEx* dialog_ex,
 | 
					    DialogEx* dialog_ex,
 | 
				
			||||||
@ -65,11 +82,15 @@ void dialog_ex_set_header(
 | 
				
			|||||||
    Align vertical);
 | 
					    Align vertical);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set dialog text
 | 
					/** Set dialog text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, dialog text will not be rendered
 | 
					 * If text is null, dialog text will not be rendered
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown, can be multiline
 | 
					 * @param      dialog_ex   DialogEx instance
 | 
				
			||||||
 * @param x, y - text position
 | 
					 * @param      text        text to be shown, can be multiline
 | 
				
			||||||
 * @param horizontal, vertical - text aligment
 | 
					 * @param      x           x position
 | 
				
			||||||
 | 
					 * @param      y           y position
 | 
				
			||||||
 | 
					 * @param      horizontal  horizontal text aligment
 | 
				
			||||||
 | 
					 * @param      vertical    vertical text aligment
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_text(
 | 
					void dialog_ex_set_text(
 | 
				
			||||||
    DialogEx* dialog_ex,
 | 
					    DialogEx* dialog_ex,
 | 
				
			||||||
@ -80,36 +101,47 @@ void dialog_ex_set_text(
 | 
				
			|||||||
    Align vertical);
 | 
					    Align vertical);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set dialog icon
 | 
					/** Set dialog icon
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If x or y is negative, dialog icon will not be rendered
 | 
					 * If x or y is negative, dialog icon will not be rendered
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param x, y - icon position
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 * @param name - icon to be shown
 | 
					 * @param      x          x position
 | 
				
			||||||
 | 
					 * @param      y          y position
 | 
				
			||||||
 | 
					 * @param      icon       The icon
 | 
				
			||||||
 | 
					 * @param      name  icon to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* icon);
 | 
					void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set left button text
 | 
					/** Set left button text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, left button will not be rendered and processed
 | 
					 * If text is null, left button will not be rendered and processed
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 | 
					 * @param      text       text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_left_button_text(DialogEx* dialog_ex, const char* text);
 | 
					void dialog_ex_set_left_button_text(DialogEx* dialog_ex, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set center button text
 | 
					/** Set center button text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, center button will not be rendered and processed
 | 
					 * If text is null, center button will not be rendered and processed
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 | 
					 * @param      text       text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_center_button_text(DialogEx* dialog_ex, const char* text);
 | 
					void dialog_ex_set_center_button_text(DialogEx* dialog_ex, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set right button text
 | 
					/** Set right button text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, right button will not be rendered and processed
 | 
					 * If text is null, right button will not be rendered and processed
 | 
				
			||||||
 * @param dialog - DialogEx instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 | 
					 * @param      text       text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_set_right_button_text(DialogEx* dialog_ex, const char* text);
 | 
					void dialog_ex_set_right_button_text(DialogEx* dialog_ex, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clean dialog
 | 
					/** Clean dialog
 | 
				
			||||||
 * @param dialog_ex DialogEx instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      dialog_ex  DialogEx instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dialog_ex_clean(DialogEx* dialog_ex);
 | 
					void dialog_ex_clean(DialogEx* dialog_ex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,26 +1,38 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file empty_screen.h
 | 
				
			||||||
 | 
					 * GUI: EmptyScreen view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Empty screen anonymous structure */
 | 
					/** Empty screen anonymous structure */
 | 
				
			||||||
typedef struct EmptyScreen EmptyScreen;
 | 
					typedef struct EmptyScreen EmptyScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Allocate and initialize empty screen
 | 
					/** Allocate and initialize empty screen
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * This empty screen used to ask simple questions like Yes/
 | 
					 * This empty screen used to ask simple questions like Yes/
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     EmptyScreen instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
EmptyScreen* empty_screen_alloc();
 | 
					EmptyScreen* empty_screen_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Deinitialize and free empty screen
 | 
					/** Deinitialize and free empty screen
 | 
				
			||||||
 * @param empty_screen - Empty screen instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      empty_screen  Empty screen instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void empty_screen_free(EmptyScreen* empty_screen);
 | 
					void empty_screen_free(EmptyScreen* empty_screen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Get empty screen view
 | 
					/** Get empty screen view
 | 
				
			||||||
 * @param empty_screen - Empty screen instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @param      empty_screen  Empty screen instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* empty_screen_get_view(EmptyScreen* empty_screen);
 | 
					View* empty_screen_get_view(EmptyScreen* empty_screen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file file_select.h
 | 
				
			||||||
 | 
					 * GUI: FileSelect view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file menu.h
 | 
				
			||||||
 | 
					 * GUI: Menu view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
@ -7,31 +13,38 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** Menu anonymous structure */
 | 
					/** Menu anonymous structure */
 | 
				
			||||||
typedef struct Menu Menu;
 | 
					typedef struct Menu Menu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Menu Item Callback */
 | 
				
			||||||
typedef void (*MenuItemCallback)(void* context, uint32_t index);
 | 
					typedef void (*MenuItemCallback)(void* context, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Menu allocation and initialization
 | 
					/** Menu allocation and initialization
 | 
				
			||||||
 * @return Menu instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Menu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Menu* menu_alloc();
 | 
					Menu* menu_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free menu
 | 
					/** Free menu
 | 
				
			||||||
 * @param menu - Menu instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      menu  Menu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void menu_free(Menu* menu);
 | 
					void menu_free(Menu* menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get Menu view
 | 
					/** Get Menu view
 | 
				
			||||||
 * @param menu - Menu instance
 | 
					 *
 | 
				
			||||||
 * @return View instance
 | 
					 * @param      menu  Menu instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* menu_get_view(Menu* menu);
 | 
					View* menu_get_view(Menu* menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add item to menu
 | 
					/** Add item to menu
 | 
				
			||||||
 * @param menu - Menu instance
 | 
					 *
 | 
				
			||||||
 * @param label - menu item string label
 | 
					 * @param      menu      Menu instance
 | 
				
			||||||
 * @param icon - IconAnimation instance
 | 
					 * @param      label     menu item string label
 | 
				
			||||||
 * @param index - menu item index
 | 
					 * @param      icon      IconAnimation instance
 | 
				
			||||||
 * @param callback - MenuItemCallback instance
 | 
					 * @param      index     menu item index
 | 
				
			||||||
 * @param context - pointer to context
 | 
					 * @param      callback  MenuItemCallback instance
 | 
				
			||||||
 | 
					 * @param      context   pointer to context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void menu_add_item(
 | 
					void menu_add_item(
 | 
				
			||||||
    Menu* menu,
 | 
					    Menu* menu,
 | 
				
			||||||
@ -42,14 +55,16 @@ void menu_add_item(
 | 
				
			|||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clean menu
 | 
					/** Clean menu
 | 
				
			||||||
 * Note: this function does not free menu instance
 | 
					 * @note       this function does not free menu instance
 | 
				
			||||||
 * @param menu - Menu instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      menu  Menu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void menu_clean(Menu* menu);
 | 
					void menu_clean(Menu* menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set current menu item
 | 
					/** Set current menu item
 | 
				
			||||||
 * @param submenu
 | 
					 *
 | 
				
			||||||
 * @param index
 | 
					 * @param      menu   Menu instance
 | 
				
			||||||
 | 
					 * @param      index  The index
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void menu_set_selected_item(Menu* menu, uint32_t index);
 | 
					void menu_set_selected_item(Menu* menu, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,52 +1,70 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file popup.h
 | 
				
			||||||
 | 
					 * GUI: Popup view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Popup anonymous structure */
 | 
					/** Popup anonymous structure */
 | 
				
			||||||
typedef struct Popup Popup;
 | 
					typedef struct Popup Popup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Popup result callback type
 | 
					/** Popup result callback type
 | 
				
			||||||
 * @warning comes from GUI thread
 | 
					 * @warning    comes from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*PopupCallback)(void* context);
 | 
					typedef void (*PopupCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Allocate and initialize popup
 | 
					/** Allocate and initialize popup
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * This popup used to ask simple questions like Yes/
 | 
					 * This popup used to ask simple questions like Yes/
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Popup instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Popup* popup_alloc();
 | 
					Popup* popup_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Deinitialize and free popup
 | 
					/** Deinitialize and free popup
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      popup  Popup instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_free(Popup* popup);
 | 
					void popup_free(Popup* popup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Get popup view
 | 
					/** Get popup view
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @param      popup  Popup instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* popup_get_view(Popup* popup);
 | 
					View* popup_get_view(Popup* popup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set popup header text
 | 
					/** Set popup header text
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      popup     Popup instance
 | 
				
			||||||
 | 
					 * @param      callback  PopupCallback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_set_callback(Popup* popup, PopupCallback callback);
 | 
					void popup_set_callback(Popup* popup, PopupCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set popup context
 | 
					/** Set popup context
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @param context - context pointer, will be passed to result callback
 | 
					 * @param      popup    Popup instance
 | 
				
			||||||
 | 
					 * @param      context  context pointer, will be passed to result callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_set_context(Popup* popup, void* context);
 | 
					void popup_set_context(Popup* popup, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set popup header text
 | 
					/** Set popup header text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, popup header will not be rendered
 | 
					 * If text is null, popup header will not be rendered
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown, can be multiline
 | 
					 * @param      popup       Popup instance
 | 
				
			||||||
 * @param x, y - text position
 | 
					 * @param      text        text to be shown, can be multiline
 | 
				
			||||||
 * @param horizontal, vertical - text aligment
 | 
					 * @param      x           x position
 | 
				
			||||||
 | 
					 * @param      y           y position
 | 
				
			||||||
 | 
					 * @param      horizontal  horizontal alignment
 | 
				
			||||||
 | 
					 * @param      vertical    vertical aligment
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_set_header(
 | 
					void popup_set_header(
 | 
				
			||||||
    Popup* popup,
 | 
					    Popup* popup,
 | 
				
			||||||
@ -56,12 +74,16 @@ void popup_set_header(
 | 
				
			|||||||
    Align horizontal,
 | 
					    Align horizontal,
 | 
				
			||||||
    Align vertical);
 | 
					    Align vertical);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set popup text
 | 
					/** Set popup text
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If text is null, popup text will not be rendered
 | 
					 * If text is null, popup text will not be rendered
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown, can be multiline
 | 
					 * @param      popup       Popup instance
 | 
				
			||||||
 * @param x, y - text position
 | 
					 * @param      text        text to be shown, can be multiline
 | 
				
			||||||
 * @param horizontal, vertical - text aligment
 | 
					 * @param      x           x position
 | 
				
			||||||
 | 
					 * @param      y           y position
 | 
				
			||||||
 | 
					 * @param      horizontal  horizontal alignment
 | 
				
			||||||
 | 
					 * @param      vertical    vertical aligment
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_set_text(
 | 
					void popup_set_text(
 | 
				
			||||||
    Popup* popup,
 | 
					    Popup* popup,
 | 
				
			||||||
@ -71,30 +93,36 @@ void popup_set_text(
 | 
				
			|||||||
    Align horizontal,
 | 
					    Align horizontal,
 | 
				
			||||||
    Align vertical);
 | 
					    Align vertical);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set popup icon
 | 
					/** Set popup icon
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * If icon position is negative, popup icon will not be rendered
 | 
					 * If icon position is negative, popup icon will not be rendered
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @param x, y - icon position
 | 
					 * @param      popup  Popup instance
 | 
				
			||||||
 * @param name - icon to be shown
 | 
					 * @param      x      x position
 | 
				
			||||||
 | 
					 * @param      y      y position
 | 
				
			||||||
 | 
					 * @param      icon   pointer to Icon data
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_set_icon(Popup* popup, uint8_t x, uint8_t y, const Icon* icon);
 | 
					void popup_set_icon(Popup* popup, uint8_t x, uint8_t y, const Icon* icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set popup timeout
 | 
					/** Set popup timeout
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 * @param timeout_in_ms - popup timeout value in milliseconds
 | 
					 * @param      popup          Popup instance
 | 
				
			||||||
 | 
					 * @param      timeout_in_ms  popup timeout value in milliseconds
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_set_timeout(Popup* popup, uint32_t timeout_in_ms);
 | 
					void popup_set_timeout(Popup* popup, uint32_t timeout_in_ms);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Enable popup timeout
 | 
					/** Enable popup timeout
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      popup  Popup instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_enable_timeout(Popup* popup);
 | 
					void popup_enable_timeout(Popup* popup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Disable popup timeout
 | 
					/** Disable popup timeout
 | 
				
			||||||
 * @param popup - Popup instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      popup  Popup instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void popup_disable_timeout(Popup* popup);
 | 
					void popup_disable_timeout(Popup* popup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,40 +1,50 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file submenu.h
 | 
				
			||||||
 | 
					 * GUI: SubMenu view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Submenu anonymous structure */
 | 
					/** Submenu anonymous structure */
 | 
				
			||||||
typedef struct Submenu Submenu;
 | 
					typedef struct Submenu Submenu;
 | 
				
			||||||
typedef void (*SubmenuItemCallback)(void* context, uint32_t index);
 | 
					typedef void (*SubmenuItemCallback)(void* context, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Allocate and initialize submenu 
 | 
				
			||||||
 * @brief Allocate and initialize submenu
 | 
					 * 
 | 
				
			||||||
 * This submenu is used to select one option
 | 
					 * This submenu is used to select one option
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Submenu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Submenu* submenu_alloc();
 | 
					Submenu* submenu_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Deinitialize and free submenu
 | 
				
			||||||
 * @brief Deinitialize and free submenu
 | 
					 *
 | 
				
			||||||
 * @param submenu - Submenu instance
 | 
					 * @param      submenu  Submenu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void submenu_free(Submenu* submenu);
 | 
					void submenu_free(Submenu* submenu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get submenu view
 | 
				
			||||||
 * @brief Get submenu view
 | 
					 *
 | 
				
			||||||
 * @param submenu - Submenu instance
 | 
					 * @param      submenu  Submenu instance
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* submenu_get_view(Submenu* submenu);
 | 
					View* submenu_get_view(Submenu* submenu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Add item to submenu
 | 
				
			||||||
 * @brief Add item to submenu
 | 
					 *
 | 
				
			||||||
 * @param submenu - Submenu instance
 | 
					 * @param      submenu           Submenu instance
 | 
				
			||||||
 * @param label - menu item label
 | 
					 * @param      label             menu item label
 | 
				
			||||||
 * @param index - menu item index, used for callback, may be the same with other items
 | 
					 * @param      index             menu item index, used for callback, may be
 | 
				
			||||||
 * @param callback - menu item callback
 | 
					 *                               the same with other items
 | 
				
			||||||
 * @param callback_context - menu item callback context
 | 
					 * @param      callback          menu item callback
 | 
				
			||||||
 | 
					 * @param      callback_context  menu item callback context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void submenu_add_item(
 | 
					void submenu_add_item(
 | 
				
			||||||
    Submenu* submenu,
 | 
					    Submenu* submenu,
 | 
				
			||||||
@ -43,23 +53,23 @@ void submenu_add_item(
 | 
				
			|||||||
    SubmenuItemCallback callback,
 | 
					    SubmenuItemCallback callback,
 | 
				
			||||||
    void* callback_context);
 | 
					    void* callback_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Remove all items from submenu
 | 
				
			||||||
 * @brief Remove all items from submenu
 | 
					 *
 | 
				
			||||||
 * @param submenu - Submenu instance
 | 
					 * @param      submenu  Submenu instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void submenu_clean(Submenu* submenu);
 | 
					void submenu_clean(Submenu* submenu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set submenu item selector
 | 
				
			||||||
 * @brief Set submenu item selector
 | 
					 *
 | 
				
			||||||
 * @param submenu
 | 
					 * @param      submenu  Submenu instance
 | 
				
			||||||
 * @param index
 | 
					 * @param      index    The index
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void submenu_set_selected_item(Submenu* submenu, uint32_t index);
 | 
					void submenu_set_selected_item(Submenu* submenu, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set optional header for submenu
 | 
				
			||||||
 * @brief Set optional header for submenu
 | 
					 *
 | 
				
			||||||
 * @param submenu   - submenu entity
 | 
					 * @param      submenu  Submenu instance
 | 
				
			||||||
 * @param header    - header to set
 | 
					 * @param      header   header to set
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void submenu_set_header(Submenu* submenu, const char* header);
 | 
					void submenu_set_header(Submenu* submenu, const char* header);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,17 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file text_box.h
 | 
				
			||||||
 | 
					 * GUI: TextBox view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* TextBox anonymous structure */
 | 
					/** TextBox anonymous structure */
 | 
				
			||||||
typedef struct TextBox TextBox;
 | 
					typedef struct TextBox TextBox;
 | 
				
			||||||
typedef void (*TextBoxExitCallback)(void* context);
 | 
					typedef void (*TextBoxExitCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,46 +21,56 @@ typedef enum {
 | 
				
			|||||||
} TextBoxFont;
 | 
					} TextBoxFont;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate and initialize text_box
 | 
					/** Allocate and initialize text_box
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     TextBox instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
TextBox* text_box_alloc();
 | 
					TextBox* text_box_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Deinitialize and free text_box
 | 
					/** Deinitialize and free text_box
 | 
				
			||||||
 * @param text_box text_box instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      text_box  text_box instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_box_free(TextBox* text_box);
 | 
					void text_box_free(TextBox* text_box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get text_box view
 | 
					/** Get text_box view
 | 
				
			||||||
 * @param text_box TextBox instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @param      text_box  TextBox instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* text_box_get_view(TextBox* text_box);
 | 
					View* text_box_get_view(TextBox* text_box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clean text_box
 | 
					/** Clean text_box
 | 
				
			||||||
 * @param text_box TextBox instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      text_box  TextBox instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_box_clean(TextBox* text_box);
 | 
					void text_box_clean(TextBox* text_box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set text for text_box
 | 
					/** Set text for text_box
 | 
				
			||||||
 * @param text_box TextBox instance
 | 
					 *
 | 
				
			||||||
 * @param text text to set
 | 
					 * @param      text_box  TextBox instance
 | 
				
			||||||
 | 
					 * @param      text      text to set
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_box_set_text(TextBox* text_box, const char* text);
 | 
					void text_box_set_text(TextBox* text_box, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set TextBox font
 | 
					/** Set TextBox font
 | 
				
			||||||
 * @param text_box TextBox instance
 | 
					 *
 | 
				
			||||||
 * @param font TextBoxFont instance
 | 
					 * @param      text_box  TextBox instance
 | 
				
			||||||
 | 
					 * @param      font      TextBoxFont instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_box_set_font(TextBox* text_box, TextBoxFont font);
 | 
					void text_box_set_font(TextBox* text_box, TextBoxFont font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set text_box context
 | 
					/** Set text_box context
 | 
				
			||||||
 * @param text_box TextBox instance
 | 
					 *
 | 
				
			||||||
 * @param context context pointer
 | 
					 * @param      text_box  TextBox instance
 | 
				
			||||||
 | 
					 * @param      context   context pointer
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_box_set_context(TextBox* text_box, void* context);
 | 
					void text_box_set_context(TextBox* text_box, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set exit callback
 | 
					/** Set exit callback
 | 
				
			||||||
 * @param text_box TextBox instance
 | 
					 *
 | 
				
			||||||
 * @param callback TextBoxExitCallback callback pointer
 | 
					 * @param      text_box  TextBox instance
 | 
				
			||||||
 | 
					 * @param      callback  TextBoxExitCallback callback pointer
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_box_set_exit_callback(TextBox* text_box, TextBoxExitCallback callback);
 | 
					void text_box_set_exit_callback(TextBox* text_box, TextBoxExitCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,44 +1,59 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file text_input.h
 | 
				
			||||||
 | 
					 * GUI: TextInput keybord view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Text input anonymous structure */
 | 
					/** Text input anonymous structure */
 | 
				
			||||||
typedef struct TextInput TextInput;
 | 
					typedef struct TextInput TextInput;
 | 
				
			||||||
typedef void (*TextInputCallback)(void* context);
 | 
					typedef void (*TextInputCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate and initialize text input
 | 
					/** Allocate and initialize text input 
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 * This text input is used to enter string
 | 
					 * This text input is used to enter string
 | 
				
			||||||
 * @return TextInput instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     TextInput instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
TextInput* text_input_alloc();
 | 
					TextInput* text_input_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Deinitialize and free text input
 | 
					/** Deinitialize and free text input
 | 
				
			||||||
 * @param text_input - TextInput instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      text_input  TextInput instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_input_free(TextInput* text_input);
 | 
					void text_input_free(TextInput* text_input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clean text input view
 | 
					/** Clean text input view Note: this function does not free memory
 | 
				
			||||||
 * Note: this function does not free memory
 | 
					 *
 | 
				
			||||||
 * @param text_input - Text input instance
 | 
					 * @param      text_input  Text input instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_input_clean(TextInput* text_input);
 | 
					void text_input_clean(TextInput* text_input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get text input view
 | 
					/** Get text input view
 | 
				
			||||||
 * @param text_input - TextInput instance
 | 
					 *
 | 
				
			||||||
 * @return View instance that can be used for embedding
 | 
					 * @param      text_input  TextInput instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance that can be used for embedding
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* text_input_get_view(TextInput* text_input);
 | 
					View* text_input_get_view(TextInput* text_input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set text input result callback
 | 
					/** Set text input result callback
 | 
				
			||||||
 * @param text_input - TextInput instance
 | 
					 *
 | 
				
			||||||
 * @param callback - callback fn
 | 
					 * @param      text_input          TextInput instance
 | 
				
			||||||
 * @param callback_context - callback context
 | 
					 * @param      callback            callback fn
 | 
				
			||||||
 * @param text_buffer - pointer to YOUR text buffer, that we going to modify
 | 
					 * @param      callback_context    callback context
 | 
				
			||||||
 * @param text_buffer_size - YOUR text buffer size in bytes. Max string length will be text_buffer_size - 1.
 | 
					 * @param      text_buffer         pointer to YOUR text buffer, that we going
 | 
				
			||||||
 * @param clear_default_text - clear text from text_buffer on first OK event
 | 
					 *                                 to modify
 | 
				
			||||||
 | 
					 * @param      text_buffer_size    YOUR text buffer size in bytes. Max string
 | 
				
			||||||
 | 
					 *                                 length will be text_buffer_size-1.
 | 
				
			||||||
 | 
					 * @param      clear_default_text  clear text from text_buffer on first OK
 | 
				
			||||||
 | 
					 *                                 event
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_input_set_result_callback(
 | 
					void text_input_set_result_callback(
 | 
				
			||||||
    TextInput* text_input,
 | 
					    TextInput* text_input,
 | 
				
			||||||
@ -49,8 +64,9 @@ void text_input_set_result_callback(
 | 
				
			|||||||
    bool clear_default_text);
 | 
					    bool clear_default_text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set text input header text
 | 
					/** Set text input header text
 | 
				
			||||||
 * @param text_input - TextInput instance
 | 
					 *
 | 
				
			||||||
 * @param text - text to be shown
 | 
					 * @param      text_input  TextInput instance
 | 
				
			||||||
 | 
					 * @param      text        text to be shown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void text_input_set_header_text(TextInput* text_input, const char* text);
 | 
					void text_input_set_header_text(TextInput* text_input, const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file variable-item-list.h
 | 
				
			||||||
 | 
					 * GUI: VariableItemList view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
@ -11,29 +17,40 @@ typedef void (*VariableItemChangeCallback)(VariableItem* item);
 | 
				
			|||||||
typedef void (*VariableItemListEnterCallback)(void* context, uint32_t index);
 | 
					typedef void (*VariableItemListEnterCallback)(void* context, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate and initialize VariableItemList
 | 
					/** Allocate and initialize VariableItemList
 | 
				
			||||||
 * @return VariableItemList* 
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     VariableItemList*
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VariableItemList* variable_item_list_alloc();
 | 
					VariableItemList* variable_item_list_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Deinitialize and free VariableItemList
 | 
					/** Deinitialize and free VariableItemList
 | 
				
			||||||
 * @param variable_item_list VariableItemList instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      variable_item_list  VariableItemList instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void variable_item_list_free(VariableItemList* variable_item_list);
 | 
					void variable_item_list_free(VariableItemList* variable_item_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clear all elements from list
 | 
					/** Clear all elements from list
 | 
				
			||||||
 * @param variable_item_list VariableItemList instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      variable_item_list  VariableItemList instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void variable_item_list_clean(VariableItemList* variable_item_list);
 | 
					void variable_item_list_clean(VariableItemList* variable_item_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get VariableItemList View instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      variable_item_list  VariableItemList instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
View* variable_item_list_get_view(VariableItemList* variable_item_list);
 | 
					View* variable_item_list_get_view(VariableItemList* variable_item_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add item to VariableItemList
 | 
					/** Add item to VariableItemList
 | 
				
			||||||
 * @param variable_item_list VariableItemList instance
 | 
					 *
 | 
				
			||||||
 * @param label item name
 | 
					 * @param      variable_item_list  VariableItemList instance
 | 
				
			||||||
 * @param values_count item values count
 | 
					 * @param      label               item name
 | 
				
			||||||
 * @param change_callback called on value change in gui
 | 
					 * @param      values_count        item values count
 | 
				
			||||||
 * @param context item context
 | 
					 * @param      change_callback     called on value change in gui
 | 
				
			||||||
 * @return VariableItem* item instance
 | 
					 * @param      context             item context
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     VariableItem* item instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VariableItem* variable_item_list_add(
 | 
					VariableItem* variable_item_list_add(
 | 
				
			||||||
    VariableItemList* variable_item_list,
 | 
					    VariableItemList* variable_item_list,
 | 
				
			||||||
@ -43,9 +60,10 @@ VariableItem* variable_item_list_add(
 | 
				
			|||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set enter callback
 | 
					/** Set enter callback
 | 
				
			||||||
 * @param variable_item_list VariableItemList instance
 | 
					 *
 | 
				
			||||||
 * @param calback VariableItemListEnterCallback instance
 | 
					 * @param      variable_item_list  VariableItemList instance
 | 
				
			||||||
 * @param context pointer to context
 | 
					 * @param      callback            VariableItemListEnterCallback instance
 | 
				
			||||||
 | 
					 * @param      context             pointer to context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void variable_item_list_set_enter_callback(
 | 
					void variable_item_list_set_enter_callback(
 | 
				
			||||||
    VariableItemList* variable_item_list,
 | 
					    VariableItemList* variable_item_list,
 | 
				
			||||||
@ -53,29 +71,35 @@ void variable_item_list_set_enter_callback(
 | 
				
			|||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set item current selected index
 | 
					/** Set item current selected index
 | 
				
			||||||
 * @param item VariableItem* instance
 | 
					 *
 | 
				
			||||||
 * @param current_value_index 
 | 
					 * @param      item                 VariableItem* instance
 | 
				
			||||||
 | 
					 * @param      current_value_index  The current value index
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void variable_item_set_current_value_index(VariableItem* item, uint8_t current_value_index);
 | 
					void variable_item_set_current_value_index(VariableItem* item, uint8_t current_value_index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set item current selected text
 | 
					/** Set item current selected text
 | 
				
			||||||
 * @param item VariableItem* instance
 | 
					 *
 | 
				
			||||||
 * @param current_value_text 
 | 
					 * @param      item                VariableItem* instance
 | 
				
			||||||
 | 
					 * @param      current_value_text  The current value text
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void variable_item_set_current_value_text(VariableItem* item, const char* current_value_text);
 | 
					void variable_item_set_current_value_text(VariableItem* item, const char* current_value_text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get item current selected index
 | 
					/** Get item current selected index
 | 
				
			||||||
 * @param item VariableItem* instance
 | 
					 *
 | 
				
			||||||
 * @return uint8_t current selected index
 | 
					 * @param      item  VariableItem* instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     uint8_t current selected index
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint8_t variable_item_get_current_value_index(VariableItem* item);
 | 
					uint8_t variable_item_get_current_value_index(VariableItem* item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get item context
 | 
					/** Get item context
 | 
				
			||||||
 * @param item VariableItem* instance
 | 
					 *
 | 
				
			||||||
 * @return void* item context
 | 
					 * @param      item  VariableItem* instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     void* item context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void* variable_item_get_context(VariableItem* item);
 | 
					void* variable_item_get_context(VariableItem* item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,38 +1,51 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file widget.h
 | 
				
			||||||
 | 
					 * GUI: Widget view module API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "widget_elements/widget_element_i.h"
 | 
					#include "widget_elements/widget_element_i.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct Widget Widget;
 | 
					typedef struct Widget Widget;
 | 
				
			||||||
typedef struct WidgetElement WidgetElement;
 | 
					typedef struct WidgetElement WidgetElement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate Widget that holds Widget Elements
 | 
					/** Allocate Widget that holds Widget Elements
 | 
				
			||||||
 * @return Widget instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Widget instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Widget* widget_alloc();
 | 
					Widget* widget_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free Widget
 | 
					/** Free Widget
 | 
				
			||||||
 * @note this function free allocated Widget Elements
 | 
					 * @note       this function free allocated Widget Elements
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      widget  Widget instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_free(Widget* widget);
 | 
					void widget_free(Widget* widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clear Widget
 | 
					/** Clear Widget
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      widget  Widget instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_clear(Widget* widget);
 | 
					void widget_clear(Widget* widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get Widget view
 | 
					/** Get Widget view
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 * @return View instance
 | 
					 * @param      widget  Widget instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     View instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
View* widget_get_view(Widget* widget);
 | 
					View* widget_get_view(Widget* widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add Multi String Element
 | 
					/** Add Multi String Element
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 * @param x - x coordinate
 | 
					 * @param      widget      Widget instance
 | 
				
			||||||
 * @param y - y coordinate
 | 
					 * @param      x           x coordinate
 | 
				
			||||||
 * @param horizontal - Align instance
 | 
					 * @param      y           y coordinate
 | 
				
			||||||
 * @param vertical - Align instance
 | 
					 * @param      horizontal  Align instance
 | 
				
			||||||
 * @param font Font instance
 | 
					 * @param      vertical    Align instance
 | 
				
			||||||
 | 
					 * @param      font        Font instance
 | 
				
			||||||
 | 
					 * @param[in]  text        The text
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_add_string_multiline_element(
 | 
					void widget_add_string_multiline_element(
 | 
				
			||||||
    Widget* widget,
 | 
					    Widget* widget,
 | 
				
			||||||
@ -44,12 +57,14 @@ void widget_add_string_multiline_element(
 | 
				
			|||||||
    const char* text);
 | 
					    const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add String Element
 | 
					/** Add String Element
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 * @param x - x coordinate
 | 
					 * @param      widget      Widget instance
 | 
				
			||||||
 * @param y - y coordinate
 | 
					 * @param      x           x coordinate
 | 
				
			||||||
 * @param horizontal - Align instance
 | 
					 * @param      y           y coordinate
 | 
				
			||||||
 * @param vertical - Align instance
 | 
					 * @param      horizontal  Align instance
 | 
				
			||||||
 * @param font Font instance
 | 
					 * @param      vertical    Align instance
 | 
				
			||||||
 | 
					 * @param      font        Font instance
 | 
				
			||||||
 | 
					 * @param[in]  text        The text
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_add_string_element(
 | 
					void widget_add_string_element(
 | 
				
			||||||
    Widget* widget,
 | 
					    Widget* widget,
 | 
				
			||||||
@ -61,11 +76,12 @@ void widget_add_string_element(
 | 
				
			|||||||
    const char* text);
 | 
					    const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add Button Element
 | 
					/** Add Button Element
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 * @param button_type GuiButtonType instance
 | 
					 * @param      widget       Widget instance
 | 
				
			||||||
 * @param text text on allocated button
 | 
					 * @param      button_type  GuiButtonType instance
 | 
				
			||||||
 * @param callback ButtonCallback instance
 | 
					 * @param      text         text on allocated button
 | 
				
			||||||
 * @param context pointer to context
 | 
					 * @param      callback     ButtonCallback instance
 | 
				
			||||||
 | 
					 * @param      context      pointer to context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_add_button_element(
 | 
					void widget_add_button_element(
 | 
				
			||||||
    Widget* widget,
 | 
					    Widget* widget,
 | 
				
			||||||
@ -75,20 +91,22 @@ void widget_add_button_element(
 | 
				
			|||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add Icon Element
 | 
					/** Add Icon Element
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 * @param x top left x coordinate
 | 
					 * @param      widget  Widget instance
 | 
				
			||||||
 * @param y top left y coordinate
 | 
					 * @param      x       top left x coordinate
 | 
				
			||||||
 * @param icon Icon instance
 | 
					 * @param      y       top left y coordinate
 | 
				
			||||||
 | 
					 * @param      icon    Icon instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_add_icon_element(Widget* widget, uint8_t x, uint8_t y, const Icon* icon);
 | 
					void widget_add_icon_element(Widget* widget, uint8_t x, uint8_t y, const Icon* icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add Frame Element
 | 
					/** Add Frame Element
 | 
				
			||||||
 * @param widget Widget instance
 | 
					 *
 | 
				
			||||||
 * @param x top left x coordinate
 | 
					 * @param      widget  Widget instance
 | 
				
			||||||
 * @param y top left y coordinate
 | 
					 * @param      x       top left x coordinate
 | 
				
			||||||
 * @param width frame width
 | 
					 * @param      y       top left y coordinate
 | 
				
			||||||
 * @param height frame height
 | 
					 * @param      width   frame width
 | 
				
			||||||
 * @param radius frame radius
 | 
					 * @param      height  frame height
 | 
				
			||||||
 | 
					 * @param      radius  frame radius
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void widget_add_frame_element(
 | 
					void widget_add_frame_element(
 | 
				
			||||||
    Widget* widget,
 | 
					    Widget* widget,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file widget_element_i.h
 | 
				
			||||||
 | 
					 * GUI: internal Widget Element API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include <furi.h>
 | 
					#include <furi.h>
 | 
				
			||||||
#include <gui/view.h>
 | 
					#include <gui/view.h>
 | 
				
			||||||
@ -29,7 +34,7 @@ struct WidgetElement {
 | 
				
			|||||||
    Widget* parent;
 | 
					    Widget* parent;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create multi string element */
 | 
					/** Create multi string element */
 | 
				
			||||||
WidgetElement* widget_element_string_multiline_create(
 | 
					WidgetElement* widget_element_string_multiline_create(
 | 
				
			||||||
    uint8_t x,
 | 
					    uint8_t x,
 | 
				
			||||||
    uint8_t y,
 | 
					    uint8_t y,
 | 
				
			||||||
@ -38,7 +43,7 @@ WidgetElement* widget_element_string_multiline_create(
 | 
				
			|||||||
    Font font,
 | 
					    Font font,
 | 
				
			||||||
    const char* text);
 | 
					    const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create string element */
 | 
					/** Create string element */
 | 
				
			||||||
WidgetElement* widget_element_string_create(
 | 
					WidgetElement* widget_element_string_create(
 | 
				
			||||||
    uint8_t x,
 | 
					    uint8_t x,
 | 
				
			||||||
    uint8_t y,
 | 
					    uint8_t y,
 | 
				
			||||||
@ -47,20 +52,20 @@ WidgetElement* widget_element_string_create(
 | 
				
			|||||||
    Font font,
 | 
					    Font font,
 | 
				
			||||||
    const char* text);
 | 
					    const char* text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create button element */
 | 
					/** Create button element */
 | 
				
			||||||
WidgetElement* widget_element_button_create(
 | 
					WidgetElement* widget_element_button_create(
 | 
				
			||||||
    GuiButtonType button_type,
 | 
					    GuiButtonType button_type,
 | 
				
			||||||
    const char* text,
 | 
					    const char* text,
 | 
				
			||||||
    ButtonCallback callback,
 | 
					    ButtonCallback callback,
 | 
				
			||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create icon element */
 | 
					/** Create icon element */
 | 
				
			||||||
WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon);
 | 
					WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create frame element */
 | 
					/** Create frame element */
 | 
				
			||||||
WidgetElement* widget_element_frame_create(
 | 
					WidgetElement* widget_element_frame_create(
 | 
				
			||||||
    uint8_t x,
 | 
					    uint8_t x,
 | 
				
			||||||
    uint8_t y,
 | 
					    uint8_t y,
 | 
				
			||||||
    uint8_t width,
 | 
					    uint8_t width,
 | 
				
			||||||
    uint8_t height,
 | 
					    uint8_t height,
 | 
				
			||||||
    uint8_t radius);
 | 
					    uint8_t radius);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,18 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file scene_manager.h
 | 
				
			||||||
 | 
					 * GUI: SceneManager API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					/** Scene Manager events type */
 | 
				
			||||||
#include <stdbool.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** Scene Manager events type
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    SceneManagerEventTypeCustom,
 | 
					    SceneManagerEventTypeCustom,
 | 
				
			||||||
    SceneManagerEventTypeBack,
 | 
					    SceneManagerEventTypeBack,
 | 
				
			||||||
@ -44,86 +48,110 @@ typedef struct {
 | 
				
			|||||||
typedef struct SceneManager SceneManager;
 | 
					typedef struct SceneManager SceneManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set Scene state
 | 
					/** Set Scene state
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param scene_id Scene ID
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 * @param state Scene new state
 | 
					 * @param      scene_id       Scene ID
 | 
				
			||||||
 | 
					 * @param      state          Scene new state
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void scene_manager_set_scene_state(SceneManager* scene_manager, uint32_t scene_id, uint32_t state);
 | 
					void scene_manager_set_scene_state(SceneManager* scene_manager, uint32_t scene_id, uint32_t state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get Scene state
 | 
					/** Get Scene state
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param scene_id Scene ID
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 * @return Scene state
 | 
					 * @param      scene_id       Scene ID
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Scene state
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint32_t scene_manager_get_scene_state(SceneManager* scene_manager, uint32_t scene_id);
 | 
					uint32_t scene_manager_get_scene_state(SceneManager* scene_manager, uint32_t scene_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Scene Manager allocation and configuration
 | 
					/** Scene Manager allocation and configuration
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Scene Manager allocates all scenes internally
 | 
					 * Scene Manager allocates all scenes internally
 | 
				
			||||||
 * @param app_scene_handlers SceneManagerHandlers instance
 | 
					 *
 | 
				
			||||||
 * @param context context to be set on Scene handlers calls
 | 
					 * @param      app_scene_handlers  SceneManagerHandlers instance
 | 
				
			||||||
 * @return SceneManager instance
 | 
					 * @param      context             context to be set on Scene handlers calls
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     SceneManager instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
SceneManager* scene_manager_alloc(const SceneManagerHandlers* app_scene_handlers, void* context);
 | 
					SceneManager* scene_manager_alloc(const SceneManagerHandlers* app_scene_handlers, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free Scene Manager with allocated Scenes
 | 
					/** Free Scene Manager with allocated Scenes
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void scene_manager_free(SceneManager* scene_manager);
 | 
					void scene_manager_free(SceneManager* scene_manager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Custom event handler
 | 
					/** Custom event handler
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Calls Scene event handler with Custom event parameter
 | 
					 * Calls Scene event handler with Custom event parameter
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param custom_event Custom event code
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 * @return true if event was consumed, false otherwise
 | 
					 * @param      custom_event   Custom event code
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if event was consumed, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool scene_manager_handle_custom_event(SceneManager* scene_manager, uint32_t custom_event);
 | 
					bool scene_manager_handle_custom_event(SceneManager* scene_manager, uint32_t custom_event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Back event handler
 | 
					/** Back event handler
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Calls Scene event handler with Back event parameter
 | 
					 * Calls Scene event handler with Back event parameter
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @return true if event was consumed, false otherwise
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if event was consumed, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool scene_manager_handle_back_event(SceneManager* scene_manager);
 | 
					bool scene_manager_handle_back_event(SceneManager* scene_manager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Tick event handler
 | 
					/** Tick event handler
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Calls Scene event handler with Tick event parameter
 | 
					 * Calls Scene event handler with Tick event parameter
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @return true if event was consumed, false otherwise
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 | 
					 * @return     true if event was consumed, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void scene_manager_handle_tick_event(SceneManager* scene_manager);
 | 
					void scene_manager_handle_tick_event(SceneManager* scene_manager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add and run next Scene
 | 
					/** Add and run next Scene
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param next_scene_id next Scene ID
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 | 
					 * @param      next_scene_id  next Scene ID
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_id);
 | 
					void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Run previous Scene
 | 
					/** Run previous Scene
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @return true if previous scene was found, false otherwise
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if previous scene was found, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool scene_manager_previous_scene(SceneManager* scene_manager);
 | 
					bool scene_manager_previous_scene(SceneManager* scene_manager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Search previous Scene
 | 
					/** Search previous Scene
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param scene_id Scene ID
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 * @return true if previous scene was found, false otherwise
 | 
					 * @param      scene_id       Scene ID
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if previous scene was found, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool scene_manager_has_previous_scene(SceneManager* scene_manager, uint32_t scene_id);
 | 
					bool scene_manager_has_previous_scene(SceneManager* scene_manager, uint32_t scene_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Search and switch to previous Scene
 | 
					/** Search and switch to previous Scene
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param scene_id Scene ID
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 * @return true if previous scene was found, false otherwise
 | 
					 * @param      scene_id       Scene ID
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if previous scene was found, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool scene_manager_search_and_switch_to_previous_scene(
 | 
					bool scene_manager_search_and_switch_to_previous_scene(
 | 
				
			||||||
    SceneManager* scene_manager,
 | 
					    SceneManager* scene_manager,
 | 
				
			||||||
    uint32_t scene_id);
 | 
					    uint32_t scene_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Clear Scene stack and switch to another Scene
 | 
					/** Clear Scene stack and switch to another Scene
 | 
				
			||||||
 * @param scene_manager SceneManager instance
 | 
					 *
 | 
				
			||||||
 * @param scene_id Scene ID
 | 
					 * @param      scene_manager  SceneManager instance
 | 
				
			||||||
 * @return true if previous scene was found, false otherwise
 | 
					 * @param      scene_id       Scene ID
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if previous scene was found, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool scene_manager_search_and_switch_to_another_scene(
 | 
					bool scene_manager_search_and_switch_to_another_scene(
 | 
				
			||||||
    SceneManager* scene_manager,
 | 
					    SceneManager* scene_manager,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file scene_manager_i.h
 | 
				
			||||||
 | 
					 * GUI: internal SceneManager API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "scene_manager.h"
 | 
					#include "scene_manager.h"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file view.h
 | 
				
			||||||
 | 
					 * GUI: View API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <input/input.h>
 | 
					#include <input/input.h>
 | 
				
			||||||
@ -27,57 +32,57 @@ typedef enum {
 | 
				
			|||||||
typedef struct View View;
 | 
					typedef struct View View;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View Draw callback
 | 
					/** View Draw callback
 | 
				
			||||||
 * @param canvas, pointer to canvas
 | 
					 * @param      canvas,      pointer to canvas
 | 
				
			||||||
 * @param view_model, pointer to context
 | 
					 * @param      view_model,  pointer to context
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*ViewDrawCallback)(Canvas* canvas, void* model);
 | 
					typedef void (*ViewDrawCallback)(Canvas* canvas, void* model);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View Input callback
 | 
					/** View Input callback
 | 
				
			||||||
 * @param event, pointer to input event data
 | 
					 * @param      event,    pointer to input event data
 | 
				
			||||||
 * @param context, pointer to context
 | 
					 * @param      context,  pointer to context
 | 
				
			||||||
 * @return true if event handled, false if event ignored
 | 
					 * @return     true if event handled, false if event ignored
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef bool (*ViewInputCallback)(InputEvent* event, void* context);
 | 
					typedef bool (*ViewInputCallback)(InputEvent* event, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View Custom callback
 | 
					/** View Custom callback
 | 
				
			||||||
 * @param event, number of custom event
 | 
					 * @param      event,    number of custom event
 | 
				
			||||||
 * @param context, pointer to context
 | 
					 * @param      context,  pointer to context
 | 
				
			||||||
 * @return true if event handled, false if event ignored
 | 
					 * @return     true if event handled, false if event ignored
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef bool (*ViewCustomCallback)(uint32_t event, void* context);
 | 
					typedef bool (*ViewCustomCallback)(uint32_t event, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View navigation callback
 | 
					/** View navigation callback
 | 
				
			||||||
 * @param context, pointer to context
 | 
					 * @param      context,  pointer to context
 | 
				
			||||||
 * @return next view id
 | 
					 * @return     next view id
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef uint32_t (*ViewNavigationCallback)(void* context);
 | 
					typedef uint32_t (*ViewNavigationCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View callback
 | 
					/** View callback
 | 
				
			||||||
 * @param context, pointer to context
 | 
					 * @param      context,  pointer to context
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*ViewCallback)(void* context);
 | 
					typedef void (*ViewCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View Update Callback
 | 
					/** View Update Callback Called upon model change, need to be propagated to GUI
 | 
				
			||||||
 * Called upon model change, need to be propagated to GUI throw ViewPort update
 | 
					 * throw ViewPort update
 | 
				
			||||||
 * @param view, pointer to view
 | 
					 * @param      view,     pointer to view
 | 
				
			||||||
 * @param context, pointer to context
 | 
					 * @param      context,  pointer to context
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*ViewUpdateCallback)(View* view, void* context);
 | 
					typedef void (*ViewUpdateCallback)(View* view, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** View model types */
 | 
					/** View model types */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    /* Model is not allocated */
 | 
					    /** Model is not allocated */
 | 
				
			||||||
    ViewModelTypeNone,
 | 
					    ViewModelTypeNone,
 | 
				
			||||||
    /* Model consist of atomic types and/or partial update is not critical for rendering.
 | 
					    /** Model consist of atomic types and/or partial update is not critical for rendering.
 | 
				
			||||||
     * Lock free.
 | 
					     * Lock free.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ViewModelTypeLockFree,
 | 
					    ViewModelTypeLockFree,
 | 
				
			||||||
    /* Model access is guarded with mutex.
 | 
					    /** Model access is guarded with mutex.
 | 
				
			||||||
     * Locking gui thread.
 | 
					     * Locking gui thread.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ViewModelTypeLocking,
 | 
					    ViewModelTypeLocking,
 | 
				
			||||||
@ -89,98 +94,115 @@ typedef enum {
 | 
				
			|||||||
View* view_alloc();
 | 
					View* view_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free View
 | 
					/** Free View
 | 
				
			||||||
 * @param View instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view  instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_free(View* view);
 | 
					void view_free(View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Tie IconAnimation with View
 | 
					/** Tie IconAnimation with View
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param icon_animation, IconAnimation instance
 | 
					 * @param      view            View instance
 | 
				
			||||||
 | 
					 * @param      icon_animation  IconAnimation instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_tie_icon_animation(View* view, IconAnimation* icon_animation);
 | 
					void view_tie_icon_animation(View* view, IconAnimation* icon_animation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set View Draw callback
 | 
					/** Set View Draw callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, draw callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  draw callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_draw_callback(View* view, ViewDrawCallback callback);
 | 
					void view_set_draw_callback(View* view, ViewDrawCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set View Input callback
 | 
					/** Set View Input callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, input callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  input callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_input_callback(View* view, ViewInputCallback callback);
 | 
					void view_set_input_callback(View* view, ViewInputCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set View Custom callback
 | 
					/** Set View Custom callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, input callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  input callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_custom_callback(View* view, ViewCustomCallback callback);
 | 
					void view_set_custom_callback(View* view, ViewCustomCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set Navigation Previous callback
 | 
					/** Set Navigation Previous callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, input callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  input callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_previous_callback(View* view, ViewNavigationCallback callback);
 | 
					void view_set_previous_callback(View* view, ViewNavigationCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set Enter callback
 | 
					/** Set Enter callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_enter_callback(View* view, ViewCallback callback);
 | 
					void view_set_enter_callback(View* view, ViewCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set Exit callback
 | 
					/** Set Exit callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_exit_callback(View* view, ViewCallback callback);
 | 
					void view_set_exit_callback(View* view, ViewCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set Update callback
 | 
					/** Set Update callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param callback, callback
 | 
					 * @param      view      View instance
 | 
				
			||||||
 | 
					 * @param      callback  callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_update_callback(View* view, ViewUpdateCallback callback);
 | 
					void view_set_update_callback(View* view, ViewUpdateCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set View Draw callback
 | 
					/** Set View Draw callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param context, context for callbacks
 | 
					 * @param      view     View instance
 | 
				
			||||||
 | 
					 * @param      context  context for callbacks
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_update_callback_context(View* view, void* context);
 | 
					void view_set_update_callback_context(View* view, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set View Draw callback
 | 
					/** Set View Draw callback
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param context, context for callbacks
 | 
					 * @param      view     View instance
 | 
				
			||||||
 | 
					 * @param      context  context for callbacks
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_context(View* view, void* context);
 | 
					void view_set_context(View* view, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set View Orientation
 | 
					/** Set View Orientation
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param orientation, either vertical or horizontal
 | 
					 * @param      view         View instance
 | 
				
			||||||
 | 
					 * @param      orientation  either vertical or horizontal
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_set_orientation(View* view, ViewOrientation orientation);
 | 
					void view_set_orientation(View* view, ViewOrientation orientation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate view model.
 | 
					/** Allocate view model.
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param type, View Model Type
 | 
					 * @param      view  View instance
 | 
				
			||||||
 * @param size, size
 | 
					 * @param      type  View Model Type
 | 
				
			||||||
 | 
					 * @param      size  size
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_allocate_model(View* view, ViewModelType type, size_t size);
 | 
					void view_allocate_model(View* view, ViewModelType type, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free view model data memory.
 | 
					/** Free view model data memory.
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view  View instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_free_model(View* view);
 | 
					void view_free_model(View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get view model data
 | 
					/** Get view model data
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @return pointer to model data
 | 
					 * @param      view  View instance
 | 
				
			||||||
 * @warning Don't forget to commit model changes
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to model data
 | 
				
			||||||
 | 
					 * @warning    Don't forget to commit model changes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void* view_get_model(View* view);
 | 
					void* view_get_model(View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Commit view model
 | 
					/** Commit view model
 | 
				
			||||||
 * @param view, View instance
 | 
					 *
 | 
				
			||||||
 * @param update, true if you want to emit view update, false otherwise
 | 
					 * @param      view    View instance
 | 
				
			||||||
 | 
					 * @param      update  true if you want to emit view update, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_commit_model(View* view, bool update);
 | 
					void view_commit_model(View* view, bool update);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -196,11 +218,13 @@ void view_commit_model(View* view, bool update);
 | 
				
			|||||||
        view_commit_model(view, update);                    \
 | 
					        view_commit_model(view, update);                    \
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
/** 
 | 
					/** With clause for view model
 | 
				
			||||||
 * With clause for view model
 | 
					 *
 | 
				
			||||||
 * @param view, View instance pointer
 | 
					 * @param      view           View instance pointer
 | 
				
			||||||
 * @param function_body a (){} lambda declaration, executed within you parent function context
 | 
					 * @param      function_body  a (){} lambda declaration, executed within you
 | 
				
			||||||
 * @return true if you want to emit view update, false otherwise
 | 
					 *                            parent function context
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if you want to emit view update, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define with_view_model(view, function_body)                      \
 | 
					#define with_view_model(view, function_body)                      \
 | 
				
			||||||
    {                                                             \
 | 
					    {                                                             \
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file view_dispatcher.h
 | 
				
			||||||
 | 
					 * GUI: ViewDispatcher API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "view.h"
 | 
					#include "view.h"
 | 
				
			||||||
@ -8,8 +13,7 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** ViewDispatcher view_port placement
 | 
					/** ViewDispatcher view_port placement */
 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    ViewDispatcherTypeNone, /**< Special layer for internal use only */
 | 
					    ViewDispatcherTypeNone, /**< Special layer for internal use only */
 | 
				
			||||||
    ViewDispatcherTypeWindow, /**< Main view_port layer, status bar is shown */
 | 
					    ViewDispatcherTypeWindow, /**< Main view_port layer, status bar is shown */
 | 
				
			||||||
@ -18,61 +22,70 @@ typedef enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef struct ViewDispatcher ViewDispatcher;
 | 
					typedef struct ViewDispatcher ViewDispatcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Prototype for custom event callback
 | 
					/** Prototype for custom event callback */
 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef bool (*ViewDispatcherCustomEventCallback)(void* context, uint32_t event);
 | 
					typedef bool (*ViewDispatcherCustomEventCallback)(void* context, uint32_t event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Prototype for navigation event callback
 | 
					/** Prototype for navigation event callback */
 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef bool (*ViewDispatcherNavigationEventCallback)(void* context);
 | 
					typedef bool (*ViewDispatcherNavigationEventCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Prototype for tick event callback
 | 
					/** Prototype for tick event callback */
 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef void (*ViewDispatcherTickEventCallback)(void* context);
 | 
					typedef void (*ViewDispatcherTickEventCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate ViewDispatcher instance
 | 
					/** Allocate ViewDispatcher instance
 | 
				
			||||||
 * @return pointer to ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to ViewDispatcher instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ViewDispatcher* view_dispatcher_alloc();
 | 
					ViewDispatcher* view_dispatcher_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Free ViewDispatcher instance
 | 
					/** Free ViewDispatcher instance
 | 
				
			||||||
 * @param view_dispatcher pointer to ViewDispatcher
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_dispatcher  pointer to ViewDispatcher
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_free(ViewDispatcher* view_dispatcher);
 | 
					void view_dispatcher_free(ViewDispatcher* view_dispatcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Enable queue support
 | 
					/** Enable queue support
 | 
				
			||||||
 * If queue enabled all input and custom events will be dispatched throw internal queue
 | 
					 *
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 * If queue enabled all input and custom events will be dispatched throw
 | 
				
			||||||
 | 
					 * internal queue
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_enable_queue(ViewDispatcher* view_dispatcher);
 | 
					void view_dispatcher_enable_queue(ViewDispatcher* view_dispatcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Send custom event
 | 
					/** Send custom event
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 | 
					 * @param[in]  event            The event
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_send_custom_event(ViewDispatcher* view_dispatcher, uint32_t event);
 | 
					void view_dispatcher_send_custom_event(ViewDispatcher* view_dispatcher, uint32_t event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set custom event handler
 | 
					/** Set custom event handler
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Called on Custom Event, if it is not consumed by view
 | 
					 * Called on Custom Event, if it is not consumed by view
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param callback ViewDispatcherCustomEventCallback instance
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 | 
					 * @param      callback         ViewDispatcherCustomEventCallback instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_set_custom_event_callback(
 | 
					void view_dispatcher_set_custom_event_callback(
 | 
				
			||||||
    ViewDispatcher* view_dispatcher,
 | 
					    ViewDispatcher* view_dispatcher,
 | 
				
			||||||
    ViewDispatcherCustomEventCallback callback);
 | 
					    ViewDispatcherCustomEventCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set navigation event handler
 | 
					/** Set navigation event handler
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Called on Input Short Back Event, if it is not consumed by view
 | 
					 * Called on Input Short Back Event, if it is not consumed by view
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param callback ViewDispatcherNavigationEventCallback instance
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 | 
					 * @param      callback         ViewDispatcherNavigationEventCallback instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_set_navigation_event_callback(
 | 
					void view_dispatcher_set_navigation_event_callback(
 | 
				
			||||||
    ViewDispatcher* view_dispatcher,
 | 
					    ViewDispatcher* view_dispatcher,
 | 
				
			||||||
    ViewDispatcherNavigationEventCallback callback);
 | 
					    ViewDispatcherNavigationEventCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set tick event handler
 | 
					/** Set tick event handler
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param callback ViewDispatcherTickEventCallback
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 * @param tick_period callback call period
 | 
					 * @param      callback         ViewDispatcherTickEventCallback
 | 
				
			||||||
 | 
					 * @param      tick_period      callback call period
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_set_tick_event_callback(
 | 
					void view_dispatcher_set_tick_event_callback(
 | 
				
			||||||
    ViewDispatcher* view_dispatcher,
 | 
					    ViewDispatcher* view_dispatcher,
 | 
				
			||||||
@ -80,46 +93,57 @@ void view_dispatcher_set_tick_event_callback(
 | 
				
			|||||||
    uint32_t tick_period);
 | 
					    uint32_t tick_period);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set event callback context
 | 
					/** Set event callback context
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param context pointer to context
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 | 
					 * @param      context          pointer to context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_set_event_callback_context(ViewDispatcher* view_dispatcher, void* context);
 | 
					void view_dispatcher_set_event_callback_context(ViewDispatcher* view_dispatcher, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Run ViewDispatcher
 | 
					/** Run ViewDispatcher
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Use only after queue enabled
 | 
					 * Use only after queue enabled
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_run(ViewDispatcher* view_dispatcher);
 | 
					void view_dispatcher_run(ViewDispatcher* view_dispatcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop ViewDispatcher
 | 
					/** Stop ViewDispatcher
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Use only after queue enabled
 | 
					 * Use only after queue enabled
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_stop(ViewDispatcher* view_dispatcher);
 | 
					void view_dispatcher_stop(ViewDispatcher* view_dispatcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Add view to ViewDispatcher
 | 
					/** Add view to ViewDispatcher
 | 
				
			||||||
 * @param view_dispatcher, ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param view_id View id to register
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 * @param view View instance
 | 
					 * @param      view_id          View id to register
 | 
				
			||||||
 | 
					 * @param      view             View instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_add_view(ViewDispatcher* view_dispatcher, uint32_t view_id, View* view);
 | 
					void view_dispatcher_add_view(ViewDispatcher* view_dispatcher, uint32_t view_id, View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Remove view from ViewDispatcher
 | 
					/** Remove view from ViewDispatcher
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param view_id View id to remove
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 | 
					 * @param      view_id          View id to remove
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_remove_view(ViewDispatcher* view_dispatcher, uint32_t view_id);
 | 
					void view_dispatcher_remove_view(ViewDispatcher* view_dispatcher, uint32_t view_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Switch to View
 | 
					/** Switch to View
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param view_id View id to register
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 * @warning switching may be delayed till input events complementarity reached
 | 
					 * @param      view_id          View id to register
 | 
				
			||||||
 | 
					 * @warning    switching may be delayed till input events complementarity
 | 
				
			||||||
 | 
					 *             reached
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_switch_to_view(ViewDispatcher* view_dispatcher, uint32_t view_id);
 | 
					void view_dispatcher_switch_to_view(ViewDispatcher* view_dispatcher, uint32_t view_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Attach ViewDispatcher to GUI
 | 
					/** Attach ViewDispatcher to GUI
 | 
				
			||||||
 * @param view_dispatcher ViewDispatcher instance
 | 
					 *
 | 
				
			||||||
 * @param gui GUI instance to attach to
 | 
					 * @param      view_dispatcher  ViewDispatcher instance
 | 
				
			||||||
 | 
					 * @param      gui              GUI instance to attach to
 | 
				
			||||||
 | 
					 * @param[in]  type             The type
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_dispatcher_attach_to_gui(
 | 
					void view_dispatcher_attach_to_gui(
 | 
				
			||||||
    ViewDispatcher* view_dispatcher,
 | 
					    ViewDispatcher* view_dispatcher,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file view_dispatcher_i.h
 | 
				
			||||||
 | 
					 * GUI: ViewDispatcher API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <furi.h>
 | 
					#include <furi.h>
 | 
				
			||||||
@ -41,23 +46,23 @@ typedef struct {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
} ViewDispatcherMessage;
 | 
					} ViewDispatcherMessage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ViewPort Draw Callback */
 | 
					/** ViewPort Draw Callback */
 | 
				
			||||||
void view_dispatcher_draw_callback(Canvas* canvas, void* context);
 | 
					void view_dispatcher_draw_callback(Canvas* canvas, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ViewPort Input Callback */
 | 
					/** ViewPort Input Callback */
 | 
				
			||||||
void view_dispatcher_input_callback(InputEvent* event, void* context);
 | 
					void view_dispatcher_input_callback(InputEvent* event, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input handler */
 | 
					/** Input handler */
 | 
				
			||||||
void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* event);
 | 
					void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Tick handler */
 | 
					/** Tick handler */
 | 
				
			||||||
void view_dispatcher_handle_tick_event(ViewDispatcher* view_dispatcher);
 | 
					void view_dispatcher_handle_tick_event(ViewDispatcher* view_dispatcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Custom event handler */
 | 
					/** Custom event handler */
 | 
				
			||||||
void view_dispatcher_handle_custom_event(ViewDispatcher* view_dispatcher, uint32_t event);
 | 
					void view_dispatcher_handle_custom_event(ViewDispatcher* view_dispatcher, uint32_t event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Set current view, dispatches view enter and exit */
 | 
					/** Set current view, dispatches view enter and exit */
 | 
				
			||||||
void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* view);
 | 
					void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ViewDispatcher update event */
 | 
					/** ViewDispatcher update event */
 | 
				
			||||||
void view_dispatcher_update(View* view, void* context);
 | 
					void view_dispatcher_update(View* view, void* context);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file view_i.h
 | 
				
			||||||
 | 
					 * GUI: internal View API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "view.h"
 | 
					#include "view.h"
 | 
				
			||||||
@ -26,26 +31,26 @@ struct View {
 | 
				
			|||||||
    void* context;
 | 
					    void* context;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* IconAnimation tie callback */
 | 
					/** IconAnimation tie callback */
 | 
				
			||||||
void view_icon_animation_callback(IconAnimation* instance, void* context);
 | 
					void view_icon_animation_callback(IconAnimation* instance, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Unlock model */
 | 
					/** Unlock model */
 | 
				
			||||||
void view_unlock_model(View* view);
 | 
					void view_unlock_model(View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Draw Callback for View dispatcher */
 | 
					/** Draw Callback for View dispatcher */
 | 
				
			||||||
void view_draw(View* view, Canvas* canvas);
 | 
					void view_draw(View* view, Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input Callback for View dispatcher */
 | 
					/** Input Callback for View dispatcher */
 | 
				
			||||||
bool view_input(View* view, InputEvent* event);
 | 
					bool view_input(View* view, InputEvent* event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Custom Callback for View dispatcher */
 | 
					/** Custom Callback for View dispatcher */
 | 
				
			||||||
bool view_custom(View* view, uint32_t event);
 | 
					bool view_custom(View* view, uint32_t event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Previous Callback for View dispatcher */
 | 
					/** Previous Callback for View dispatcher */
 | 
				
			||||||
uint32_t view_previous(View* view);
 | 
					uint32_t view_previous(View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Enter Callback for View dispatcher */
 | 
					/** Enter Callback for View dispatcher */
 | 
				
			||||||
void view_enter(View* view);
 | 
					void view_enter(View* view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Exit Callback for View dispatcher */
 | 
					/** Exit Callback for View dispatcher */
 | 
				
			||||||
void view_exit(View* view);
 | 
					void view_exit(View* view);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file view_port.h
 | 
				
			||||||
 | 
					 * GUI: ViewPort API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <input/input.h>
 | 
					#include <input/input.h>
 | 
				
			||||||
@ -15,50 +20,65 @@ typedef enum {
 | 
				
			|||||||
} ViewPortOrientation;
 | 
					} ViewPortOrientation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** ViewPort Draw callback
 | 
					/** ViewPort Draw callback
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*ViewPortDrawCallback)(Canvas* canvas, void* context);
 | 
					typedef void (*ViewPortDrawCallback)(Canvas* canvas, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** ViewPort Input callback
 | 
					/** ViewPort Input callback
 | 
				
			||||||
 * @warning called from GUI thread
 | 
					 * @warning    called from GUI thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*ViewPortInputCallback)(InputEvent* event, void* context);
 | 
					typedef void (*ViewPortInputCallback)(InputEvent* event, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** ViewPort allocator
 | 
					/** ViewPort allocator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * always returns view_port or stops system if not enough memory.
 | 
					 * always returns view_port or stops system if not enough memory.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     ViewPort instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ViewPort* view_port_alloc();
 | 
					ViewPort* view_port_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** ViewPort deallocator
 | 
					/** ViewPort deallocator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Ensure that view_port was unregistered in GUI system before use.
 | 
					 * Ensure that view_port was unregistered in GUI system before use.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_free(ViewPort* view_port);
 | 
					void view_port_free(ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set view_port width.
 | 
					/** Set view_port width.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Will be used to limit canvas drawing area and autolayout feature.
 | 
					 * Will be used to limit canvas drawing area and autolayout feature.
 | 
				
			||||||
 * @param width - wanted width, 0 - auto.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param      width      wanted width, 0 - auto.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_set_width(ViewPort* view_port, uint8_t width);
 | 
					void view_port_set_width(ViewPort* view_port, uint8_t width);
 | 
				
			||||||
uint8_t view_port_get_width(ViewPort* view_port);
 | 
					uint8_t view_port_get_width(ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set view_port height.
 | 
					/** Set view_port height.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Will be used to limit canvas drawing area and autolayout feature.
 | 
					 * Will be used to limit canvas drawing area and autolayout feature.
 | 
				
			||||||
 * @param height - wanted height, 0 - auto.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param      height     wanted height, 0 - auto.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_set_height(ViewPort* view_port, uint8_t height);
 | 
					void view_port_set_height(ViewPort* view_port, uint8_t height);
 | 
				
			||||||
uint8_t view_port_get_height(ViewPort* view_port);
 | 
					uint8_t view_port_get_height(ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Enable or disable view_port rendering.
 | 
					/** Enable or disable view_port rendering.
 | 
				
			||||||
 * @param view_port - ViewPort instance
 | 
					 *
 | 
				
			||||||
 * @param enabled
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 * @warning automatically dispatches update event
 | 
					 * @param      enabled    Indicates if enabled
 | 
				
			||||||
 | 
					 * @warning    automatically dispatches update event
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_enabled_set(ViewPort* view_port, bool enabled);
 | 
					void view_port_enabled_set(ViewPort* view_port, bool enabled);
 | 
				
			||||||
bool view_port_is_enabled(ViewPort* view_port);
 | 
					bool view_port_is_enabled(ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** ViewPort event callbacks
 | 
					/** ViewPort event callbacks
 | 
				
			||||||
 * @param callback - appropriate callback function
 | 
					 *
 | 
				
			||||||
 * @param context - context to pass to callback
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param      callback   appropriate callback function
 | 
				
			||||||
 | 
					 * @param      context    context to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_draw_callback_set(ViewPort* view_port, ViewPortDrawCallback callback, void* context);
 | 
					void view_port_draw_callback_set(ViewPort* view_port, ViewPortDrawCallback callback, void* context);
 | 
				
			||||||
void view_port_input_callback_set(
 | 
					void view_port_input_callback_set(
 | 
				
			||||||
@ -67,12 +87,17 @@ void view_port_input_callback_set(
 | 
				
			|||||||
    void* context);
 | 
					    void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Emit update signal to GUI system.
 | 
					/** Emit update signal to GUI system.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Rendering will happen later after GUI system process signal.
 | 
					 * Rendering will happen later after GUI system process signal.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_update(ViewPort* view_port);
 | 
					void view_port_update(ViewPort* view_port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set ViewPort orientation.
 | 
					/** Set ViewPort orientation.
 | 
				
			||||||
 * @param   orientation, display orientation, horizontal or vertical.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port    ViewPort instance
 | 
				
			||||||
 | 
					 * @param      orientation  display orientation, horizontal or vertical.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_set_orientation(ViewPort* view_port, ViewPortOrientation orientation);
 | 
					void view_port_set_orientation(ViewPort* view_port, ViewPortOrientation orientation);
 | 
				
			||||||
ViewPortOrientation view_port_get_orientation(const ViewPort* view_port);
 | 
					ViewPortOrientation view_port_get_orientation(const ViewPort* view_port);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file view_port_i.h
 | 
				
			||||||
 | 
					 * GUI: internal ViewPort API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "gui_i.h"
 | 
					#include "gui_i.h"
 | 
				
			||||||
@ -18,23 +23,29 @@ struct ViewPort {
 | 
				
			|||||||
    void* input_callback_context;
 | 
					    void* input_callback_context;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Set GUI reference.
 | 
				
			||||||
 * Set GUI reference.
 | 
					 *
 | 
				
			||||||
 * To be used by GUI, called upon view_port tree insert
 | 
					 * To be used by GUI, called upon view_port tree insert
 | 
				
			||||||
 * @param gui - gui instance pointer.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param      gui        gui instance pointer
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_gui_set(ViewPort* view_port, Gui* gui);
 | 
					void view_port_gui_set(ViewPort* view_port, Gui* gui);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Process draw call. Calls draw callback.
 | 
				
			||||||
 * Process draw call. Calls draw callback.
 | 
					 *
 | 
				
			||||||
 * To be used by GUI, called on tree redraw.
 | 
					 * To be used by GUI, called on tree redraw.
 | 
				
			||||||
 * @param canvas - canvas to draw at.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param      canvas     canvas to draw at
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_draw(ViewPort* view_port, Canvas* canvas);
 | 
					void view_port_draw(ViewPort* view_port, Canvas* canvas);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Process input. Calls input callback.
 | 
				
			||||||
 * Process input. Calls input callbac
 | 
					 *
 | 
				
			||||||
 * To be used by GUI, called on input dispatch.
 | 
					 * To be used by GUI, called on input dispatch.
 | 
				
			||||||
 * @param event - pointer to input event.
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      view_port  ViewPort instance
 | 
				
			||||||
 | 
					 * @param      event      pointer to input event
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void view_port_input(ViewPort* view_port, InputEvent* event);
 | 
					void view_port_input(ViewPort* view_port, InputEvent* event);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,24 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file input.h
 | 
				
			||||||
 | 
					 * Input: main API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <furi-hal-resources.h>
 | 
					#include <furi-hal-resources.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input Types
 | 
					/** Input Types
 | 
				
			||||||
 * Some of them are physical events and some logical
 | 
					 * Some of them are physical events and some logical
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    InputTypePress, /* Press event, emitted after debounce */
 | 
					    InputTypePress, /**< Press event, emitted after debounce */
 | 
				
			||||||
    InputTypeRelease, /* Release event, emitted after debounce */
 | 
					    InputTypeRelease, /**< Release event, emitted after debounce */
 | 
				
			||||||
    InputTypeShort, /* Short event, emitted after InputTypeRelease done withing INPUT_LONG_PRESS interval */
 | 
					    InputTypeShort, /**< Short event, emitted after InputTypeRelease done withing INPUT_LONG_PRESS interval */
 | 
				
			||||||
    InputTypeLong, /* Long event, emmited after INPUT_LONG_PRESS interval, asynchronouse to InputTypeRelease  */
 | 
					    InputTypeLong, /**< Long event, emmited after INPUT_LONG_PRESS interval, asynchronouse to InputTypeRelease  */
 | 
				
			||||||
    InputTypeRepeat, /* Repeat event, emmited with INPUT_REPEATE_PRESS period after InputTypeLong event */
 | 
					    InputTypeRepeat, /**< Repeat event, emmited with INPUT_REPEATE_PRESS period after InputTypeLong event */
 | 
				
			||||||
} InputType;
 | 
					} InputType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input Event, dispatches with PubSub */
 | 
					/** Input Event, dispatches with PubSub */
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
    uint32_t sequence;
 | 
					    uint32_t sequence;
 | 
				
			||||||
    InputKey key;
 | 
					    InputKey key;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file input_i.h
 | 
				
			||||||
 | 
					 * Input: internal API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "input.h"
 | 
					#include "input.h"
 | 
				
			||||||
@ -16,7 +21,7 @@
 | 
				
			|||||||
#define INPUT_LONG_PRESS_COUNTS 2
 | 
					#define INPUT_LONG_PRESS_COUNTS 2
 | 
				
			||||||
#define INPUT_THREAD_FLAG_ISR 0x00000001
 | 
					#define INPUT_THREAD_FLAG_ISR 0x00000001
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input pin state */
 | 
					/** Input pin state */
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
    const InputPin* pin;
 | 
					    const InputPin* pin;
 | 
				
			||||||
    // State
 | 
					    // State
 | 
				
			||||||
@ -27,7 +32,7 @@ typedef struct {
 | 
				
			|||||||
    volatile uint32_t counter;
 | 
					    volatile uint32_t counter;
 | 
				
			||||||
} InputPinState;
 | 
					} InputPinState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input state */
 | 
					/** Input state */
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
    osThreadId_t thread;
 | 
					    osThreadId_t thread;
 | 
				
			||||||
    PubSub event_pubsub;
 | 
					    PubSub event_pubsub;
 | 
				
			||||||
@ -36,8 +41,8 @@ typedef struct {
 | 
				
			|||||||
    volatile uint32_t counter;
 | 
					    volatile uint32_t counter;
 | 
				
			||||||
} Input;
 | 
					} Input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input press timer callback */
 | 
					/** Input press timer callback */
 | 
				
			||||||
void input_press_timer_callback(void* arg);
 | 
					void input_press_timer_callback(void* arg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Input interrupt handler */
 | 
					/** Input interrupt handler */
 | 
				
			||||||
void input_isr(void* _ctx);
 | 
					void input_isr(void* _ctx);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file api-interrupt-mgr.h
 | 
				
			||||||
 | 
					 * Furi: interrupt API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -23,45 +28,45 @@ typedef struct {
 | 
				
			|||||||
    bool ready;
 | 
					    bool ready;
 | 
				
			||||||
} InterruptCallbackItem;
 | 
					} InterruptCallbackItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Init interrupt
 | 
				
			||||||
 * Init interrupt
 | 
					 *
 | 
				
			||||||
 * @return true on succsessful initialization, false otherwise
 | 
					 * @return     true on succsessful initialization, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool api_interrupt_init();
 | 
					bool api_interrupt_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Add interrupt
 | 
				
			||||||
 * Add interrupt
 | 
					 *
 | 
				
			||||||
 * @param callback InterruptCallback
 | 
					 * @param      callback  InterruptCallback
 | 
				
			||||||
 * @param type InterruptType
 | 
					 * @param      type      InterruptType
 | 
				
			||||||
 * @param context context for callback
 | 
					 * @param      context   context for callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
 | 
					void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Remove interrupt
 | 
				
			||||||
 * Remove interrupt
 | 
					 *
 | 
				
			||||||
 * @param callback InterruptCallback
 | 
					 * @param      callback  InterruptCallback
 | 
				
			||||||
 * @param type InterruptType
 | 
					 * @param      type      InterruptType
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void api_interrupt_remove(InterruptCallback callback, InterruptType type);
 | 
					void api_interrupt_remove(InterruptCallback callback, InterruptType type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Enable interrupt
 | 
				
			||||||
 * Enable interrupt
 | 
					 *
 | 
				
			||||||
 * @param callback InterruptCallback
 | 
					 * @param      callback  InterruptCallback
 | 
				
			||||||
 * @param type InterruptType
 | 
					 * @param      type      InterruptType
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void api_interrupt_enable(InterruptCallback callback, InterruptType type);
 | 
					void api_interrupt_enable(InterruptCallback callback, InterruptType type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Disable interrupt
 | 
				
			||||||
 * Disable interrupt
 | 
					 *
 | 
				
			||||||
 * @param callback InterruptCallback
 | 
					 * @param      callback  InterruptCallback
 | 
				
			||||||
 * @param type InterruptType
 | 
					 * @param      type      InterruptType
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void api_interrupt_disable(InterruptCallback callback, InterruptType type);
 | 
					void api_interrupt_disable(InterruptCallback callback, InterruptType type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Call interrupt
 | 
				
			||||||
 * Call interrupt
 | 
					 *
 | 
				
			||||||
 * @param type InterruptType
 | 
					 * @param      type  InterruptType
 | 
				
			||||||
 * @param hw pointer to hardware peripheral
 | 
					 * @param      hw    pointer to hardware peripheral
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void api_interrupt_call(InterruptType type, void* hw);
 | 
					void api_interrupt_call(InterruptType type, void* hw);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -68,6 +68,12 @@ size_t memmgr_get_minimum_free_heap(void) {
 | 
				
			|||||||
    return xPortGetMinimumEverFreeHeapSize();
 | 
					    return xPortGetMinimumEverFreeHeapSize();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void* furi_alloc(size_t size) {
 | 
				
			||||||
 | 
					    void* p = malloc(size);
 | 
				
			||||||
 | 
					    furi_check(p);
 | 
				
			||||||
 | 
					    return memset(p, 0, size);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void* __wrap__malloc_r(struct _reent* r, size_t size) {
 | 
					void* __wrap__malloc_r(struct _reent* r, size_t size) {
 | 
				
			||||||
    void* pointer = malloc(size);
 | 
					    void* pointer = malloc(size);
 | 
				
			||||||
    return pointer;
 | 
					    return pointer;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file memmgr.h
 | 
				
			||||||
 | 
					 * Furi: memory managment API and glue
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
@ -12,14 +17,27 @@ extern "C" {
 | 
				
			|||||||
// define for test case "link against furi memmgr"
 | 
					// define for test case "link against furi memmgr"
 | 
				
			||||||
#define FURI_MEMMGR_GUARD 1
 | 
					#define FURI_MEMMGR_GUARD 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get free heap size
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     free heap size in bytes
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
size_t memmgr_get_free_heap(void);
 | 
					size_t memmgr_get_free_heap(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get heap watermark
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     minimum heap in bytes
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
size_t memmgr_get_minimum_free_heap(void);
 | 
					size_t memmgr_get_minimum_free_heap(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline static void* furi_alloc(size_t size) {
 | 
					/** Allocate memory from heap
 | 
				
			||||||
    void* p = malloc(size);
 | 
					 *
 | 
				
			||||||
    furi_check(p);
 | 
					 * @note       performs memset with 0, will crash system if not enough memory
 | 
				
			||||||
    return memset(p, 0, size);
 | 
					 *
 | 
				
			||||||
}
 | 
					 * @param[in]  size  bytes to allocate
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to allocated memory
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void* furi_alloc(size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file memmgr_heap.h
 | 
				
			||||||
 | 
					 * Furi: heap memory managment API and allocator
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
@ -10,28 +15,32 @@ extern "C" {
 | 
				
			|||||||
#define MEMMGR_HEAP_UNKNOWN 0xFFFFFFFF
 | 
					#define MEMMGR_HEAP_UNKNOWN 0xFFFFFFFF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Memmgr heap enable thread allocation tracking
 | 
					/** Memmgr heap enable thread allocation tracking
 | 
				
			||||||
 * @param thread_id - thread id to track
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      thread_id  - thread id to track
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void memmgr_heap_enable_thread_trace(osThreadId_t thread_id);
 | 
					void memmgr_heap_enable_thread_trace(osThreadId_t thread_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Memmgr heap disable thread allocation tracking
 | 
					/** Memmgr heap disable thread allocation tracking
 | 
				
			||||||
 * @param thread_id - thread id to track
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      thread_id  - thread id to track
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void memmgr_heap_disable_thread_trace(osThreadId_t thread_id);
 | 
					void memmgr_heap_disable_thread_trace(osThreadId_t thread_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Memmgr heap get allocatred thread memory
 | 
					/** Memmgr heap get allocatred thread memory
 | 
				
			||||||
 * @param thread_id - thread id to track
 | 
					 *
 | 
				
			||||||
 * @return bytes allocated right now
 | 
					 * @param      thread_id  - thread id to track
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     bytes allocated right now
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t memmgr_heap_get_thread_memory(osThreadId_t thread_id);
 | 
					size_t memmgr_heap_get_thread_memory(osThreadId_t thread_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Memmgr heap get the max contiguous block size on the heap
 | 
					/** Memmgr heap get the max contiguous block size on the heap
 | 
				
			||||||
 * @return size_t max contiguous block size
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     size_t max contiguous block size
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t memmgr_heap_get_max_free_block();
 | 
					size_t memmgr_heap_get_max_free_block();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Print the address and size of all free blocks to stdout
 | 
				
			||||||
 * Print the address and size of all free blocks to stdout
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void memmgr_heap_printf_free_blocks();
 | 
					void memmgr_heap_printf_free_blocks();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file record.h
 | 
				
			||||||
 | 
					 * Furi: record API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -6,36 +11,45 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize record storage
 | 
					/** Initialize record storage For internal use only.
 | 
				
			||||||
 * For internal use only.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_record_init();
 | 
					void furi_record_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Create record
 | 
					/** Create record
 | 
				
			||||||
 * @param name - record name
 | 
					 *
 | 
				
			||||||
 * @param data - data pointer
 | 
					 * @param      name  record name
 | 
				
			||||||
 * @note Thread safe. Create and destroy must be executed from the same thread.
 | 
					 * @param      data  data pointer
 | 
				
			||||||
 | 
					 * @note       Thread safe. Create and destroy must be executed from the same
 | 
				
			||||||
 | 
					 *             thread.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_record_create(const char* name, void* data);
 | 
					void furi_record_create(const char* name, void* data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Destroy record
 | 
					/** Destroy record
 | 
				
			||||||
 * @param name - record name
 | 
					 *
 | 
				
			||||||
 * @return true if successful, false if still have holders or thread is not owner.
 | 
					 * @param      name  record name
 | 
				
			||||||
 * @note Thread safe. Create and destroy must be executed from the same thread.
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if successful, false if still have holders or thread is not
 | 
				
			||||||
 | 
					 *             owner.
 | 
				
			||||||
 | 
					 * @note       Thread safe. Create and destroy must be executed from the same
 | 
				
			||||||
 | 
					 *             thread.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_record_destroy(const char* name);
 | 
					bool furi_record_destroy(const char* name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Open record
 | 
					/** Open record
 | 
				
			||||||
 * @param name - record name
 | 
					 *
 | 
				
			||||||
 * @return pointer to the record
 | 
					 * @param      name  record name
 | 
				
			||||||
 * @note Thread safe. Open and close must be executed from the same thread.
 | 
					 *
 | 
				
			||||||
 * Suspends caller thread till record appear
 | 
					 * @return     pointer to the record
 | 
				
			||||||
 | 
					 * @note       Thread safe. Open and close must be executed from the same
 | 
				
			||||||
 | 
					 *             thread. Suspends caller thread till record appear
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void* furi_record_open(const char* name);
 | 
					void* furi_record_open(const char* name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Close record
 | 
					/** Close record
 | 
				
			||||||
 * @param name - record name
 | 
					 *
 | 
				
			||||||
 * @note Thread safe. Open and close must be executed from the same thread.
 | 
					 * @param      name  record name
 | 
				
			||||||
 | 
					 * @note       Thread safe. Open and close must be executed from the same
 | 
				
			||||||
 | 
					 *             thread.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_record_close(const char* name);
 | 
					void furi_record_close(const char* name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file stdglue.h
 | 
				
			||||||
 | 
					 * Furi: stdlibc glue
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -7,31 +12,31 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Write callback
 | 
				
			||||||
 * Write callback
 | 
					 * @param      _cookie  pointer to cookie (see stdio gnu extension)
 | 
				
			||||||
 * @param _cookie - pointer to cookie (see stdio gnu extension)
 | 
					 * @param      data     pointer to data
 | 
				
			||||||
 * @param data - pointer to data
 | 
					 * @param      size     data size @warnign your handler must consume everything
 | 
				
			||||||
 * @param size - data size
 | 
					 | 
				
			||||||
 * @warnign your handler must consume everything
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*FuriStdglueWriteCallback)(void* _cookie, const char* data, size_t size);
 | 
					typedef void (*FuriStdglueWriteCallback)(void* _cookie, const char* data, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialized std library glue code */
 | 
					/** Initialized std library glue code */
 | 
				
			||||||
void furi_stdglue_init();
 | 
					void furi_stdglue_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set global STDOUT callback
 | 
				
			||||||
 * Set global STDOUT callback
 | 
					 *
 | 
				
			||||||
 * @param callback - callback or NULL to clear
 | 
					 * @param      callback  callback or NULL to clear
 | 
				
			||||||
 * @return true on success, otherwise fail
 | 
					 *
 | 
				
			||||||
 * @warning function is thread aware, use this API from the same thread
 | 
					 * @return     true on success, otherwise fail
 | 
				
			||||||
 | 
					 * @warning    function is thread aware, use this API from the same thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_stdglue_set_global_stdout_callback(FuriStdglueWriteCallback callback);
 | 
					bool furi_stdglue_set_global_stdout_callback(FuriStdglueWriteCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set STDOUT callback for your thread
 | 
				
			||||||
 * Set STDOUT callback for your thread
 | 
					 *
 | 
				
			||||||
 * @param callback - callback or NULL to clear
 | 
					 * @param      callback  callback or NULL to clear
 | 
				
			||||||
 * @return true on success, otherwise fail
 | 
					 *
 | 
				
			||||||
 * @warning function is thread aware, use this API from the same thread
 | 
					 * @return     true on success, otherwise fail
 | 
				
			||||||
 | 
					 * @warning    function is thread aware, use this API from the same thread
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback);
 | 
					bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file thread.h
 | 
				
			||||||
 | 
					 * Furi: Furi Thread API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
@ -18,109 +23,130 @@ typedef enum {
 | 
				
			|||||||
/** FuriThread anonymous structure */
 | 
					/** FuriThread anonymous structure */
 | 
				
			||||||
typedef struct FuriThread FuriThread;
 | 
					typedef struct FuriThread FuriThread;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** FuriThreadCallback
 | 
					/** FuriThreadCallback Your callback to run in new thread
 | 
				
			||||||
 * Your callback to run in new thread
 | 
					 * @warning    never use osThreadExit in FuriThread
 | 
				
			||||||
 * @warning don't use osThreadExit
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef int32_t (*FuriThreadCallback)(void* context);
 | 
					typedef int32_t (*FuriThreadCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** FuriThread state change calback
 | 
					/** FuriThread state change calback called upon thread state change
 | 
				
			||||||
 * called upon thread state change
 | 
					 * @param      state    new thread state
 | 
				
			||||||
 * @param state - new thread state
 | 
					 * @param      context  callback context
 | 
				
			||||||
 * @param context - callback context
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*FuriThreadStateCallback)(FuriThreadState state, void* context);
 | 
					typedef void (*FuriThreadStateCallback)(FuriThreadState state, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Allocate FuriThread
 | 
					/** Allocate FuriThread
 | 
				
			||||||
 * @return FuriThread instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     FuriThread instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
FuriThread* furi_thread_alloc();
 | 
					FuriThread* furi_thread_alloc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Release FuriThread
 | 
					/** Release FuriThread
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_free(FuriThread* thread);
 | 
					void furi_thread_free(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set FuriThread name
 | 
					/** Set FuriThread name
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @param name - string
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 | 
					 * @param      name    string
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_set_name(FuriThread* thread, const char* name);
 | 
					void furi_thread_set_name(FuriThread* thread, const char* name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set FuriThread stack size
 | 
					/** Set FuriThread stack size
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @param stack_size - stack size in bytes
 | 
					 * @param      thread      FuriThread instance
 | 
				
			||||||
 | 
					 * @param      stack_size  stack size in bytes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_set_stack_size(FuriThread* thread, size_t stack_size);
 | 
					void furi_thread_set_stack_size(FuriThread* thread, size_t stack_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set FuriThread callback
 | 
					/** Set FuriThread callback
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @param callback - FuriThreadCallback, called upon thread run
 | 
					 * @param      thread    FuriThread instance
 | 
				
			||||||
 | 
					 * @param      callback  FuriThreadCallback, called upon thread run
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_set_callback(FuriThread* thread, FuriThreadCallback callback);
 | 
					void furi_thread_set_callback(FuriThread* thread, FuriThreadCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set FuriThread context
 | 
					/** Set FuriThread context
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @param context - pointer to context for thread callback
 | 
					 * @param      thread   FuriThread instance
 | 
				
			||||||
 | 
					 * @param      context  pointer to context for thread callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_set_context(FuriThread* thread, void* context);
 | 
					void furi_thread_set_context(FuriThread* thread, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set FuriThread state change callback
 | 
					/** Set FuriThread state change callback
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @param callack - state change callback
 | 
					 * @param      thread    FuriThread instance
 | 
				
			||||||
 | 
					 * @param      callback  state change callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_set_state_callback(FuriThread* thread, FuriThreadStateCallback callback);
 | 
					void furi_thread_set_state_callback(FuriThread* thread, FuriThreadStateCallback callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set FuriThread state change context
 | 
					/** Set FuriThread state change context
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @param context - pointer to context
 | 
					 * @param      thread   FuriThread instance
 | 
				
			||||||
 | 
					 * @param      context  pointer to context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_set_state_context(FuriThread* thread, void* context);
 | 
					void furi_thread_set_state_context(FuriThread* thread, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get FuriThread state
 | 
					/** Get FuriThread state
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @return thread state from FuriThreadState
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     thread state from FuriThreadState
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
FuriThreadState furi_thread_get_state(FuriThread* thread);
 | 
					FuriThreadState furi_thread_get_state(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start FuriThread
 | 
					/** Start FuriThread
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @return true on success
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_thread_start(FuriThread* thread);
 | 
					bool furi_thread_start(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Treminate FuriThread
 | 
					/** Treminate FuriThread
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @return osStatus_t
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 * @warning terminating statefull thread is dangerous
 | 
					 *
 | 
				
			||||||
 * use only if you know what you doing
 | 
					 * @return     osStatus_t
 | 
				
			||||||
 | 
					 * @warning    terminating statefull thread is dangerous use only if you know
 | 
				
			||||||
 | 
					 *             what you doing
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
osStatus_t furi_thread_terminate(FuriThread* thread);
 | 
					osStatus_t furi_thread_terminate(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Join FuriThread
 | 
					/** Join FuriThread
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @return osStatus_t
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     osStatus_t
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
osStatus_t furi_thread_join(FuriThread* thread);
 | 
					osStatus_t furi_thread_join(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get CMSIS Thread ID
 | 
					/** Get CMSIS Thread ID
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 * @return osThreadId_t or NULL
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     osThreadId_t or NULL
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
osThreadId_t furi_thread_get_thread_id(FuriThread* thread);
 | 
					osThreadId_t furi_thread_get_thread_id(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Enable heap tracing
 | 
					/** Enable heap tracing
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_enable_heap_trace(FuriThread* thread);
 | 
					void furi_thread_enable_heap_trace(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Disable heap tracing
 | 
					/** Disable heap tracing
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_thread_disable_heap_trace(FuriThread* thread);
 | 
					void furi_thread_disable_heap_trace(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get thread heap size
 | 
					/** Get thread heap size
 | 
				
			||||||
 * @param thread - FuriThread instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      thread  FuriThread instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     size in bytes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_thread_get_heap_size(FuriThread* thread);
 | 
					size_t furi_thread_get_heap_size(FuriThread* thread);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2608
									
								
								documentation/Doxyfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2608
									
								
								documentation/Doxyfile
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -5,70 +5,88 @@
 | 
				
			|||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get flash base address
 | 
					/** Get flash base address
 | 
				
			||||||
 * @return pointer to flash base
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to flash base
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_base();
 | 
					size_t furi_hal_flash_get_base();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get flash read block size
 | 
					/** Get flash read block size
 | 
				
			||||||
 * @return size in bytes
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     size in bytes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_read_block_size();
 | 
					size_t furi_hal_flash_get_read_block_size();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get flash write block size
 | 
					/** Get flash write block size
 | 
				
			||||||
 * @return size in bytes
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     size in bytes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_write_block_size();
 | 
					size_t furi_hal_flash_get_write_block_size();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get flash page size
 | 
					/** Get flash page size
 | 
				
			||||||
 * @return size in bytes
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     size in bytes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_page_size();
 | 
					size_t furi_hal_flash_get_page_size();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get expected flash cycles count
 | 
					/** Get expected flash cycles count
 | 
				
			||||||
 * @return count of erase-write operations 
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     count of erase-write operations
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_cycles_count();
 | 
					size_t furi_hal_flash_get_cycles_count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get free flash start address
 | 
					/** Get free flash start address
 | 
				
			||||||
 * @return pointer to free region start
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to free region start
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const void* furi_hal_flash_get_free_start_address();
 | 
					const void* furi_hal_flash_get_free_start_address();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get free flash end address
 | 
					/** Get free flash end address
 | 
				
			||||||
 * @return pointer to free region end
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to free region end
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const void* furi_hal_flash_get_free_end_address();
 | 
					const void* furi_hal_flash_get_free_end_address();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get first free page start address
 | 
					/** Get first free page start address
 | 
				
			||||||
 * @return first free page memory address
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     first free page memory address
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_free_page_start_address();
 | 
					size_t furi_hal_flash_get_free_page_start_address();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get free page count
 | 
					/** Get free page count
 | 
				
			||||||
 * @return free page count
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     free page count
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_flash_get_free_page_count();
 | 
					size_t furi_hal_flash_get_free_page_count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Erase Flash
 | 
				
			||||||
 * Erase Flash
 | 
					 *
 | 
				
			||||||
 * Locking operation, uses HSEM to manage shared access.
 | 
					 * Locking operation, uses HSEM to manage shared access.
 | 
				
			||||||
 * @param page, page number
 | 
					 *
 | 
				
			||||||
 * @param count, page count to erase
 | 
					 * @param      page   page number
 | 
				
			||||||
 | 
					 * @param      count  page count to erase
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_flash_erase(uint8_t page, uint8_t count);
 | 
					bool furi_hal_flash_erase(uint8_t page, uint8_t count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Write double word (64 bits)
 | 
				
			||||||
 * Write double word (64 bits)
 | 
					 *
 | 
				
			||||||
 * Locking operation, uses HSEM to manage shared access.
 | 
					 * Locking operation, uses HSEM to manage shared access.
 | 
				
			||||||
 * @param address - destination address, must be double word aligned.
 | 
					 *
 | 
				
			||||||
 * @param data - data to write
 | 
					 * @param      address  destination address, must be double word aligned.
 | 
				
			||||||
 | 
					 * @param      data     data to write
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_flash_write_dword(size_t address, uint64_t data);
 | 
					bool furi_hal_flash_write_dword(size_t address, uint64_t data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/** Write double word (64 bits) from address
 | 
				
			||||||
 * Write double word (64 bits) from address
 | 
					 *
 | 
				
			||||||
 * Locking operation, uses HSEM to manage shared access.
 | 
					 * Locking operation, uses HSEM to manage shared access.
 | 
				
			||||||
 * @param address - destination address, must be block aligned
 | 
					 *
 | 
				
			||||||
 * @param source_address - source address
 | 
					 * @param      address         destination address, must be block aligned
 | 
				
			||||||
 | 
					 * @param      source_address  source address
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_flash_write_dword_from(size_t address, size_t source_address);
 | 
					bool furi_hal_flash_write_dword_from(size_t address, size_t source_address);
 | 
				
			||||||
 | 
				
			|||||||
@ -290,14 +290,6 @@ void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t furi_hal_subghz_get_status() {
 | 
					 | 
				
			||||||
    const FuriHalSpiDevice* device = furi_hal_spi_device_get(FuriHalSpiDeviceIdSubGhz);
 | 
					 | 
				
			||||||
    CC1101StatusRaw st;
 | 
					 | 
				
			||||||
    st.status = cc1101_get_status(device);
 | 
					 | 
				
			||||||
    furi_hal_spi_device_return(device);
 | 
					 | 
				
			||||||
    return st.status_raw;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void furi_hal_subghz_load_registers(const uint8_t data[][2]) {
 | 
					void furi_hal_subghz_load_registers(const uint8_t data[][2]) {
 | 
				
			||||||
    const FuriHalSpiDevice* device = furi_hal_spi_device_get(FuriHalSpiDeviceIdSubGhz);
 | 
					    const FuriHalSpiDevice* device = furi_hal_spi_device_get(FuriHalSpiDeviceIdSubGhz);
 | 
				
			||||||
    cc1101_reset(device);
 | 
					    cc1101_reset(device);
 | 
				
			||||||
 | 
				
			|||||||
@ -290,14 +290,6 @@ void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t furi_hal_subghz_get_status() {
 | 
					 | 
				
			||||||
    const FuriHalSpiDevice* device = furi_hal_spi_device_get(FuriHalSpiDeviceIdSubGhz);
 | 
					 | 
				
			||||||
    CC1101StatusRaw st;
 | 
					 | 
				
			||||||
    st.status = cc1101_get_status(device);
 | 
					 | 
				
			||||||
    furi_hal_spi_device_return(device);
 | 
					 | 
				
			||||||
    return st.status_raw;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void furi_hal_subghz_load_registers(const uint8_t data[][2]) {
 | 
					void furi_hal_subghz_load_registers(const uint8_t data[][2]) {
 | 
				
			||||||
    const FuriHalSpiDevice* device = furi_hal_spi_device_get(FuriHalSpiDeviceIdSubGhz);
 | 
					    const FuriHalSpiDevice* device = furi_hal_spi_device_get(FuriHalSpiDeviceIdSubGhz);
 | 
				
			||||||
    cc1101_reset(device);
 | 
					    cc1101_reset(device);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-boot.h
 | 
				
			||||||
 | 
					 * Bootloader HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
@ -17,16 +23,26 @@ typedef enum {
 | 
				
			|||||||
    FuriHalBootFlagFactoryReset=1,
 | 
					    FuriHalBootFlagFactoryReset=1,
 | 
				
			||||||
} FuriHalBootFlag;
 | 
					} FuriHalBootFlag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize boot subsystem */
 | 
					/** Initialize boot subsystem
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_boot_init();
 | 
					void furi_hal_boot_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set boot mode */
 | 
					/** Set boot mode
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  mode  FuriHalBootMode
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_boot_set_mode(FuriHalBootMode mode);
 | 
					void furi_hal_boot_set_mode(FuriHalBootMode mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set boot flags */
 | 
					/** Set boot flags
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  flags  FuriHalBootFlag
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_boot_set_flags(FuriHalBootFlag flags);
 | 
					void furi_hal_boot_set_flags(FuriHalBootFlag flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get boot flag */
 | 
					/** Get boot flag
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     FuriHalBootFlag
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
FuriHalBootFlag furi_hal_boot_get_flags();
 | 
					FuriHalBootFlag furi_hal_boot_get_flags();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-bt.h
 | 
				
			||||||
 | 
					 * BT/BLE HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <m-string.h>
 | 
					#include <m-string.h>
 | 
				
			||||||
@ -7,64 +12,114 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize */
 | 
					/** Initialize
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_init();
 | 
					void furi_hal_bt_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start BLE app */
 | 
					/** Start BLE app
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if app inited
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_bt_init_app();
 | 
					bool furi_hal_bt_init_app();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start advertising */
 | 
					/** Start advertising
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_start_advertising();
 | 
					void furi_hal_bt_start_advertising();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop advertising */
 | 
					/** Stop advertising
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_stop_advertising();
 | 
					void furi_hal_bt_stop_advertising();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Returns true if BLE is advertising */
 | 
					/** Returns true if BLE is advertising
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if BLE advertising
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_bt_is_active();
 | 
					bool furi_hal_bt_is_active();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get BT/BLE system component state */
 | 
					/** Get BT/BLE system component state
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  buffer  string_t buffer to write to
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_dump_state(string_t buffer);
 | 
					void furi_hal_bt_dump_state(string_t buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get BT/BLE system component state */
 | 
					/** Get BT/BLE system component state
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if core2 is alive
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_bt_is_alive();
 | 
					bool furi_hal_bt_is_alive();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Wait for Core2 startup */
 | 
					/** Wait for Core2 startup
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if success, otherwise timeouted
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_bt_wait_startup();
 | 
					bool furi_hal_bt_wait_startup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Lock shared access to flash controller
 | 
				
			||||||
 * Lock shared access to flash controller
 | 
					 *
 | 
				
			||||||
 * @return true if lock was successful, false if not
 | 
					 * @param[in]  erase_flag  true if erase operation
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if lock was successful, false if not
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_bt_lock_flash(bool erase_flag);
 | 
					bool furi_hal_bt_lock_flash(bool erase_flag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Unlock shared access to flash controller */
 | 
					/** Unlock shared access to flash controller
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  erase_flag  true if erase operation
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_unlock_flash(bool erase_flag);
 | 
					void furi_hal_bt_unlock_flash(bool erase_flag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start ble tone tx at given channel and power */
 | 
					/** Start ble tone tx at given channel and power
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  channel  The channel
 | 
				
			||||||
 | 
					 * @param[in]  power    The power
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power);
 | 
					void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop ble tone tx */
 | 
					/** Stop ble tone tx
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_stop_tone_tx();
 | 
					void furi_hal_bt_stop_tone_tx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start sending ble packets at a given frequency and datarate */
 | 
					/** Start sending ble packets at a given frequency and datarate
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  channel   The channel
 | 
				
			||||||
 | 
					 * @param[in]  pattern   The pattern
 | 
				
			||||||
 | 
					 * @param[in]  datarate  The datarate
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_start_packet_tx(uint8_t channel, uint8_t pattern, uint8_t datarate);
 | 
					void furi_hal_bt_start_packet_tx(uint8_t channel, uint8_t pattern, uint8_t datarate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop sending ble packets */
 | 
					/** Stop sending ble packets
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     sent packet count
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint16_t furi_hal_bt_stop_packet_test();
 | 
					uint16_t furi_hal_bt_stop_packet_test();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start receiving packets */
 | 
					/** Start receiving packets
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  channel   RX channel
 | 
				
			||||||
 | 
					 * @param[in]  datarate  Datarate
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_start_packet_rx(uint8_t channel, uint8_t datarate);
 | 
					void furi_hal_bt_start_packet_rx(uint8_t channel, uint8_t datarate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set up the RF to listen to a given RF channel */
 | 
					/** Set up the RF to listen to a given RF channel
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  channel  RX channel
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_start_rx(uint8_t channel);
 | 
					void furi_hal_bt_start_rx(uint8_t channel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop RF listenning */
 | 
					/** Stop RF listenning
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_bt_stop_rx();
 | 
					void furi_hal_bt_stop_rx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get RSSI */
 | 
					/** Get RSSI
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     RSSI in dBm
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_bt_get_rssi();
 | 
					float furi_hal_bt_get_rssi();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get number of transmitted packets */
 | 
					/** Get number of transmitted packets
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     packet count
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint32_t furi_hal_bt_get_transmitted_packets();
 | 
					uint32_t furi_hal_bt_get_transmitted_packets();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,7 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-crypto.h
 | 
				
			||||||
 | 
					 * Cryptography HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -24,43 +28,54 @@ typedef struct {
 | 
				
			|||||||
    uint8_t* data;
 | 
					    uint8_t* data;
 | 
				
			||||||
} FuriHalCryptoKey;
 | 
					} FuriHalCryptoKey;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize cryptography layer
 | 
					/** Initialize cryptography layer This includes AES engines, PKA and RNG
 | 
				
			||||||
 * This includes AES engines, PKA and RNG
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_crypto_init();
 | 
					void furi_hal_crypto_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Store key in crypto storage
 | 
					/** Store key in crypto storage
 | 
				
			||||||
 * @param key - FuriHalCryptoKey to store. Only Master, Simple or Encrypted
 | 
					 *
 | 
				
			||||||
 * @param slot - pinter to int where store slot number will be saved
 | 
					 * @param      key   FuriHalCryptoKey to store. Only Master, Simple or
 | 
				
			||||||
 * @return true on success
 | 
					 *                   Encrypted
 | 
				
			||||||
 | 
					 * @param      slot  pinter to int where store slot number will be saved
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_crypto_store_add_key(FuriHalCryptoKey* key, uint8_t* slot);
 | 
					bool furi_hal_crypto_store_add_key(FuriHalCryptoKey* key, uint8_t* slot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Init AES engine and load key from crypto store
 | 
					/** Init AES engine and load key from crypto store
 | 
				
			||||||
 * @param slot - store slot number
 | 
					 *
 | 
				
			||||||
 * @return true on success
 | 
					 * @param      slot  store slot number
 | 
				
			||||||
 | 
					 * @param[in]  iv    pointer to 16 bytes Initialization Vector data
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_crypto_store_load_key(uint8_t slot, const uint8_t* iv);
 | 
					bool furi_hal_crypto_store_load_key(uint8_t slot, const uint8_t* iv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Unload key engine and deinit AES engine
 | 
					/** Unload key engine and deinit AES engine
 | 
				
			||||||
 * @param slot - store slot number
 | 
					 *
 | 
				
			||||||
 * @return true on success
 | 
					 * @param      slot  store slot number
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_crypto_store_unload_key(uint8_t slot);
 | 
					bool furi_hal_crypto_store_unload_key(uint8_t slot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Encrypt data
 | 
					/** Encrypt data
 | 
				
			||||||
 * @param input - pointer to input data
 | 
					 *
 | 
				
			||||||
 * @param output - pointer to output data
 | 
					 * @param      input   pointer to input data
 | 
				
			||||||
 * @param size - input/output buffer size in bytes
 | 
					 * @param      output  pointer to output data
 | 
				
			||||||
 * @return true on success
 | 
					 * @param      size    input/output buffer size in bytes
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_crypto_encrypt(const uint8_t *input, uint8_t *output, size_t size);
 | 
					bool furi_hal_crypto_encrypt(const uint8_t *input, uint8_t *output, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Decrypt data
 | 
					/** Decrypt data
 | 
				
			||||||
 * @param input - pointer to input data
 | 
					 *
 | 
				
			||||||
 * @param output - pointer to output data
 | 
					 * @param      input   pointer to input data
 | 
				
			||||||
 * @param size - input/output buffer size in bytes
 | 
					 * @param      output  pointer to output data
 | 
				
			||||||
 * @return true on success
 | 
					 * @param      size    input/output buffer size in bytes
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_crypto_decrypt(const uint8_t *input, uint8_t *output, size_t size);
 | 
					bool furi_hal_crypto_decrypt(const uint8_t *input, uint8_t *output, size_t size);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,39 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-delay.h
 | 
				
			||||||
 | 
					 * Delay HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "main.h"
 | 
					#include "main.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Init DWT */
 | 
					/** Init DWT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_delay_init(void);
 | 
					void furi_hal_delay_init(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Delay in milliseconds
 | 
				
			||||||
 * Delay in milliseconds
 | 
					 * @warning    Cannot be used from ISR
 | 
				
			||||||
 * @warning Cannot be used from ISR
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  milliseconds  milliseconds to wait
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void delay(float milliseconds);
 | 
					void delay(float milliseconds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Delay in microseconds */
 | 
					/** Delay in microseconds
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  microseconds  microseconds to wait
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void delay_us(float microseconds);
 | 
					void delay_us(float microseconds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get current millisecond */
 | 
					/** Get current millisecond
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * System uptime, pProvided by HAL, may overflow.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Current milliseconds
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint32_t millis(void);
 | 
					uint32_t millis(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-i2c.h
 | 
				
			||||||
 | 
					 * I2C HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -8,17 +13,19 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Init I2C */
 | 
					/** Init I2C
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_i2c_init();
 | 
					void furi_hal_i2c_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Perform I2C tx transfer
 | 
				
			||||||
 * Perform I2C tx transfer
 | 
					 *
 | 
				
			||||||
 * @param instance I2C_TypeDef instance
 | 
					 * @param      instance  I2C_TypeDef instance
 | 
				
			||||||
 * @param address I2C slave address
 | 
					 * @param      address   I2C slave address
 | 
				
			||||||
 * @param data pointer to data buffer
 | 
					 * @param      data      pointer to data buffer
 | 
				
			||||||
 * @param size size of data buffer
 | 
					 * @param      size      size of data buffer
 | 
				
			||||||
 * @param timeout timeout in CPU ticks
 | 
					 * @param      timeout   timeout in CPU ticks
 | 
				
			||||||
 * @return true on successful transfer, false otherwise
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on successful transfer, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_i2c_tx(
 | 
					bool furi_hal_i2c_tx(
 | 
				
			||||||
    I2C_TypeDef* instance,
 | 
					    I2C_TypeDef* instance,
 | 
				
			||||||
@ -27,14 +34,15 @@ bool furi_hal_i2c_tx(
 | 
				
			|||||||
    const uint8_t size,
 | 
					    const uint8_t size,
 | 
				
			||||||
    uint32_t timeout);
 | 
					    uint32_t timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Perform I2C rx transfer
 | 
				
			||||||
 * Perform I2C rx transfer
 | 
					 *
 | 
				
			||||||
 * @param instance I2C_TypeDef instance
 | 
					 * @param      instance  I2C_TypeDef instance
 | 
				
			||||||
 * @param address I2C slave address
 | 
					 * @param      address   I2C slave address
 | 
				
			||||||
 * @param data pointer to data buffer
 | 
					 * @param      data      pointer to data buffer
 | 
				
			||||||
 * @param size size of data buffer
 | 
					 * @param      size      size of data buffer
 | 
				
			||||||
 * @param timeout timeout in CPU ticks
 | 
					 * @param      timeout   timeout in CPU ticks
 | 
				
			||||||
 * @return true on successful transfer, false otherwise
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on successful transfer, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_i2c_rx(
 | 
					bool furi_hal_i2c_rx(
 | 
				
			||||||
    I2C_TypeDef* instance,
 | 
					    I2C_TypeDef* instance,
 | 
				
			||||||
@ -43,16 +51,17 @@ bool furi_hal_i2c_rx(
 | 
				
			|||||||
    const uint8_t size,
 | 
					    const uint8_t size,
 | 
				
			||||||
    uint32_t timeout);
 | 
					    uint32_t timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Perform I2C tx and rx transfers
 | 
				
			||||||
 * Perform I2C tx and rx transfers
 | 
					 *
 | 
				
			||||||
 * @param instance I2C_TypeDef instance
 | 
					 * @param      instance  I2C_TypeDef instance
 | 
				
			||||||
 * @param address I2C slave address
 | 
					 * @param      address   I2C slave address
 | 
				
			||||||
 * @param tx_data pointer to tx data buffer
 | 
					 * @param      tx_data   pointer to tx data buffer
 | 
				
			||||||
 * @param tx_size size of tx data buffer
 | 
					 * @param      tx_size   size of tx data buffer
 | 
				
			||||||
 * @param rx_data pointer to rx data buffer
 | 
					 * @param      rx_data   pointer to rx data buffer
 | 
				
			||||||
 * @param rx_size size of rx data buffer
 | 
					 * @param      rx_size   size of rx data buffer
 | 
				
			||||||
 * @param timeout timeout in CPU ticks
 | 
					 * @param      timeout   timeout in CPU ticks
 | 
				
			||||||
 * @return true on successful transfer, false otherwise
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on successful transfer, false otherwise
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_i2c_trx(
 | 
					bool furi_hal_i2c_trx(
 | 
				
			||||||
    I2C_TypeDef* instance,
 | 
					    I2C_TypeDef* instance,
 | 
				
			||||||
@ -63,17 +72,22 @@ bool furi_hal_i2c_trx(
 | 
				
			|||||||
    const uint8_t rx_size,
 | 
					    const uint8_t rx_size,
 | 
				
			||||||
    uint32_t timeout);
 | 
					    uint32_t timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Acquire I2C mutex */
 | 
					/** Acquire I2C mutex
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_i2c_lock();
 | 
					void furi_hal_i2c_lock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Release I2C mutex */
 | 
					/** Release I2C mutex
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_i2c_unlock();
 | 
					void furi_hal_i2c_unlock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** With clause for I2C peripheral
 | 
				
			||||||
 * With clause for I2C peripheral
 | 
					 *
 | 
				
			||||||
 * @param type type of function_body
 | 
					 * @param      type           type of function_body
 | 
				
			||||||
 * @param pointer pointer to return of function_body
 | 
					 * @param      pointer        pointer to return of function_body
 | 
				
			||||||
 * @param function_body a (){} lambda declaration, executed with I2C mutex acquired
 | 
					 * @param      function_body  a (){} lambda declaration, executed with I2C mutex
 | 
				
			||||||
 | 
					 *                            acquired
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Nothing
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define with_furi_hal_i2c(type, pointer, function_body)        \
 | 
					#define with_furi_hal_i2c(type, pointer, function_body)        \
 | 
				
			||||||
    {                                                         \
 | 
					    {                                                         \
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-ibutton.h
 | 
				
			||||||
 | 
					 * iButton HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-irda.h
 | 
				
			||||||
 | 
					 * IRDA HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
@ -11,122 +17,120 @@ extern "C" {
 | 
				
			|||||||
#define IRDA_MIN_FREQUENCY      10000
 | 
					#define IRDA_MIN_FREQUENCY      10000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    FuriHalIrdaTxGetDataStateOk,         /* New data obtained */
 | 
					    FuriHalIrdaTxGetDataStateOk,         /**< New data obtained */
 | 
				
			||||||
    FuriHalIrdaTxGetDataStateDone,       /* New data obtained, and this is end of package */
 | 
					    FuriHalIrdaTxGetDataStateDone,       /**< New data obtained, and this is end of package */
 | 
				
			||||||
    FuriHalIrdaTxGetDataStateLastDone,   /* New data obtained, and this is end of package and no more data available */
 | 
					    FuriHalIrdaTxGetDataStateLastDone,   /**< New data obtained, and this is end of package and no more data available */
 | 
				
			||||||
} FuriHalIrdaTxGetDataState;
 | 
					} FuriHalIrdaTxGetDataState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Callback type for providing data to IRDA DMA TX system. It is called every tim */
 | 
					/** Callback type for providing data to IRDA DMA TX system. It is called every tim */
 | 
				
			||||||
typedef FuriHalIrdaTxGetDataState (*FuriHalIrdaTxGetDataISRCallback) (void* context, uint32_t* duration, bool* level);
 | 
					typedef FuriHalIrdaTxGetDataState (*FuriHalIrdaTxGetDataISRCallback) (void* context, uint32_t* duration, bool* level);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Callback type called every time signal is sent by DMA to Timer.
 | 
					/** Callback type called every time signal is sent by DMA to Timer.
 | 
				
			||||||
 * Actually, it means there are 2 timings left to send for this signal, which is almost end.
 | 
					 *
 | 
				
			||||||
 * Don't use this callback to stop transmission, as far as there are next signal is
 | 
					 * Actually, it means there are 2 timings left to send for this signal, which is
 | 
				
			||||||
 * charged for transmission by DMA.
 | 
					 * almost end. Don't use this callback to stop transmission, as far as there are
 | 
				
			||||||
 | 
					 * next signal is charged for transmission by DMA.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*FuriHalIrdaTxSignalSentISRCallback) (void* context);
 | 
					typedef void (*FuriHalIrdaTxSignalSentISRCallback) (void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Signature of callback function for receiving continuous IRDA rx signal.
 | 
				
			||||||
 * Signature of callback function for receiving continuous IRDA rx signal.
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   ctx[in] - context to pass to callback
 | 
					 * @param      ctx[in]       context to pass to callback
 | 
				
			||||||
 * @param   level[in] - level of input IRDA rx signal
 | 
					 * @param      level[in]     level of input IRDA rx signal
 | 
				
			||||||
 * @param   duration[in] - duration of continuous rx signal level in us
 | 
					 * @param      duration[in]  duration of continuous rx signal level in us
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*FuriHalIrdaRxCaptureCallback)(void* ctx, bool level, uint32_t duration);
 | 
					typedef void (*FuriHalIrdaRxCaptureCallback)(void* ctx, bool level, uint32_t duration);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Signature of callback function for reaching silence timeout on IRDA port.
 | 
				
			||||||
 * Signature of callback function for reaching silence timeout on IRDA port.
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param   ctx[in] - context to pass to callback
 | 
					 * @param      ctx[in]  context to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*FuriHalIrdaRxTimeoutCallback)(void* ctx);
 | 
					typedef void (*FuriHalIrdaRxTimeoutCallback)(void* ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Initialize IRDA RX timer to receive interrupts.
 | 
				
			||||||
 * Initialize IRDA RX timer to receive interrupts.
 | 
					 *
 | 
				
			||||||
 * It provides interrupts for every RX-signal edge changing
 | 
					 * It provides interrupts for every RX-signal edge changing with its duration.
 | 
				
			||||||
 * with its duration.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_rx_start(void);
 | 
					void furi_hal_irda_async_rx_start(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Deinitialize IRDA RX interrupt.
 | 
				
			||||||
 * Deinitialize IRDA RX interrupt.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_rx_stop(void);
 | 
					void furi_hal_irda_async_rx_stop(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Setup hal for receiving silence timeout.
 | 
					/** Setup hal for receiving silence timeout.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Should be used with 'furi_hal_irda_timeout_irq_set_callback()'.
 | 
					 * Should be used with 'furi_hal_irda_timeout_irq_set_callback()'.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in]   timeout_us - time to wait for silence on IRDA port
 | 
					 * @param[in]  timeout_us  time to wait for silence on IRDA port before
 | 
				
			||||||
 *                           before generating IRQ.
 | 
					 *                         generating IRQ.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_rx_set_timeout(uint32_t timeout_us);
 | 
					void furi_hal_irda_async_rx_set_timeout(uint32_t timeout_us);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Setup callback for previously initialized IRDA RX interrupt.
 | 
					/** Setup callback for previously initialized IRDA RX interrupt.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in]   callback - callback to call when RX signal edge changing occurs
 | 
					 * @param[in]  callback  callback to call when RX signal edge changing occurs
 | 
				
			||||||
 * @param[in]   ctx - context for callback
 | 
					 * @param[in]  ctx       context for callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_rx_set_capture_isr_callback(FuriHalIrdaRxCaptureCallback callback, void *ctx);
 | 
					void furi_hal_irda_async_rx_set_capture_isr_callback(FuriHalIrdaRxCaptureCallback callback, void *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Setup callback for reaching silence timeout on IRDA port.
 | 
				
			||||||
 * Setup callback for reaching silence timeout on IRDA port.
 | 
					 *
 | 
				
			||||||
 * Should setup hal with 'furi_hal_irda_setup_rx_timeout_irq()' first.
 | 
					 * Should setup hal with 'furi_hal_irda_setup_rx_timeout_irq()' first.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in]   callback - callback for silence timeout
 | 
					 * @param[in]  callback  callback for silence timeout
 | 
				
			||||||
 * @param[in]   ctx - context to pass to callback
 | 
					 * @param[in]  ctx       context to pass to callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_rx_set_timeout_isr_callback(FuriHalIrdaRxTimeoutCallback callback, void *ctx);
 | 
					void furi_hal_irda_async_rx_set_timeout_isr_callback(FuriHalIrdaRxTimeoutCallback callback, void *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Check if IRDA is in use now.
 | 
				
			||||||
 * Check if IRDA is in use now.
 | 
					 *
 | 
				
			||||||
 * @return  true - IRDA is busy, false otherwise.
 | 
					 * @return     true if IRDA is busy, false otherwise.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_irda_is_busy(void);
 | 
					bool furi_hal_irda_is_busy(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set callback providing new data.
 | 
				
			||||||
 * Set callback providing new data. This function has to be called
 | 
					 | 
				
			||||||
 * before furi_hal_irda_async_tx_start().
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in]   callback - function to provide new data
 | 
					 * This function has to be called before furi_hal_irda_async_tx_start().
 | 
				
			||||||
 * @param[in]   context - context for callback
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  callback  function to provide new data
 | 
				
			||||||
 | 
					 * @param[in]  context   context for callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_tx_set_data_isr_callback(FuriHalIrdaTxGetDataISRCallback callback, void* context);
 | 
					void furi_hal_irda_async_tx_set_data_isr_callback(FuriHalIrdaTxGetDataISRCallback callback, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Start IR asynchronous transmission.
 | 
				
			||||||
 * Start IR asynchronous transmission. It can be stopped by 2 reasons:
 | 
					 *
 | 
				
			||||||
 * 1) implicit call for furi_hal_irda_async_tx_stop()
 | 
					 * It can be stopped by 2 reasons:
 | 
				
			||||||
 * 2) callback can provide FuriHalIrdaTxGetDataStateLastDone response
 | 
					 * 1. implicit call for furi_hal_irda_async_tx_stop()
 | 
				
			||||||
 *      which means no more data available for transmission.
 | 
					 * 2. callback can provide FuriHalIrdaTxGetDataStateLastDone response which
 | 
				
			||||||
 | 
					 *    means no more data available for transmission.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Any func (furi_hal_irda_async_tx_stop() or
 | 
					 * Any func (furi_hal_irda_async_tx_stop() or
 | 
				
			||||||
 * furi_hal_irda_async_tx_wait_termination()) has to be called to wait
 | 
					 * furi_hal_irda_async_tx_wait_termination()) has to be called to wait end of
 | 
				
			||||||
 * end of transmission and free resources.
 | 
					 * transmission and free resources.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in]   freq - frequency for PWM
 | 
					 * @param[in]  freq        frequency for PWM
 | 
				
			||||||
 * @param[in]   duty_cycle - duty cycle for PWM
 | 
					 * @param[in]  duty_cycle  duty cycle for PWM
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_tx_start(uint32_t freq, float duty_cycle);
 | 
					void furi_hal_irda_async_tx_start(uint32_t freq, float duty_cycle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Stop IR asynchronous transmission and free resources.
 | 
				
			||||||
 * Stop IR asynchronous transmission and free resources.
 | 
					 *
 | 
				
			||||||
 * Transmission will stop as soon as transmission reaches end of
 | 
					 * Transmission will stop as soon as transmission reaches end of package
 | 
				
			||||||
 * package (FuriHalIrdaTxGetDataStateDone or FuriHalIrdaTxGetDataStateLastDone).
 | 
					 * (FuriHalIrdaTxGetDataStateDone or FuriHalIrdaTxGetDataStateLastDone).
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_tx_stop(void);
 | 
					void furi_hal_irda_async_tx_stop(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Wait for end of IR asynchronous transmission and free resources.
 | 
				
			||||||
 * Wait for end of IR asynchronous transmission and free resources.
 | 
					 *
 | 
				
			||||||
 * Transmission will stop as soon as transmission reaches end of
 | 
					 * Transmission will stop as soon as transmission reaches end of transmission
 | 
				
			||||||
 * transmission (FuriHalIrdaTxGetDataStateLastDone).
 | 
					 * (FuriHalIrdaTxGetDataStateLastDone).
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_tx_wait_termination(void);
 | 
					void furi_hal_irda_async_tx_wait_termination(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set callback for end of signal transmission
 | 
				
			||||||
 * Set callback for end of signal transmission
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in]   callback - function to call when signal is sent
 | 
					 * @param[in]  callback  function to call when signal is sent
 | 
				
			||||||
 * @param[in]   context - context for callback
 | 
					 * @param[in]  context   context for callback
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_irda_async_tx_set_signal_sent_isr_callback(FuriHalIrdaTxSignalSentISRCallback callback, void* context);
 | 
					void furi_hal_irda_async_tx_set_signal_sent_isr_callback(FuriHalIrdaTxSignalSentISRCallback callback, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-light.h
 | 
				
			||||||
 | 
					 * Light control HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -8,13 +13,14 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Init light driver */
 | 
					/** Init light driver
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_light_init();
 | 
					void furi_hal_light_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set light value
 | 
				
			||||||
 * Set light value
 | 
					 *
 | 
				
			||||||
 * @param light - Light
 | 
					 * @param      light  Light
 | 
				
			||||||
 * @param value - light brightness [0-255]
 | 
					 * @param      value  light brightness [0-255]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_light_set(Light light, uint8_t value);
 | 
					void furi_hal_light_set(Light light, uint8_t value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-nfc.h
 | 
				
			||||||
 | 
					 * NFC HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <rfal_nfc.h>
 | 
					#include <rfal_nfc.h>
 | 
				
			||||||
@ -11,58 +16,78 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define FURI_HAL_NFC_UID_MAX_LEN 10
 | 
					#define FURI_HAL_NFC_UID_MAX_LEN 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Init nfc
 | 
				
			||||||
 * Init nfc
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_nfc_init();
 | 
					void furi_hal_nfc_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Check if nfc worker is busy
 | 
				
			||||||
 * Check if nfc worker is busy
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if busy
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_nfc_is_busy();
 | 
					bool furi_hal_nfc_is_busy();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC field on
 | 
				
			||||||
 * NFC field on
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_nfc_field_on();
 | 
					void furi_hal_nfc_field_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC field off
 | 
				
			||||||
 * NFC field off
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_nfc_field_off();
 | 
					void furi_hal_nfc_field_off();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC start sleep
 | 
				
			||||||
 * NFC start sleep
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_nfc_start_sleep();
 | 
					void furi_hal_nfc_start_sleep();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC stop sleep
 | 
				
			||||||
 * NFC stop sleep
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_nfc_exit_sleep();
 | 
					void furi_hal_nfc_exit_sleep();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC poll
 | 
				
			||||||
 * NFC poll
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      dev_list    pointer to rfalNfcDevice buffer
 | 
				
			||||||
 | 
					 * @param      dev_cnt     pointer device count
 | 
				
			||||||
 | 
					 * @param      timeout     timeout in ms
 | 
				
			||||||
 | 
					 * @param      deactivate  deactivate flag
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_nfc_detect(rfalNfcDevice** dev_list, uint8_t* dev_cnt, uint32_t timeout, bool deactivate);
 | 
					bool furi_hal_nfc_detect(rfalNfcDevice** dev_list, uint8_t* dev_cnt, uint32_t timeout, bool deactivate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC listen
 | 
				
			||||||
 * NFC listen
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      uid                 pointer to uid buffer
 | 
				
			||||||
 | 
					 * @param      uid_len             uid length
 | 
				
			||||||
 | 
					 * @param      atqa                pointer to atqa
 | 
				
			||||||
 | 
					 * @param      sak                 sak
 | 
				
			||||||
 | 
					 * @param      activate_after_sak  activate after sak flag
 | 
				
			||||||
 | 
					 * @param      timeout             timeout in ms
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_nfc_listen(uint8_t* uid, uint8_t uid_len, uint8_t* atqa, uint8_t sak, bool activate_after_sak, uint32_t timeout);
 | 
					bool furi_hal_nfc_listen(uint8_t* uid, uint8_t uid_len, uint8_t* atqa, uint8_t sak, bool activate_after_sak, uint32_t timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get first command from reader after activation in emulation mode
 | 
				
			||||||
 * Get first command from reader after activation in emulation mode
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      rx_buff  pointer to receive buffer
 | 
				
			||||||
 | 
					 * @param      rx_len   receive buffer length
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true on success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_nfc_get_first_frame(uint8_t** rx_buff, uint16_t** rx_len);
 | 
					bool furi_hal_nfc_get_first_frame(uint8_t** rx_buff, uint16_t** rx_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC data exchange
 | 
				
			||||||
 * NFC data exchange
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      tx_buff     transmit buffer
 | 
				
			||||||
 | 
					 * @param      tx_len      transmit buffer length
 | 
				
			||||||
 | 
					 * @param      rx_buff     receive buffer
 | 
				
			||||||
 | 
					 * @param      rx_len      receive buffer length
 | 
				
			||||||
 | 
					 * @param      deactivate  deactivate flag
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     ST ReturnCode
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
ReturnCode furi_hal_nfc_data_exchange(uint8_t* tx_buff, uint16_t tx_len, uint8_t** rx_buff, uint16_t** rx_len, bool deactivate);
 | 
					ReturnCode furi_hal_nfc_data_exchange(uint8_t* tx_buff, uint16_t tx_len, uint8_t** rx_buff, uint16_t** rx_len, bool deactivate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** NFC deactivate and start sleep
 | 
				
			||||||
 * NFC deactivate and start sleep
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_nfc_deactivate();
 | 
					void furi_hal_nfc_deactivate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-power.h
 | 
				
			||||||
 | 
					 * Power HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
@ -14,92 +19,142 @@ typedef enum {
 | 
				
			|||||||
    FuriHalPowerICFuelGauge,
 | 
					    FuriHalPowerICFuelGauge,
 | 
				
			||||||
} FuriHalPowerIC;
 | 
					} FuriHalPowerIC;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize drivers */
 | 
					/** Initialize drivers
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_init();
 | 
					void furi_hal_power_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get current insomnia level
 | 
				
			||||||
 * Get current insomnia level
 | 
					 *
 | 
				
			||||||
 * @return insomnia level: 0 - no insomnia, >0 - insomnia, bearer count.
 | 
					 * @return     insomnia level: 0 - no insomnia, >0 - insomnia, bearer count.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint16_t furi_hal_power_insomnia_level();
 | 
					uint16_t furi_hal_power_insomnia_level();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Enter insomnia mode Prevents device from going to sleep
 | 
				
			||||||
 * Enter insomnia mode
 | 
					 * @warning    Internally increases insomnia level Must be paired with
 | 
				
			||||||
 * Prevents device from going to sleep
 | 
					 *             furi_hal_power_insomnia_exit
 | 
				
			||||||
 * @warning Internally increases insomnia level
 | 
					 | 
				
			||||||
 * Must be paired with furi_hal_power_insomnia_exit
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_power_insomnia_enter();
 | 
					void furi_hal_power_insomnia_enter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Exit insomnia mode Allow device to go to sleep
 | 
				
			||||||
 * Exit insomnia mode
 | 
					 * @warning    Internally decreases insomnia level. Must be paired with
 | 
				
			||||||
 * Allow device to go to sleep
 | 
					 *             furi_hal_power_insomnia_enter
 | 
				
			||||||
 * @warning Internally decreases insomnia level.
 | 
					 | 
				
			||||||
 * Must be paired with furi_hal_power_insomnia_enter
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_power_insomnia_exit();
 | 
					void furi_hal_power_insomnia_exit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Check if sleep availble */
 | 
					/** Check if sleep availble
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if available
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_power_sleep_available();
 | 
					bool furi_hal_power_sleep_available();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Check if deep sleep availble */
 | 
					/** Check if deep sleep availble
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if available
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_power_deep_sleep_available();
 | 
					bool furi_hal_power_deep_sleep_available();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Go to sleep */
 | 
					/** Go to sleep
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_sleep();
 | 
					void furi_hal_power_sleep();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get predicted remaining battery capacity in percents */
 | 
					/** Get predicted remaining battery capacity in percents
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     remaining battery capacity in percents
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint8_t furi_hal_power_get_pct();
 | 
					uint8_t furi_hal_power_get_pct();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get battery health state in percents */
 | 
					/** Get battery health state in percents
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     health in percents
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint8_t furi_hal_power_get_bat_health_pct();
 | 
					uint8_t furi_hal_power_get_bat_health_pct();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get charging status */
 | 
					/** Get charging status
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if charging
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_power_is_charging();
 | 
					bool furi_hal_power_is_charging();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Poweroff device */
 | 
					/** Poweroff device
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_off();
 | 
					void furi_hal_power_off();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Reset device */
 | 
					/** Reset device
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_reset();
 | 
					void furi_hal_power_reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** OTG enable */
 | 
					/** OTG enable
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_enable_otg();
 | 
					void furi_hal_power_enable_otg();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** OTG disable */
 | 
					/** OTG disable
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_disable_otg();
 | 
					void furi_hal_power_disable_otg();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get OTG status */
 | 
					/** Get OTG status
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if enabled
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_power_is_otg_enabled();
 | 
					bool furi_hal_power_is_otg_enabled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get remaining battery battery capacity in mAh */
 | 
					/** Get remaining battery battery capacity in mAh
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     capacity in mAh
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint32_t furi_hal_power_get_battery_remaining_capacity();
 | 
					uint32_t furi_hal_power_get_battery_remaining_capacity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get full charge battery capacity in mAh */
 | 
					/** Get full charge battery capacity in mAh
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     capacity in mAh
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
uint32_t furi_hal_power_get_battery_full_capacity();
 | 
					uint32_t furi_hal_power_get_battery_full_capacity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get battery voltage in V */
 | 
					/** Get battery voltage in V
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      ic    FuriHalPowerIc to get measurment
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     voltage in V
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_power_get_battery_voltage(FuriHalPowerIC ic);
 | 
					float furi_hal_power_get_battery_voltage(FuriHalPowerIC ic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get battery current in A */
 | 
					/** Get battery current in A
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      ic    FuriHalPowerIc to get measurment
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     current in A
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_power_get_battery_current(FuriHalPowerIC ic);
 | 
					float furi_hal_power_get_battery_current(FuriHalPowerIC ic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get temperature in C */
 | 
					/** Get temperature in C
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      ic    FuriHalPowerIc to get measurment
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     temperature in C
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_power_get_battery_temperature(FuriHalPowerIC ic);
 | 
					float furi_hal_power_get_battery_temperature(FuriHalPowerIC ic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get System voltage in V */
 | 
					/** Get System voltage in V
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     voltage in V
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_power_get_system_voltage();
 | 
					float furi_hal_power_get_system_voltage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get USB voltage in V */
 | 
					/** Get USB voltage in V
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     voltage in V
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_power_get_usb_voltage();
 | 
					float furi_hal_power_get_usb_voltage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get power system component state */
 | 
					/** Get power system component state
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_dump_state();
 | 
					void furi_hal_power_dump_state();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Enable 3.3v on external gpio and sd card */
 | 
					/** Enable 3.3v on external gpio and sd card
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_enable_external_3_3v();
 | 
					void furi_hal_power_enable_external_3_3v();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Disable 3.3v on external gpio and sd card */
 | 
					/** Disable 3.3v on external gpio and sd card
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_power_disable_external_3_3v();
 | 
					void furi_hal_power_disable_external_3_3v();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,10 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-rfid.h
 | 
				
			||||||
 | 
					 * RFID HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <main.h>
 | 
					#include <main.h>
 | 
				
			||||||
@ -7,111 +13,91 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize RFID subsystem */
 | 
					/** Initialize RFID subsystem
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_init();
 | 
					void furi_hal_rfid_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Config rfid pins to reset state
 | 
				
			||||||
 * @brief config rfid pins to reset state
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_pins_reset();
 | 
					void furi_hal_rfid_pins_reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Config rfid pins to emulate state
 | 
				
			||||||
 * @brief config rfid pins to emulate state
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_pins_emulate();
 | 
					void furi_hal_rfid_pins_emulate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Config rfid pins to read state
 | 
				
			||||||
 * @brief config rfid pins to read state
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_pins_read();
 | 
					void furi_hal_rfid_pins_read();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Config rfid timer to read state
 | 
				
			||||||
 * @brief config rfid timer to read state
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      freq        timer frequency
 | 
				
			||||||
 * @param freq timer frequency
 | 
					 * @param      duty_cycle  timer duty cycle, 0.0-1.0
 | 
				
			||||||
 * @param duty_cycle timer duty cycle, 0.0-1.0
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_read(float freq, float duty_cycle);
 | 
					void furi_hal_rfid_tim_read(float freq, float duty_cycle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Start read timer
 | 
				
			||||||
 * @brief start read timer
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_read_start();
 | 
					void furi_hal_rfid_tim_read_start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Stop read timer
 | 
				
			||||||
 * @brief stop read timer
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_read_stop();
 | 
					void furi_hal_rfid_tim_read_stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Config rfid timer to emulate state
 | 
				
			||||||
 * @brief config rfid timer to emulate state
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      freq  timer frequency
 | 
				
			||||||
 * @param freq timer frequency
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_emulate(float freq);
 | 
					void furi_hal_rfid_tim_emulate(float freq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Start emulation timer
 | 
				
			||||||
 * @brief start emulation timer
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_emulate_start();
 | 
					void furi_hal_rfid_tim_emulate_start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Stop emulation timer
 | 
				
			||||||
 * @brief stop emulation timer
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_emulate_stop();
 | 
					void furi_hal_rfid_tim_emulate_stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Config rfid timers to reset state
 | 
				
			||||||
 * @brief config rfid timers to reset state
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_tim_reset();
 | 
					void furi_hal_rfid_tim_reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Check that timer instance is emulation timer
 | 
				
			||||||
 * @brief check that timer instance is emulation timer
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      hw    timer instance
 | 
				
			||||||
 * @param hw timer instance
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if instance is emulation timer
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_rfid_is_tim_emulate(TIM_HandleTypeDef* hw);
 | 
					bool furi_hal_rfid_is_tim_emulate(TIM_HandleTypeDef* hw);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set emulation timer period
 | 
				
			||||||
 * @brief set emulation timer period
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      period  overall duration
 | 
				
			||||||
 * @param period overall duration
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_set_emulate_period(uint32_t period);
 | 
					void furi_hal_rfid_set_emulate_period(uint32_t period);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set emulation timer pulse
 | 
				
			||||||
 * @brief set emulation timer pulse
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      pulse  duration of high level
 | 
				
			||||||
 * @param pulse duration of high level
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_set_emulate_pulse(uint32_t pulse);
 | 
					void furi_hal_rfid_set_emulate_pulse(uint32_t pulse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set read timer period
 | 
				
			||||||
 * @brief set read timer period
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      period  overall duration
 | 
				
			||||||
 * @param period overall duration
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_set_read_period(uint32_t period);
 | 
					void furi_hal_rfid_set_read_period(uint32_t period);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Set read timer pulse
 | 
				
			||||||
 * @brief set read timer pulse
 | 
					 *
 | 
				
			||||||
 * 
 | 
					 * @param      pulse  duration of high level
 | 
				
			||||||
 * @param pulse duration of high level
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_set_read_pulse(uint32_t pulse);
 | 
					void furi_hal_rfid_set_read_pulse(uint32_t pulse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Сhanges the configuration of the RFID timer "on a fly"
 | 
				
			||||||
 * Сhanges the configuration of the RFID timer "on a fly"
 | 
					 *
 | 
				
			||||||
 * @param freq new frequency
 | 
					 * @param      freq        new frequency
 | 
				
			||||||
 * @param duty_cycle new duty cycle
 | 
					 * @param      duty_cycle  new duty cycle
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_rfid_change_read_config(float freq, float duty_cycle);
 | 
					void furi_hal_rfid_change_read_config(float freq, float duty_cycle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-sd.h
 | 
				
			||||||
 | 
					 * SD Card HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -5,19 +10,20 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Init SD card detect */
 | 
					/** Init SD card detect
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void hal_sd_detect_init(void);
 | 
					void hal_sd_detect_init(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set SD card detect pin to low */
 | 
					/** Set SD card detect pin to low
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void hal_sd_detect_set_low(void);
 | 
					void hal_sd_detect_set_low(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get SD card status
 | 
				
			||||||
 * Get SD card status
 | 
					 *
 | 
				
			||||||
 * @return true if SD card present
 | 
					 * @return     true if SD card present, false if SD card not present
 | 
				
			||||||
 * @return false if SD card not present
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool hal_sd_detect(void);
 | 
					bool hal_sd_detect(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-subghz.h
 | 
				
			||||||
 | 
					 * SubGhz HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -11,130 +16,148 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** Radio Presets */
 | 
					/** Radio Presets */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    FuriHalSubGhzPresetOok270Async,     /** OOK, bandwidth 270kHz, asynchronous */
 | 
					    FuriHalSubGhzPresetOok270Async,     /**< OOK, bandwidth 270kHz, asynchronous */
 | 
				
			||||||
    FuriHalSubGhzPresetOok650Async,     /** OOK, bandwidth 650kHz, asynchronous */
 | 
					    FuriHalSubGhzPresetOok650Async,     /**< OOK, bandwidth 650kHz, asynchronous */
 | 
				
			||||||
    FuriHalSubGhzPreset2FSKAsync,       /** FM, asynchronous */
 | 
					    FuriHalSubGhzPreset2FSKAsync,       /**< FM, asynchronous */
 | 
				
			||||||
} FuriHalSubGhzPreset;
 | 
					} FuriHalSubGhzPreset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**  Switchable Radio Paths */
 | 
					/** Switchable Radio Paths */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    FuriHalSubGhzPathIsolate,        /** Isolate Radio from antenna */
 | 
					    FuriHalSubGhzPathIsolate,        /**< Isolate Radio from antenna */
 | 
				
			||||||
    FuriHalSubGhzPath433,            /** Center Frquency: 433MHz. Path 1: SW1RF1-SW2RF2, LCLCL */
 | 
					    FuriHalSubGhzPath433,            /**< Center Frquency: 433MHz. Path 1: SW1RF1-SW2RF2, LCLCL */
 | 
				
			||||||
    FuriHalSubGhzPath315,            /** Center Frquency: 315MHz. Path 2: SW1RF2-SW2RF1, LCLCLCL */
 | 
					    FuriHalSubGhzPath315,            /**< Center Frquency: 315MHz. Path 2: SW1RF2-SW2RF1, LCLCLCL */
 | 
				
			||||||
    FuriHalSubGhzPath868,            /** Center Frquency: 868MHz. Path 3: SW1RF3-SW2RF3, LCLC */
 | 
					    FuriHalSubGhzPath868,            /**< Center Frquency: 868MHz. Path 3: SW1RF3-SW2RF3, LCLC */
 | 
				
			||||||
} FuriHalSubGhzPath;
 | 
					} FuriHalSubGhzPath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** SubGhz state */
 | 
					/** SubGhz state */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    SubGhzStateInit,                /** Init pending */
 | 
					    SubGhzStateInit,                /**< Init pending */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SubGhzStateIdle,                /** Idle, energy save mode */
 | 
					    SubGhzStateIdle,                /**< Idle, energy save mode */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SubGhzStateAsyncRx,             /** Async RX started */
 | 
					    SubGhzStateAsyncRx,             /**< Async RX started */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SubGhzStateAsyncTx,             /** Async TX started, DMA and timer is on */
 | 
					    SubGhzStateAsyncTx,             /**< Async TX started, DMA and timer is on */
 | 
				
			||||||
    SubGhzStateAsyncTxLast,         /** Async TX continue, DMA completed and timer got last value to go */
 | 
					    SubGhzStateAsyncTxLast,         /**< Async TX continue, DMA completed and timer got last value to go */
 | 
				
			||||||
    SubGhzStateAsyncTxEnd,          /** Async TX complete, cleanup needed */
 | 
					    SubGhzStateAsyncTxEnd,          /**< Async TX complete, cleanup needed */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} SubGhzState;
 | 
					} SubGhzState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** SubGhz regulation, receive transmission on the current frequency for the region */
 | 
					/** SubGhz regulation, receive transmission on the current frequency for the
 | 
				
			||||||
 | 
					 * region */
 | 
				
			||||||
typedef enum {
 | 
					typedef enum {
 | 
				
			||||||
    SubGhzRegulationOnlyRx, /**only Rx*/
 | 
					    SubGhzRegulationOnlyRx, /**only Rx*/
 | 
				
			||||||
    SubGhzRegulationTxRx, /**TxRx*/
 | 
					    SubGhzRegulationTxRx, /**TxRx*/
 | 
				
			||||||
} SubGhzRegulation;
 | 
					} SubGhzRegulation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize and switch to power save mode
 | 
					/** Initialize and switch to power save mode Used by internal API-HAL
 | 
				
			||||||
 * Used by internal API-HAL initalization routine
 | 
					 * initalization routine Can be used to reinitialize device to safe state and
 | 
				
			||||||
 * Can be used to reinitialize device to safe state and send it to sleep
 | 
					 * send it to sleep
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_init();
 | 
					void furi_hal_subghz_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Send device to sleep mode */
 | 
					/** Send device to sleep mode
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_sleep();
 | 
					void furi_hal_subghz_sleep();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Dump info to stdout */
 | 
					/** Dump info to stdout
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_dump_state();
 | 
					void furi_hal_subghz_dump_state();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Load registers from preset by preset name 
 | 
					/** Load registers from preset by preset name
 | 
				
			||||||
 * @param preset to load
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      preset  to load
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset);
 | 
					void furi_hal_subghz_load_preset(FuriHalSubGhzPreset preset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get status */
 | 
					 | 
				
			||||||
uint8_t furi_hal_subghz_get_status();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** Load registers
 | 
					/** Load registers
 | 
				
			||||||
 * @param register-value pairs array, terminated with {0,0}
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      data  Registers data
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_load_registers(const uint8_t data[][2]);
 | 
					void furi_hal_subghz_load_registers(const uint8_t data[][2]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Load PATABLE
 | 
					/** Load PATABLE
 | 
				
			||||||
 * @param data, 8 uint8_t values
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      data  8 uint8_t values
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_load_patable(const uint8_t data[8]);
 | 
					void furi_hal_subghz_load_patable(const uint8_t data[8]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Write packet to FIFO
 | 
					/** Write packet to FIFO
 | 
				
			||||||
 * @param data, bytes array
 | 
					 *
 | 
				
			||||||
 * @param size, size
 | 
					 * @param      data  bytes array
 | 
				
			||||||
 | 
					 * @param      size  size
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size);
 | 
					void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Read packet from FIFO
 | 
					/** Read packet from FIFO
 | 
				
			||||||
 * @param data, pointer
 | 
					 *
 | 
				
			||||||
 * @param size, size
 | 
					 * @param      data  pointer
 | 
				
			||||||
 | 
					 * @param      size  size
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_read_packet(uint8_t* data, uint8_t* size);
 | 
					void furi_hal_subghz_read_packet(uint8_t* data, uint8_t* size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Flush rx FIFO buffer */
 | 
					/** Flush rx FIFO buffer
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_flush_rx();
 | 
					void furi_hal_subghz_flush_rx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Shutdown
 | 
					/** Shutdown Issue spwd command
 | 
				
			||||||
 * Issue spwd command
 | 
					 * @warning    registers content will be lost
 | 
				
			||||||
 * @warning registers content will be lost
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_shutdown();
 | 
					void furi_hal_subghz_shutdown();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Reset
 | 
					/** Reset Issue reset command
 | 
				
			||||||
 * Issue reset command
 | 
					 * @warning    registers content will be lost
 | 
				
			||||||
 * @warning registers content will be lost
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_reset();
 | 
					void furi_hal_subghz_reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Switch to Idle */
 | 
					/** Switch to Idle
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_idle();
 | 
					void furi_hal_subghz_idle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Switch to Recieve */
 | 
					/** Switch to Recieve
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_rx();
 | 
					void furi_hal_subghz_rx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Switch to Transmit
 | 
					/** Switch to Transmit
 | 
				
			||||||
* @return true if the transfer is allowed by belonging to the region
 | 
					 *
 | 
				
			||||||
*/
 | 
					 * @return     true if the transfer is allowed by belonging to the region
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_subghz_tx();
 | 
					bool furi_hal_subghz_tx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get RSSI value in dBm */
 | 
					/** Get RSSI value in dBm
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     RSSI value
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
float furi_hal_subghz_get_rssi();
 | 
					float furi_hal_subghz_get_rssi();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Check if frequency is in valid range
 | 
					/** Check if frequency is in valid range
 | 
				
			||||||
 * @return true if frequncy is valid, otherwise false
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      value  frequency in Hz
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if frequncy is valid, otherwise false
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_subghz_is_frequency_valid(uint32_t value);
 | 
					bool furi_hal_subghz_is_frequency_valid(uint32_t value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set frequency and path
 | 
					/** Set frequency and path This function automatically selects antenna matching
 | 
				
			||||||
 * This function automatically selects antenna matching network
 | 
					 * network
 | 
				
			||||||
 * @param frequency in herz
 | 
					 *
 | 
				
			||||||
 * @return real frequency in herz
 | 
					 * @param      value  frequency in Hz
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     real frequency in herz
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value);
 | 
					uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set frequency
 | 
					/** Set frequency
 | 
				
			||||||
 * @param frequency in herz
 | 
					 *
 | 
				
			||||||
 * @return real frequency in herz
 | 
					 * @param      value  frequency in Hz
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     real frequency in herz
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint32_t furi_hal_subghz_set_frequency(uint32_t value);
 | 
					uint32_t furi_hal_subghz_set_frequency(uint32_t value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Set path
 | 
					/** Set path
 | 
				
			||||||
 * @param radio path to use
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      path  path to use
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_set_path(FuriHalSubGhzPath path);
 | 
					void furi_hal_subghz_set_path(FuriHalSubGhzPath path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -143,33 +166,39 @@ void furi_hal_subghz_set_path(FuriHalSubGhzPath path);
 | 
				
			|||||||
/** Signal Timings Capture callback */
 | 
					/** Signal Timings Capture callback */
 | 
				
			||||||
typedef void (*FuriHalSubGhzCaptureCallback)(bool level, uint32_t duration, void* context);
 | 
					typedef void (*FuriHalSubGhzCaptureCallback)(bool level, uint32_t duration, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Enable signal timings capture 
 | 
					/** Enable signal timings capture Initializes GPIO and TIM2 for timings capture
 | 
				
			||||||
 * Initializes GPIO and TIM2 for timings capture
 | 
					 *
 | 
				
			||||||
 | 
					 * @param      callback  FuriHalSubGhzCaptureCallback
 | 
				
			||||||
 | 
					 * @param      context   callback context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void* context);
 | 
					void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Disable signal timings capture
 | 
					/** Disable signal timings capture Resets GPIO and TIM2
 | 
				
			||||||
 * Resets GPIO and TIM2
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_stop_async_rx();
 | 
					void furi_hal_subghz_stop_async_rx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Async TX callback type
 | 
					/** Async TX callback type
 | 
				
			||||||
 * @param context - callback context
 | 
					 * @param      context  callback context
 | 
				
			||||||
 * @return LevelDuration
 | 
					 * @return     LevelDuration
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef LevelDuration (*FuriHalSubGhzAsyncTxCallback)(void* context);
 | 
					typedef LevelDuration (*FuriHalSubGhzAsyncTxCallback)(void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Start async TX
 | 
					/** Start async TX Initializes GPIO, TIM2 and DMA1 for signal output
 | 
				
			||||||
 * Initializes GPIO, TIM2 and DMA1 for signal output
 | 
					 *
 | 
				
			||||||
 * @return true if the transfer is allowed by belonging to the region
 | 
					 * @param      callback  FuriHalSubGhzAsyncTxCallback
 | 
				
			||||||
 | 
					 * @param      context   callback context
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if the transfer is allowed by belonging to the region
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* context);
 | 
					bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Wait for async transmission to complete */
 | 
					/** Wait for async transmission to complete
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if TX complete
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_subghz_is_async_tx_complete();
 | 
					bool furi_hal_subghz_is_async_tx_complete();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Stop async transmission and cleanup resources
 | 
					/** Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1
 | 
				
			||||||
 * Resets GPIO, TIM2, and DMA1
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_subghz_stop_async_tx();
 | 
					void furi_hal_subghz_stop_async_tx();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-vcp.h
 | 
				
			||||||
 | 
					 * VCP HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -8,35 +13,34 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Init VCP HAL Allocates ring buffer and initializes state
 | 
				
			||||||
 * Init VCP HAL
 | 
					 | 
				
			||||||
 * Allocates ring buffer and initializes state
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_vcp_init();
 | 
					void furi_hal_vcp_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Recieve data from VCP Waits till some data arrives, never returns 0
 | 
				
			||||||
 * Recieve data from VCP
 | 
					 *
 | 
				
			||||||
 * Waits till some data arrives, never returns 0
 | 
					 * @param      buffer  pointer to buffer
 | 
				
			||||||
 * @param buffer - pointer to buffer
 | 
					 * @param      size    buffer size
 | 
				
			||||||
 * @param size - buffer size
 | 
					 *
 | 
				
			||||||
 * @return items copied in buffer, 0 if channel closed
 | 
					 * @return     items copied in buffer, 0 if channel closed
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_vcp_rx(uint8_t* buffer, size_t size);
 | 
					size_t furi_hal_vcp_rx(uint8_t* buffer, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Recieve data from VCP with timeout Waits till some data arrives during
 | 
				
			||||||
 * Recieve data from VCP with timeout
 | 
					 * timeout
 | 
				
			||||||
 * Waits till some data arrives during timeout
 | 
					 *
 | 
				
			||||||
 * @param buffer - pointer to buffer
 | 
					 * @param      buffer   pointer to buffer
 | 
				
			||||||
 * @param size - buffer size
 | 
					 * @param      size     buffer size
 | 
				
			||||||
 * @param timeout - rx timeout in ms
 | 
					 * @param      timeout  rx timeout in ms
 | 
				
			||||||
 * @return items copied in buffer, 0 if channel closed or timeout occurs
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     items copied in buffer, 0 if channel closed or timeout occurs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
size_t furi_hal_vcp_rx_with_timeout(uint8_t* buffer, size_t size, uint32_t timeout);
 | 
					size_t furi_hal_vcp_rx_with_timeout(uint8_t* buffer, size_t size, uint32_t timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Transmit data to VCP
 | 
				
			||||||
 * Transmit data to VCP
 | 
					 *
 | 
				
			||||||
 * @param buffer - pointer to buffer
 | 
					 * @param      buffer  pointer to buffer
 | 
				
			||||||
 * @param size - buffer size
 | 
					 * @param      size    buffer size
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void furi_hal_vcp_tx(const uint8_t* buffer, size_t size);
 | 
					void furi_hal_vcp_tx(const uint8_t* buffer, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-version.h
 | 
				
			||||||
 | 
					 * Version HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -24,65 +29,110 @@ typedef enum {
 | 
				
			|||||||
    FuriHalVersionRegionJp=0x03,
 | 
					    FuriHalVersionRegionJp=0x03,
 | 
				
			||||||
} FuriHalVersionRegion;
 | 
					} FuriHalVersionRegion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Init flipper version */
 | 
					/** Init flipper version
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_version_init();
 | 
					void furi_hal_version_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Check target firmware version */
 | 
					/** Check target firmware version
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     true if target and real matches
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
bool furi_hal_version_do_i_belong_here();
 | 
					bool furi_hal_version_do_i_belong_here();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get model name */
 | 
					/** Get model name
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     model name C-string
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const char* furi_hal_version_get_model_name();
 | 
					const char* furi_hal_version_get_model_name();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware version */
 | 
					/** Get hardware version
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Version
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t furi_hal_version_get_hw_version();
 | 
					const uint8_t furi_hal_version_get_hw_version();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware target */
 | 
					/** Get hardware target
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Target
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t furi_hal_version_get_hw_target();
 | 
					const uint8_t furi_hal_version_get_hw_target();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware body */
 | 
					/** Get hardware body
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Body
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t furi_hal_version_get_hw_body();
 | 
					const uint8_t furi_hal_version_get_hw_body();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware body color */
 | 
					/** Get hardware body color
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Color
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const FuriHalVersionColor furi_hal_version_get_hw_color();
 | 
					const FuriHalVersionColor furi_hal_version_get_hw_color();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware connect */
 | 
					/** Get hardware connect
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Interconnect
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t furi_hal_version_get_hw_connect();
 | 
					const uint8_t furi_hal_version_get_hw_connect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware region */
 | 
					/** Get hardware region
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Region
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const FuriHalVersionRegion furi_hal_version_get_hw_region();
 | 
					const FuriHalVersionRegion furi_hal_version_get_hw_region();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get hardware timestamp */
 | 
					/** Get hardware timestamp
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Manufacture timestamp
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint32_t furi_hal_version_get_hw_timestamp();
 | 
					const uint32_t furi_hal_version_get_hw_timestamp();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get pointer to target name */
 | 
					/** Get pointer to target name
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Name C-string
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const char* furi_hal_version_get_name_ptr();
 | 
					const char* furi_hal_version_get_name_ptr();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get pointer to target device name */
 | 
					/** Get pointer to target device name
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Hardware Device Name C-string
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const char* furi_hal_version_get_device_name_ptr();
 | 
					const char* furi_hal_version_get_device_name_ptr();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get pointer to target ble local device name */
 | 
					/** Get pointer to target ble local device name
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     Ble Device Name C-string
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const char* furi_hal_version_get_ble_local_device_name_ptr();
 | 
					const char* furi_hal_version_get_ble_local_device_name_ptr();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Get BLE MAC address
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to BLE MAC address
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t* furi_hal_version_get_ble_mac();
 | 
					const uint8_t* furi_hal_version_get_ble_mac();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get address of version structure of bootloader, stored in chip flash.
 | 
				
			||||||
 * Get address of version structure of bootloader, stored in chip flash.
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return Address of boot version structure.
 | 
					 * @return     Address of boot version structure.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const struct Version* furi_hal_version_get_boot_version(void);
 | 
					const struct Version* furi_hal_version_get_boot_version();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/** Get address of version structure of firmware.
 | 
				
			||||||
 * Get address of version structure of firmware.
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return Address of firmware version structure.
 | 
					 * @return     Address of firmware version structure.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const struct Version* furi_hal_version_get_firmware_version(void);
 | 
					const struct Version* furi_hal_version_get_firmware_version();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get platform UID size in bytes */
 | 
					/** Get platform UID size in bytes
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     UID size in bytes
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
size_t furi_hal_version_uid_size();
 | 
					size_t furi_hal_version_uid_size();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get const pointer to UID */
 | 
					/** Get const pointer to UID
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return     pointer to UID
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
const uint8_t* furi_hal_version_uid();
 | 
					const uint8_t* furi_hal_version_uid();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal-vibro.h
 | 
				
			||||||
 | 
					 * Vibro HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
@ -8,10 +13,14 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Initialize vibro */
 | 
					/** Initialize vibro
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_vibro_init();
 | 
					void furi_hal_vibro_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Turn on/off vibro */
 | 
					/** Turn on/off vibro
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in]  value  new state
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void furi_hal_vibro_on(bool value);
 | 
					void furi_hal_vibro_on(bool value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file furi-hal.h
 | 
				
			||||||
 | 
					 * Furi HAL API
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -1,39 +0,0 @@
 | 
				
			|||||||
# Flipper Zero Contributor License Agreement
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
 | 
					 | 
				
			||||||
* This Flipper Zero Sources or Sources - all of the files within any archive file or any group of files released in conjunction by Flipper Devices Inc., Flipper Devices Inc., or a derived or modified work based on such files.
 | 
					 | 
				
			||||||
* Contribution - any type of work that is submitted to a Sources, including any modifications or additions to existing work.
 | 
					 | 
				
			||||||
* Submitted - conveyed to a Sources via a pull request, commit, issue, or any form of electronic, written, or verbal communication with Flipper Devices Inc., contributors or maintainers.
 | 
					 | 
				
			||||||
* A Modification, or a Mod - instructions, to be performed manually or in an automated manner, that alter any part of this Sources.
 | 
					 | 
				
			||||||
* A Modified Sources - this Sources or a derivative of it with one or more Modification applied to it.
 | 
					 | 
				
			||||||
* Distribution - allowing one or more other people to in any way download or receive
 | 
					 | 
				
			||||||
a copy of this Sources, a Modified Sources, or a derivative of this Sources.
 | 
					 | 
				
			||||||
* The Flipper Zero Website - https://flipperzero.one.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Agreement
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### 1. Grant of Copyright License.
 | 
					 | 
				
			||||||
Subject to the terms and conditions of this agreement, **You grant** to the Projects’ maintainers, contributors, users and to Flipper Devices Inc. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, **irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your contributions and such derivative works**. Except for this license, **You reserve all rights, title, and interest in your contributions.**
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### 2. Grant of Patent License.
 | 
					 | 
				
			||||||
Subject to the terms and conditions of this agreement, You grant to the Projects’ maintainers, contributors, users and to Flipper Devices Inc. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer your contributions, where such license applies only to those patent claims licensable by you that are necessarily infringed by your contribution or by combination of your contribution with the project to which this contribution was submitted.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If any entity institutes patent litigation - including cross-claim or counterclaim in a lawsuit - against You alleging that your contribution or any project it was submitted to constitutes or is responsible for direct or contributory patent infringement, then any patent licenses granted to that entity under this agreement shall terminate as of the date such litigation is filed.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### 3. Grant of using, copying, modifying and distributing.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Permission is hereby granted to use, copy, modify and/or distribute this Sources, provided that:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* All copyright notices within source files and as generated by the Software as output are retained, unchanged.
 | 
					 | 
				
			||||||
* **Any Distribution of this Sources**, whether as a Modified Sources or not, **includes this license** and is released under the terms of this Agreement. This clause is not dependant upon any measure of changes made to this Sources.
 | 
					 | 
				
			||||||
* **Any Distribution of this Sources, whether as a Modified Sources or not, requires express written consent from Flipper Devices Inc..**
 | 
					 | 
				
			||||||
* You may make Modifications to this Sources or a derivative of it, and distribute your Modifications in a form that is separate from the Sources, such as patches. The following restrictions apply to Modifications:
 | 
					 | 
				
			||||||
  * A Modification must not alter or remove any copyright notices in the Sources, generated or otherwise.
 | 
					 | 
				
			||||||
  * When a Modification to the Sources is released, a non-exclusive royalty-free right is granted to Flipper Devices Inc. to distribute the Modification in future versions of the Sources provided such versions remain available under the terms of this Agreement in addition to any other license(s) of the initial developer.
 | 
					 | 
				
			||||||
  * **Any Distribution of a Modified Sources or derivative requires express written consent from Flipper Devices Inc..**
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* Permission is hereby also granted to distribute programs which depend on this Sources, provided that you do not distribute any Modified Sources without express written consent.
 | 
					 | 
				
			||||||
* **Flipper Devices Inc. reserves the right to change the terms of this Agreement at any time**, although those changes are not retroactive to past releases. Changes to this document will be announced via email using the Flipper Devices Inc. email notification list. Failure to receive notification of a change does not make those changes invalid. A current copy of this Agreement can be found in the Flipper Zero Source repository.
 | 
					 | 
				
			||||||
* This Agreement will terminate automatically if you fail to comply with the limitations described herein. Upon termination, you must destroy all copies of this Package, the Software, and any derivatives within 48 hours.
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user