Statistics
| Branch: | Tag: | Revision:

root / LUFA / CodeTemplates / DriverStubs / Joystick.h @ 978b99e5

History | View | Annotate | Download (3.43 KB)

1
/*
2
             LUFA Library
3
     Copyright (C) Dean Camera, 2011.
4

5
  dean [at] fourwalledcubicle [dot] com
6
           www.lufa-lib.org
7
*/
8

    
9
/*
10
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
11

12
  Permission to use, copy, modify, distribute, and sell this
13
  software and its documentation for any purpose is hereby granted
14
  without fee, provided that the above copyright notice appear in
15
  all copies and that both that the copyright notice and this
16
  permission notice and warranty disclaimer appear in supporting
17
  documentation, and that the name of the author not be used in
18
  advertising or publicity pertaining to distribution of the
19
  software without specific, written prior permission.
20

21
  The author disclaim all warranties with regard to this
22
  software, including all implied warranties of merchantability
23
  and fitness.  In no event shall the author be liable for any
24
  special, indirect or consequential damages or any damages
25
  whatsoever resulting from loss of use, data or profits, whether
26
  in an action of contract, negligence or other tortious action,
27
  arising out of or in connection with the use or performance of
28
  this software.
29
*/
30

    
31
/*
32
   This is a stub driver header file, for implementing custom board
33
   layout hardware with compatible LUFA board specific drivers. If
34
   the library is configured to use the BOARD_USER board mode, this
35
   driver file should be completed and copied into the "/Board/" folder
36
   inside the application's folder.
37

38
   This stub is for the board-specific component of the LUFA Joystick
39
   driver, for a digital four-way (plus button) joystick.
40
*/
41

    
42
#ifndef __JOYSTICK_USER_H__
43
#define __JOYSTICK_USER_H__
44

    
45
        /* Includes: */
46
                // TODO: Add any required includes here
47

    
48
        /* Enable C linkage for C++ Compilers: */
49
                #if defined(__cplusplus)
50
                        extern "C" {
51
                #endif
52

    
53
        /* Preprocessor Checks: */
54
                #if !defined(__INCLUDE_FROM_JOYSTICK_H)
55
                        #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
56
                #endif
57

    
58
        /* Public Interface - May be used in end-application: */
59
                /* Macros: */
60
                        /** Mask for the joystick being pushed in the left direction. */
61
                        #define JOY_LEFT                  // TODO: Add mask to indicate joystick left position here
62

    
63
                        /** Mask for the joystick being pushed in the right direction. */
64
                        #define JOY_RIGHT                 // TODO: Add mask to indicate joystick right position here
65

    
66
                        /** Mask for the joystick being pushed in the upward direction. */
67
                        #define JOY_UP                    // TODO: Add mask to indicate joystick up position here
68

    
69
                        /** Mask for the joystick being pushed in the downward direction. */
70
                        #define JOY_DOWN                  // TODO: Add mask to indicate joystick down position here
71

    
72
                        /** Mask for the joystick being pushed inward. */
73
                        #define JOY_PRESS                 // TODO: Add mask to indicate joystick pressed position here
74

    
75
                /* Inline Functions: */
76
                #if !defined(__DOXYGEN__)
77
                        static inline void Joystick_Init(void)
78
                        {
79
                                // TODO: Initialize joystick port pins as inputs with pull-ups
80
                        }
81

    
82
                        static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
83
                        static inline uint8_t Joystick_GetStatus(void)
84
                        {
85
                                // TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros
86
                        }
87
                #endif
88

    
89
        /* Disable C linkage for C++ Compilers: */
90
                #if defined(__cplusplus)
91
                        }
92
                #endif
93

    
94
#endif
95