Contiki 2.6

key.h File Reference

This file provides joystick operations. More...

#include <stdint.h>
#include <avr/io.h>
#include <avr/pgmspace.h>

Go to the source code of this file.

Defines

Port definition for reading the joystick input.
#define KEY_PORT   PINF
#define KEY_PUR   PORTF
#define KEY_DDR   DDRF
#define KEY_PIN   PINF1
Port defininition for the joystick Enter button.
#define ENTER_PORT   PINE
#define ENTER_PUR   PORTE
#define ENTER_DDR   DDRE
#define ENTER_PIN   PINE2
Valid Key States.
#define KEY_STATE_UP   0x01
#define KEY_STATE_DOWN   0x02
#define KEY_STATE_LEFT   0x04
#define KEY_STATE_RIGHT   0x08
#define KEY_STATE_ENTER   0x10
#define KEY_STATE_NO_KEY   0x00
#define KEY_STATE_DONE   0x20

Functions

void key_init (void)
 This will intialize the joystick and the ADC for button readings.
void key_deinit (void)
 This will disable the ADC used for button readings.
key_state_t key_task (void)
 This will check the joystick state to return the current button status.
key_state_t key_state_get (void)
 This function will start the ADC conversion and read the current converstion value to determine the button position.
uint8_t is_button (void)
 This will poll run key_task() to determine if a button has been pressed.
uint8_t get_button (void)
 This function will wait for a user to press a button.

Detailed Description

This file provides joystick operations.

Combined with ADC functions.

Author:
Mike Vidales mavida404@gmail.com

Definition in file key.h.


Define Documentation

#define ENTER_PORT   PINE

Definition at line 60 of file key.h.

Referenced by key_state_get(), menu_run_doze(), and sleep_now().

#define KEY_PORT   PINF

Definition at line 52 of file key.h.

#define KEY_STATE_UP   0x01

Definition at line 68 of file key.h.