/* * Copyright (c) 2021-2023, Erich Styger * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef BUTTONS_H_ #define BUTTONS_H_ #include #include "buttons_config.h" #ifdef __cplusplus extern "C" { #endif #include "platform.h" #if PL_CONFIG_USE_SHELL #include "McuShell.h" /*! * \brief Module command line parser * \param cmd Pointer to command string to be parsed * \param handled Set to TRUE if command has handled by parser * \param io Shell standard I/O handler * \return Error code, ERR_OK if everything was ok */ uint8_t BTN_ParseCommand(const unsigned char *cmd, bool *handled, const McuShell_StdIOType *io); #endif /*! * \brief Decides if a button is pressed, directly accessing the pin * \param btn Button to check * \return true if button is pressed */ bool BTN_IsPressed(BTN_Buttons_e btn); /*! * \brief Read the button status from the pins and build a bitmask * \return Bitmask of buttons pressed, e.g. BTN_BIT_NAV_UP, see buttons_config.h */ uint32_t BTN_GetButtons(void); /*! * \brief Rotates the button orientation based on BTN_CONFIG_ROTATION * \param button button pressed * \return rotated button */ BTN_Buttons_e BTN_RotateButton(BTN_Buttons_e button); /*! * \brief Module de-initialization */ void BTN_Deinit(void); /*! * \brief Module initialization */ void BTN_Init(void); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* BUTTONS_H_ */