FreeRTOS Tetris
Data Structures | Typedefs | Functions | Variables
Input Module

Module handling any interactions with keyboard or mouse inputs. More...

Collaboration diagram for Input Module:

Data Structures

struct  debounce_button
 Structure for debouncing buttons. More...
 
struct  buttons_buffer
 Structure for keyboard inputs. More...
 

Typedefs

typedef struct debounce_button debounce_button_t
 Structure for debouncing buttons.
 
typedef struct buttons_buffer buttons_buffer_t
 Structure for keyboard inputs.
 

Functions

void vGetButtonInput ()
 Read the current button input from buttonInputQueue & write it into buttons.
 
bool bGameDebounceButton (char currentState, bool *previousState)
 Simple function for debouncing input buttons. More...
 
bool bGUIPushButton (const coord_t lowBound, const coord_t highBound)
 Create a push-button between 2 boundaries. More...
 
int iInputInit ()
 Initialize the input module. More...
 

Variables

buttons_buffer_t buttons
 Object representing the keyboard buttons.
 

Detailed Description

Module handling any interactions with keyboard or mouse inputs.

This module provides support for any keyboard or mouse inputs.

Authors
Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
Date
04.02.2021

Function Documentation

◆ bGameDebounceButton()

bool bGameDebounceButton ( char  currentState,
bool *  previousState 
)

#include <input.h>

Simple function for debouncing input buttons.

Take the previous state of the button & the current state.

  • If the button is currently pressed, and the previous state (meaning the button was not just pressed) is false, return true.
  • If the button is currently pressed, and the previous state (meaning the button was just pressed) is true, return false.
Parameters
[in]currentState(char): Current state of the button input.
[in]previousState(bool*): Previous state of the button input.
Returns
(bool): whether the (debounced) button was pressed.

◆ bGUIPushButton()

bool bGUIPushButton ( const coord_t  lowBound,
const coord_t  highBound 
)

#include <input.h>

Create a push-button between 2 boundaries.

Take two boundaries and return true if the mouse is in those boundaries and the left mouse button is pressed.

Parameters
[in]lowBound(const coord_t): Lower boundary.
[in]highBound(const coord_t): Higher boundary.
Returns
(bool): Whether the push button was pressed.

◆ iInputInit()

int iInputInit ( )

#include <input.h>

Initialize the input module.

Returns
(int): 0 if initialization was successful, -1 otherwise.