unleashed-firmware/lib/toolbox/value_index.h
あく fc043da9c6
FuriHal: UART refactoring (#3211)
* FuriHal: UART refactoring
* ApiSymbols: add furi_record_destroy
* FuriHal: cleanup serial API, add logging configuration in RTC
* FuriHal: hide private part in _i header. Toolbox: cleanup value index. SystemSettings: logging device and baudrate.
* FuriHal: RTC logging method documentation
* Synchronize API Symbols
* Furi: mark HEAP_PRINT_DEBUG as broken
* FuriHal: furi_hal_serial, add custom IRQ func
* Fix PR review issues
* FuriHal: UART add reception DMA (#3220)
* FuriHal: add DMA serial rx mode
* usb_uart_bridge: switch to working with DMA
* Sync api symbol versions
* FuriHal: update serial docs and api
* FuriHal: Selial added similar API for simple reception mode as with DMA
* FuriHal: Update API target H18
* API: ver API H7
* FuriHal: Serial error processing
* FuriHal: fix furi_hal_serial set baudrate
* Sync api symbols
* FuriHal: cleanup serial isr and various flag handling procedures
* FuriHal: cleanup and simplify serial API
* Debug: update UART Echo serial related flags
* FuriHal: update serial API symbols naming
* FuriHalSerial: various improvements and PR review fixes
* FuriHal: proper ISR function signatures

---------

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: SkorP <skorpionm@yandex.ru>
Co-authored-by: Skorpionm <85568270+Skorpionm@users.noreply.github.com>
2024-01-16 03:09:37 +04:00

65 lines
2.1 KiB
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Get the index of a int32_t array element which is closest to the given value.
*
* Returned index corresponds to the first element found.
* If no suitable elements were found, the function returns 0.
*
* @param value value to be searched.
* @param values pointer to the array to perform the search in.
* @param values_count array size.
*
* @return value's index.
*/
size_t value_index_int32(const int32_t value, const int32_t values[], size_t values_count);
/** Get the index of a uint32_t array element which is closest to the given value.
*
* Returned index corresponds to the first element found.
* If no suitable elements were found, the function returns 0.
*
* @param value value to be searched.
* @param values pointer to the array to perform the search in.
* @param values_count array size.
*
* @return value's index.
*/
size_t value_index_uint32(const uint32_t value, const uint32_t values[], size_t values_count);
/** Get the index of a float array element which is closest to the given value.
*
* Returned index corresponds to the first element found.
* If no suitable elements were found, the function returns 0.
*
* @param value value to be searched.
* @param values pointer to the array to perform the search in.
* @param values_count array size.
*
* @return value's index.
*/
size_t value_index_float(const float value, const float values[], size_t values_count);
/** Get the index of a bool array element which is equal to the given value.
*
* Returned index corresponds to the first element found.
* If no suitable elements were found, the function returns 0.
*
* @param value value to be searched.
* @param values pointer to the array to perform the search in.
* @param values_count array size.
*
* @return value's index.
*/
size_t value_index_bool(const bool value, const bool values[], size_t values_count);
#ifdef __cplusplus
}
#endif