Button press count. More...
Files | |
file | but.c |
Button implementation. | |
file | but.h |
Button interface. | |
Functions | |
void | but_init () |
This function initializes the button control variables. More... | |
UInt16 | but_proccess () |
This function processes the tasks of the button control. More... | |
void | but_clearPending () |
This function clear pending button presses. | |
UInt8 | but_getPending () |
This function get number of button presses on the time window. More... | |
void | BUT_ISR () |
Button Interrupt Service Request on port 1. More... | |
Button press count.
UInt8 but_getPending | ( | ) |
This function get number of button presses on the time window.
Definition at line 204 of file but.c.
References but_pendingPress.
void but_init | ( | ) |
This function initializes the button control variables.
This function initializes counters and sets interruption on button press.
Definition at line 108 of file but.c.
References but_currentState, but_pendingPress, but_presses, BUT_S_IDLE, and BUT_SW0BIT.
Referenced by main().
void BUT_ISR | ( | ) |
Button Interrupt Service Request on port 1.
This function must be called only on sw0 interrupt, not on others IFG from the port on with sw0 is connected.
Definition at line 216 of file but.c.
References but_currentState, BUT_S_IDLE, BUT_S_PRESSED, and BUT_SW0BIT.
UInt16 but_proccess | ( | ) |
This function processes the tasks of the button control.
When last bit of but_press is set, it represents a button press 3.2s ago, count number of bits set, that represents number of presses, and write it to but_pendingPress. Then executes tasks depending on current state. The program must check the pending presses to verify adequate actions.
Definition at line 132 of file but.c.
References but_currentState, but_pendingPress, but_presses, BUT_S_DEBOUNCE, BUT_S_IDLE, BUT_S_PRESSED, BUT_SW0BIT, NWK_DEVTYPE_ENDDEVICE, NWK_DEVTYPE_ROUTER, and nwk_setDeviceType().
Referenced by main().