45 lines
1.6 KiB
C
45 lines
1.6 KiB
C
/**
|
|
* \file firmware/modelinterface.h
|
|
* \brief Interface for hardware specific functions
|
|
* \author Ronald Schaten <ronald@schatenseite.de>
|
|
* \version $Id$
|
|
*
|
|
* License: GNU GPL v2 (see License.txt)
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* Initialize hardware. Configure ports as inputs and outputs, set USB reset
|
|
* condition, start timer and blink LEDs.
|
|
*/
|
|
void hardwareInit(void);
|
|
|
|
/**
|
|
* Print the current state of the keyboard in a readable form. This function
|
|
* is used for debug-purposes only.
|
|
*/
|
|
void printMatrix(void);
|
|
|
|
/**
|
|
* This function sets the LEDs according to the given data.
|
|
* \param LEDstate bitfield with LED info
|
|
*/
|
|
void setLeds(uint8_t LEDstate);
|
|
|
|
/**
|
|
* Scan and debounce keypresses. This is the main worker function for normal
|
|
* keyboard operation, the code contains lot of comments. Basically, it first
|
|
* scans the keyboard state. If a change is detected, it initializes a counter
|
|
* that is decreased each time this function is called. If the counter reaches
|
|
* 1, that means that the same scan result has been scanned ten times in a row,
|
|
* so we can be pretty sure that the keys are in a certain state (as in: not
|
|
* bouncing). Then, the codes for keys and modifiers are searched from the two
|
|
* arrays, the USB-message to send the state is prepared. The return value of
|
|
* this function indicates if the message has to be sent.
|
|
* \param reportBuffer array with the current USB report
|
|
* \param oldReportBuffer array with the last USB report
|
|
* \return flag to indicate whether something has changed
|
|
*/
|
|
uint8_t scankeys(uint8_t* reportBuffer, uint8_t* oldReportBuffer, uint8_t sizeOfReportBuffer);
|