SRD Standelone programmation box: button.h File Reference

| SRD Standelone programmation box 2.0 (16/11/15 10:00:00) Documentation of the SRD standelone programmation box

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
Enumerations | Functions
button.h File Reference

Headerfile for button driver. More...

`#include "dsp.h"`
Include dependency graph for button.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | BUTTON_WRITE_SHIFT (1)
| Define the shift and mask of the IO used by the button interface. More...
#define | BUTTON_WRITE_MASK (1<<BUTTON_WRITE_SHIFT)
| Define the shift and mask of the IO used by the button interface. More...
#define | BUTTON_READ_SHIFT (2)
| Define the shift and mask of the IO used by the button interface. More...
#define | BUTTON_READ_MASK (1<<BUTTON_READ_SHIFT)
| Define the shift and mask of the IO used by the button interface. More...
#define | ButtonReadGetState() ((PTA->PDIR & BUTTON_READ_MASK) >> BUTTON_READ_SHIFT)
| Macro used to get the button status. More...
#define | ButtonWriteGetState() ((PTA->PDIR & BUTTON_WRITE_MASK) >> BUTTON_WRITE_SHIFT)
| Macro used to get the button status. More...

## Enumerations

enum | tButtonId { BUTTON_WRITE = BUTTON_WRITE_MASK, BUTTON_READ = BUTTON_READ_MASK }
| Define the button Id used by the interface. More...
enum | tButtonState { BUTTON_PRESSED = 1, BUTTON_RELEASED = 0 }
| Define the state of buttons. More...

## Functions

void | ButtonInit (void)
| Function used to initialized the buttons. More...

## Detailed Description

Headerfile for button driver.

Author
  Thibaut LALUQUE 3D-Ouest

Date
  26/09/2014

Version
  1.0

All Right Reserved.

Definition in file button.h.

## Macro Definition Documentation

#define BUTTON_READ_MASK (1<<BUTTON_READ_SHIFT)

Define the shift and mask of the IO used by the button interface.

Definition at line 38 of file button.h.

Referenced by ButtonInit().

#define BUTTON_READ_SHIFT (2)

Define the shift and mask of the IO used by the button interface.

Definition at line 37 of file button.h.

Referenced by ButtonInit(), PowerManagerClearWakeUpInterruptFlag(), PowerManagerDisableWakeUpInterrupt(), and PowerManagerEnableWakeUpInterrupt().

#define BUTTON_WRITE_MASK (1<<BUTTON_WRITE_SHIFT)

Define the shift and mask of the IO used by the button interface.

Definition at line 36 of file button.h.

Referenced by ButtonInit().

#define BUTTON_WRITE_SHIFT (1)

Define the shift and mask of the IO used by the button interface.

Definition at line 35 of file button.h.

Referenced by ButtonInit(), PowerManagerClearWakeUpInterruptFlag(), PowerManagerDisableWakeUpInterrupt(), and PowerManagerEnableWakeUpInterrupt().

#define ButtonReadGetState | ( |  | ) | ((PTA->PDIR & BUTTON_READ_MASK) >> BUTTON_READ_SHIFT)

Macro used to get the button status.

Definition at line 103 of file button.h.

Referenced by ButtonManager(), ButtonManagerDealer(), PowerManagerLPMController(), and RFIDReadStateMachine().

#define ButtonWriteGetState | ( |  | ) | ((PTA->PDIR & BUTTON_WRITE_MASK) >> BUTTON_WRITE_SHIFT)

Macro used to get the button status.

Definition at line 104 of file button.h.

Referenced by ButtonManager(), ButtonManagerDealer(), PowerManagerLPMController(), and RFIDWriteStateMachine().

## Enumeration Type Documentation

enum tButtonId

Define the button Id used by the interface.

Enumerator
BUTTON_WRITE | Write button ID
BUTTON_READ | Read button ID

Definition at line 55 of file button.h.

55 {
56 BUTTON_WRITE = BUTTON_WRITE_MASK, /*!< Write button ID */
57 BUTTON_READ = BUTTON_READ_MASK /*!< Read button ID */
58 }tButtonId;
BUTTON_READ
Definition: button.h:57
tButtonId
tButtonId
Define the button Id used by the interface.
Definition: button.h:55
BUTTON_WRITE_MASK
#define BUTTON_WRITE_MASK
Define the shift and mask of the IO used by the button interface.
Definition: button.h:36
BUTTON_READ_MASK
#define BUTTON_READ_MASK
Define the shift and mask of the IO used by the button interface.
Definition: button.h:38
BUTTON_WRITE
Definition: button.h:56

enum tButtonState

Define the state of buttons.

Enumerator
BUTTON_PRESSED | Button is pressed
BUTTON_RELEASED | Button is not pressed (released)

Definition at line 66 of file button.h.

66 {
67 BUTTON_PRESSED = 1, /*!< Button is pressed */
68 BUTTON_RELEASED = 0 /*!< Button is not pressed (released) */
69 }tButtonState;
BUTTON_PRESSED
Definition: button.h:67
tButtonState
tButtonState
Define the state of buttons.
Definition: button.h:66
BUTTON_RELEASED
Definition: button.h:68

## Function Documentation

void ButtonInit | ( | void |  | ) |

Function used to initialized the buttons.

Definition at line 78 of file button.c.

References BUTTON_READ_MASK, BUTTON_READ_SHIFT, BUTTON_WRITE_MASK, and BUTTON_WRITE_SHIFT.

Referenced by ButtonManagerInit().

78 {
79
80 SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
81
82 PTA->PDDR &= ~GPIO_PDDR_PDD(BUTTON_WRITE_MASK | BUTTON_READ_MASK); //As input
83
84 PORTA->PCR[BUTTON_WRITE_SHIFT] = PORT_PCR_MUX(0x01); //IO config
85 PORTA->PCR[BUTTON_READ_SHIFT] = PORT_PCR_MUX(0x01);
86 }
BUTTON_WRITE_MASK
#define BUTTON_WRITE_MASK
Define the shift and mask of the IO used by the button interface.
Definition: button.h:36
BUTTON_WRITE_SHIFT
#define BUTTON_WRITE_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:35
BUTTON_READ_SHIFT
#define BUTTON_READ_SHIFT
Define the shift and mask of the IO used by the button interface.
Definition: button.h:37
BUTTON_READ_MASK
#define BUTTON_READ_MASK
Define the shift and mask of the IO used by the button interface.
Definition: button.h:38

Here is the caller graph for this function: