EE445M RTOS
Taken at the University of Texas Spring 2015
test-button.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "inc/hw_ints.h"
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/rom.h"
#include "libos/os.h"
#include "libbutton/button.h"
#include "libhw/hardware.h"
Include dependency graph for test-button.c:

Go to the source code of this file.

Functions

void update_pid (notification button_bitmask)
 
int main ()
 

Variables

uint32_t button_left_pressed = 0
 
uint32_t button_right_pressed = 0
 

Function Documentation

int main ( void  )

Definition at line 43 of file test-button.c.

References button_metadata_init, BUTTONS_BOTH, GPIO_BOTH_EDGES, GPIO_PORTF_BASE, HW_BUTTON, hw_init, hw_subscribe, IntMasterDisable(), IntMasterEnable(), postpone_death, SYSCTL_OSC_MAIN, SYSCTL_SYSDIV_1, SYSCTL_USE_OSC, SYSCTL_XTAL_16MHZ, SysCtlClockSet(), and update_pid().

43  {
44 
47 
49 
51  hw_init(HW_BUTTON, button_metadata);
52  hw_subscribe(HW_BUTTON, button_metadata, update_pid);
53 
55 
57 }
#define button_metadata_init(_base, _pin, _interrupt)
Definition: button.h:23
#define GPIO_BOTH_EDGES
Definition: gpio.h:87
#define SYSCTL_OSC_MAIN
Definition: sysctl.h:378
#define hw_subscribe(type, metadata, isr)
Definition: hardware.h:178
#define SYSCTL_USE_OSC
Definition: sysctl.h:350
#define SYSCTL_XTAL_16MHZ
Definition: sysctl.h:372
#define hw_init(type, metadata)
Definition: hardware.h:143
#define BUTTONS_BOTH
Definition: button.h:28
#define postpone_death()
Definition: nexus.h:40
bool IntMasterDisable(void)
Definition: interrupt.c:249
bool IntMasterEnable(void)
void update_pid(notification button_bitmask)
Definition: test-button.c:32
#define SYSCTL_SYSDIV_1
Definition: sysctl.h:221
void SysCtlClockSet(uint32_t ui32Config)
Definition: sysctl.c:2532
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

void update_pid ( notification  button_bitmask)

Definition at line 32 of file test-button.c.

References notification::_int, BUTTON_LEFT, button_left_pressed, BUTTON_RIGHT, and button_right_pressed.

Referenced by main().

32  {
33  /* What was that technique we learned in 460n to avoid a bunch of
34  branches? cond && action*/
35  if (button_bitmask._int & BUTTON_LEFT) {
37  }
38  if (button_bitmask._int & BUTTON_RIGHT) {
40  }
41 }
int _int
Definition: notify.h:23
uint32_t button_left_pressed
Definition: test-button.c:29
uint32_t button_right_pressed
Definition: test-button.c:30
#define BUTTON_LEFT
Definition: button.h:26
#define BUTTON_RIGHT
Definition: button.h:27

Here is the caller graph for this function:

Variable Documentation

uint32_t button_left_pressed = 0

Definition at line 29 of file test-button.c.

Referenced by update_pid().

uint32_t button_right_pressed = 0

Definition at line 30 of file test-button.c.

Referenced by update_pid().