EE445M RTOS
Taken at the University of Texas Spring 2015
Button I/O library

Macros

#define button_metadata_init_(_name, _base, _pin, _interrupt)
 
#define button_metadata_init(_base, _pin, _interrupt)   button_metadata_init_(button_metadata, _base, _pin, _interrupt)
 
#define BUTTON_LEFT   GPIO_PIN_4
 
#define BUTTON_RIGHT   GPIO_PIN_0
 
#define BUTTONS_BOTH   (BUTTON_LEFT | BUTTON_RIGHT)
 

Functions

void button_init (hw_metadata)
 
void button_set_interrupt (hw_metadata)
 

Detailed Description

Macro Definition Documentation

#define BUTTON_LEFT   GPIO_PIN_4

Definition at line 26 of file button.h.

Referenced by postpone_suicide(), and update_pid().

#define button_metadata_init (   _base,
  _pin,
  _interrupt 
)    button_metadata_init_(button_metadata, _base, _pin, _interrupt)

Create a hardware_metadata struct named `button_metadata'

Definition at line 23 of file button.h.

Referenced by GPIOPortF_Handler(), and main().

#define button_metadata_init_ (   _name,
  _base,
  _pin,
  _interrupt 
)
Value:
hw_metadata _name; \
_name.button = (hw_button_metadata) { \
.base = (memory_address_t) _base, \
.pin = (memory_address_t) _pin, \
.interrupt = (uint32_t) _interrupt \
}
hw_button_metadata button
Definition: hardware.h:99
memory_address_t base
Definition: hardware.h:73
int32_t memory_address_t
Definition: nexus.h:48

Create a struct named _name.

Definition at line 13 of file button.h.

#define BUTTON_RIGHT   GPIO_PIN_0

Definition at line 27 of file button.h.

Referenced by postpone_suicide(), and update_pid().

#define BUTTONS_BOTH   (BUTTON_LEFT | BUTTON_RIGHT)

Definition at line 28 of file button.h.

Referenced by button_debounce_end(), button_debounce_start(), GPIOPortF_Handler(), and main().

Function Documentation

void button_init ( hw_metadata  )

Initialize buttons for use as input.

Note
Currently only supports on-board peripherals.

Definition at line 22 of file button.c.

References hw_metadata::button, GPIO_DIR_MODE_IN, GPIO_LOCK_KEY, GPIO_O_CR, GPIO_O_LOCK, GPIO_PIN_TYPE_STD_WPU, GPIO_PORTF_BASE, GPIO_STRENGTH_2MA, GPIODirModeSet(), GPIOIntEnable(), GPIOPadConfigSet(), HWREG, and hw_button_metadata::pin.

Referenced by hw_driver_init().

22  {
23 
24  GPIODirModeSet(GPIO_PORTF_BASE, metadata.button.pin, GPIO_DIR_MODE_IN);
25 
29 
30  GPIOPadConfigSet(GPIO_PORTF_BASE, metadata.button.pin,
32  GPIOIntEnable(GPIO_PORTF_BASE, metadata.button.pin);
33 }
#define GPIO_O_CR
Definition: hw_gpio.h:67
#define HWREG(x)
Definition: hw_types.h:48
#define GPIO_PIN_TYPE_STD_WPU
Definition: gpio.h:113
void GPIOPadConfigSet(uint32_t ui32Port, uint8_t ui8Pins, uint32_t ui32Strength, uint32_t ui32PinType)
Definition: gpio.c:546
void GPIOIntEnable(uint32_t ui32Port, uint32_t ui32IntFlags)
Definition: gpio.c:763
#define GPIO_STRENGTH_2MA
Definition: gpio.h:98
#define GPIO_O_LOCK
Definition: hw_gpio.h:66
#define GPIO_LOCK_KEY
Definition: hw_gpio.h:129
#define GPIO_DIR_MODE_IN
Definition: gpio.h:75
void GPIODirModeSet(uint32_t ui32Port, uint8_t ui8Pins, uint32_t ui32PinIO)
Definition: gpio.c:298
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

void button_set_interrupt ( hw_metadata  )

Subscribe to a hardware interrupt.

Parameters
Hardwaretarget to subscribe to and isr to invoke upon interrupt

Definition at line 35 of file button.c.

References hw_button_metadata::base, hw_metadata::button, GPIOIntTypeSet(), INT_GPIOF_TM4C123, IntDisable(), IntEnable(), hw_button_metadata::interrupt, and hw_button_metadata::pin.

Referenced by hw_channel_init().

35  {
36 
37  if (metadata.button.interrupt) {
38  GPIOIntTypeSet(metadata.button.base,
39  metadata.button.pin,
40  metadata.button.interrupt);
42  } else {
44  }
45 }
void GPIOIntTypeSet(uint32_t ui32Port, uint8_t ui8Pins, uint32_t ui32IntType)
Definition: gpio.c:402
#define INT_GPIOF_TM4C123
Definition: hw_ints.h:95
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:610

Here is the call graph for this function:

Here is the caller graph for this function: