SZSPTP ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
but.c File Reference

Button implementation. More...

#include <msp430.h>
#include "but.h"
#include "nwk.h"
+ Include dependency graph for but.c:

Go to the source code of this file.

Macros

#define BUT_SW0BIT   BIT2
 Bit on with switch 0 is wired, port 1.2.
 

Typedefs

typedef enum but_state but_state
 States for the button control.
 

Enumerations

enum  but_state { BUT_S_IDLE, BUT_S_PRESSED, BUT_S_DEBOUNCE }
 States for the button control. More...
 

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...
 

Variables

but_state but_currentState = BUT_S_IDLE
 Current state of the button control. More...
 
UInt32 but_presses
 Button presses over time, one bit for each press, shift left over time.
 
UInt8 but_pendingPress
 Number of button presses, it is cleared by but_clearPending.
 

Detailed Description

Button implementation.

Process button presses and store the count on an interval.

Definition in file but.c.

Enumeration Type Documentation

enum but_state

States for the button control.

Enumerator
BUT_S_IDLE 

Waiting for button press.

BUT_S_PRESSED 

Button was pressed.

BUT_S_DEBOUNCE 

Timeout to avoid bounce counting.

Definition at line 54 of file but.c.

Variable Documentation

but_state but_currentState = BUT_S_IDLE

Current state of the button control.

Definition at line 83 of file but.c.

Referenced by but_init(), BUT_ISR(), and but_proccess().