refactored code to enable implementation on different hardware
This commit is contained in:
44
firmware/modelinterface.h
Normal file
44
firmware/modelinterface.h
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* \file firmware/modelibmmodelm.c
|
||||
* \brief Hardware specific part for IBM Model M keyboard
|
||||
* \author Ronald Schaten <ronald@schatenseite.de>
|
||||
* \version $Id: main.c,v 1.6 2008/07/15 05:16:41 rschaten Exp $
|
||||
*
|
||||
* 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);
|
Reference in New Issue
Block a user