0% found this document useful (0 votes)
64 views1 page

Buttondb 1

This header file defines constants, typedefs, and function prototypes for interacting with a button database (ButtonDB) in an embedded system. It includes event definition header files, defines a button's I/O pin locations, and defines enumerations for the button's possible states and actions. Function prototypes are provided for initializing the button database, running it to process events, posting events, and checking the button's state.

Uploaded by

api-532411015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views1 page

Buttondb 1

This header file defines constants, typedefs, and function prototypes for interacting with a button database (ButtonDB) in an embedded system. It includes event definition header files, defines a button's I/O pin locations, and defines enumerations for the button's possible states and actions. Function prototypes are provided for initializing the button database, running it to process events, posting events, and checking the button's state.

Uploaded by

api-532411015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

/****************************************************************************

Header file for ButtonDB.c


based on the Gen2 Events and Services Framework

****************************************************************************/

#ifndef ButtonDB_H
#define ButtonDB_H

// Event Definitions
#include "ES_Configure.h" /* gets us event definitions */
#include "ES_Types.h" /* gets bool type for returns */

#define Button_Tris TRISBbits.TRISB8 //b8 will be input


#define Button_Port PORTBbits.RB8 // b8 is where button will be connected to

// typedefs for the states


// State definitions for use with the query function
typedef enum
{
InitButtonState, Waiting, DB_FallingEdge,
DB_RisingEdge
} ButtonState_t;

typedef enum
{
Down = 0, //when button pressed, connects to ground
Up = 1
} ButtonActions_t;

// Public Function Prototypes

bool InitButtonDB(uint8_t Priority);


ES_Event_t RunButtonDB(ES_Event_t ThisEvent);
bool PostButtonDB(ES_Event_t ThisEvent);
bool CheckButton(void);

#endif /* ButtonDB_H */

You might also like