Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
a318f32b
Commit
a318f32b
authored
Feb 20, 2011
by
Dean Camera
Browse files
Update board driver common APIs to use uint_reg_t.
parent
86be7f93
Changes
8
Hide whitespace changes
Inline
Side-by-side
LUFA/Common/Common.h
View file @
a318f32b
...
...
@@ -74,7 +74,10 @@
#include
"BoardTypes.h"
/* Architecture specific utility includes: */
#if (ARCH == ARCH_AVR8)
#if defined(__DOXYGEN__)
/** Type define for an unsigned integer the same width as the selected architecture's machine register. */
typedef
MACHINE_REG_t
uint_reg_t
;
#elif (ARCH == ARCH_AVR8)
#include
<avr/io.h>
#include
<avr/interrupt.h>
#include
<avr/pgmspace.h>
...
...
@@ -83,13 +86,11 @@
#include
<util/atomic.h>
#include
<util/delay.h>
typedef
uint8_t
uintN_t
;
typedef
int8_t
intN_t
;
typedef
uint8_t
uint_reg_t
;
#elif (ARCH == ARCH_UC3B)
#include
<avr32/io.h>
typedef
uint32_t
uintN_t
;
typedef
int32_t
intN_t
;
typedef
uint32_t
uint_reg_t
;
#warning The UC3B architecture support is currently experimental and incomplete!
#endif
...
...
LUFA/Drivers/Board/Buttons.h
View file @
a318f32b
...
...
@@ -92,61 +92,61 @@
#endif
/* Includes: */
#include
"../../Common/Common.h"
#include
"../../Common/Common.h"
#if (BOARD == BOARD_NONE)
#error The Board Buttons driver cannot be used if the makefile BOARD option is not set.
#elif (BOARD == BOARD_USBKEY)
#include
"USBKEY/Buttons.h"
#elif (BOARD == BOARD_STK525)
#include
"STK525/Buttons.h"
#elif (BOARD == BOARD_STK526)
#include
"STK526/Buttons.h"
#elif (BOARD == BOARD_ATAVRUSBRF01)
#include
"ATAVRUSBRF01/Buttons.h"
#elif (BOARD == BOARD_BUMBLEB)
#include
"BUMBLEB/Buttons.h"
#elif (BOARD == BOARD_EVK527)
#include
"EVK527/Buttons.h"
#elif (BOARD == BOARD_USBTINYMKII)
#include
"USBTINYMKII/Buttons.h"
#elif (BOARD == BOARD_BENITO)
#include
"BENITO/Buttons.h"
#elif (BOARD == BOARD_JMDBU2)
#include
"JMDBU2/Buttons.h"
#elif (BOARD == BOARD_OLIMEX162)
#include
"OLIMEX162/Buttons.h"
#elif (BOARD == BOARD_USBFOO)
#include
"USBFOO/Buttons.h"
#elif (BOARD == BOARD_UDIP)
#include
"UDIP/Buttons.h"
#elif (BOARD == BOARD_CULV3)
#include
"CULV3/Buttons.h"
#elif (BOARD == BOARD_MINIMUS)
#include
"MINIMUS/Buttons.h"
#elif (BOARD == BOARD_MICROSIN162)
#include
"MICROSIN162/Buttons.h"
#elif (BOARD == BOARD_EVK1101)
#include
"EVK1101/Buttons.h"
#else
#include
"Board/Buttons.h"
#endif
#if (BOARD == BOARD_NONE)
#error The Board Buttons driver cannot be used if the makefile BOARD option is not set.
#elif (BOARD == BOARD_USBKEY)
#include
"USBKEY/Buttons.h"
#elif (BOARD == BOARD_STK525)
#include
"STK525/Buttons.h"
#elif (BOARD == BOARD_STK526)
#include
"STK526/Buttons.h"
#elif (BOARD == BOARD_ATAVRUSBRF01)
#include
"ATAVRUSBRF01/Buttons.h"
#elif (BOARD == BOARD_BUMBLEB)
#include
"BUMBLEB/Buttons.h"
#elif (BOARD == BOARD_EVK527)
#include
"EVK527/Buttons.h"
#elif (BOARD == BOARD_USBTINYMKII)
#include
"USBTINYMKII/Buttons.h"
#elif (BOARD == BOARD_BENITO)
#include
"BENITO/Buttons.h"
#elif (BOARD == BOARD_JMDBU2)
#include
"JMDBU2/Buttons.h"
#elif (BOARD == BOARD_OLIMEX162)
#include
"OLIMEX162/Buttons.h"
#elif (BOARD == BOARD_USBFOO)
#include
"USBFOO/Buttons.h"
#elif (BOARD == BOARD_UDIP)
#include
"UDIP/Buttons.h"
#elif (BOARD == BOARD_CULV3)
#include
"CULV3/Buttons.h"
#elif (BOARD == BOARD_MINIMUS)
#include
"MINIMUS/Buttons.h"
#elif (BOARD == BOARD_MICROSIN162)
#include
"MICROSIN162/Buttons.h"
#elif (BOARD == BOARD_EVK1101)
#include
"EVK1101/Buttons.h"
#else
#include
"Board/Buttons.h"
#endif
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
/** Initialises the BUTTONS driver, so that the current button position can be read. This sets the appropriate
* I/O pins to an inputs with pull-ups enabled.
*
* This must be called before any Button driver functions are used.
*/
static
inline
void
Buttons_Init
(
void
);
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
/** Initialises the BUTTONS driver, so that the current button position can be read. This sets the appropriate
* I/O pins to an inputs with pull-ups enabled.
*
* This must be called before any Button driver functions are used.
*/
static
inline
void
Buttons_Init
(
void
);
/** Returns a mask indicating which board buttons are currently pressed.
*
* \return Mask indicating which board buttons are currently pressed.
*/
static
inline
uint
8
_t
Buttons_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
#endif
/** Returns a mask indicating which board buttons are currently pressed.
*
* \return Mask indicating which board buttons are currently pressed.
*/
static
inline
uint
_reg
_t
Buttons_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
#endif
#endif
...
...
LUFA/Drivers/Board/EVK1101/Buttons.h
View file @
a318f32b
...
...
@@ -82,12 +82,12 @@
#if !defined(__DOXYGEN__)
static
inline
void
Buttons_Init
(
void
)
{
AVR32_GPIO
.
port
[
BUTTONS_PORT
].
gpers
=
(
BUTTONS_BUTTON1
|
BUTTONS_BUTTON2
);
AVR32_GPIO
.
port
[
BUTTONS_PORT
].
puers
=
(
BUTTONS_BUTTON1
|
BUTTONS_BUTTON2
);
AVR32_GPIO
.
port
[
BUTTONS_PORT
].
gpers
=
(
BUTTONS_BUTTON1
|
BUTTONS_BUTTON2
);
AVR32_GPIO
.
port
[
BUTTONS_PORT
].
puers
=
(
BUTTONS_BUTTON1
|
BUTTONS_BUTTON2
);
}
static
inline
uint
N
_t
Buttons_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint
N
_t
Buttons_GetStatus
(
void
)
static
inline
uint
32
_t
Buttons_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint
32
_t
Buttons_GetStatus
(
void
)
{
return
(
~
(
AVR32_GPIO
.
port
[
JOY_MOVE_PORT
].
pvr
&
(
BUTTONS_BUTTON1
|
BUTTONS_BUTTON2
)));
}
...
...
LUFA/Drivers/Board/EVK1101/Joystick.h
View file @
a318f32b
...
...
@@ -102,11 +102,11 @@
AVR32_GPIO
.
port
[
JOY_PRESS_PORT
].
puers
=
JOY_PRESS_MASK
;
};
static
inline
uint
N
_t
Joystick_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint
N
_t
Joystick_GetStatus
(
void
)
static
inline
uint
32
_t
Joystick_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint
32
_t
Joystick_GetStatus
(
void
)
{
return
(
uint
N
_t
)(
~
(((
AVR32_GPIO
.
port
[
JOY_MOVE_PORT
].
pvr
&
JOY_MOVE_MASK
)
|
(
AVR32_GPIO
.
port
[
JOY_PRESS_PORT
].
pvr
&
JOY_PRESS_MASK
))
<<
JOY_SHIFT_LEFT
));
return
(
uint
32
_t
)(
~
(((
AVR32_GPIO
.
port
[
JOY_MOVE_PORT
].
pvr
&
JOY_MOVE_MASK
)
|
(
AVR32_GPIO
.
port
[
JOY_PRESS_PORT
].
pvr
&
JOY_PRESS_MASK
))
<<
JOY_SHIFT_LEFT
));
}
#endif
...
...
LUFA/Drivers/Board/EVK1101/LEDs.h
View file @
a318f32b
...
...
@@ -98,23 +98,23 @@
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrs
=
LEDS_ALL_LEDS
;
}
static
inline
void
LEDs_TurnOnLEDs
(
const
uint
N
_t
LedMask
)
static
inline
void
LEDs_TurnOnLEDs
(
const
uint
32
_t
LedMask
)
{
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrc
=
LedMask
;
}
static
inline
void
LEDs_TurnOffLEDs
(
const
uint
N
_t
LedMask
)
static
inline
void
LEDs_TurnOffLEDs
(
const
uint
32
_t
LedMask
)
{
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrs
=
LedMask
;
}
static
inline
void
LEDs_SetAllLEDs
(
const
uint
N
_t
LedMask
)
static
inline
void
LEDs_SetAllLEDs
(
const
uint
32
_t
LedMask
)
{
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrs
=
LEDS_ALL_LEDS
;
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrc
=
LedMask
;
}
static
inline
void
LEDs_ChangeLEDs
(
const
uint
N
_t
LedMask
,
const
uint
N
_t
ActiveMask
)
static
inline
void
LEDs_ChangeLEDs
(
const
uint
32
_t
LedMask
,
const
uint
32
_t
ActiveMask
)
{
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrs
=
LedMask
;
AVR32_GPIO
.
port
[
LEDS_PORT
].
ovrc
=
ActiveMask
;
...
...
LUFA/Drivers/Board/Joystick.h
View file @
a318f32b
...
...
@@ -100,41 +100,41 @@
#endif
/* Includes: */
#include
"../../Common/Common.h"
#include
"../../Common/Common.h"
#if (BOARD == BOARD_NONE)
#error The Board Joystick driver cannot be used if the makefile BOARD option is not set.
#elif (BOARD == BOARD_USBKEY)
#include
"USBKEY/Joystick.h"
#elif (BOARD == BOARD_STK525)
#include
"STK525/Joystick.h"
#elif (BOARD == BOARD_STK526)
#include
"STK526/Joystick.h"
#elif (BOARD == BOARD_BUMBLEB)
#include
"BUMBLEB/Joystick.h"
#elif (BOARD == BOARD_EVK527)
#include
"EVK527/Joystick.h"
#elif (BOARD == BOARD_EVK1101)
#include
"EVK1101/Joystick.h"
#else
#include
"Board/Joystick.h"
#endif
#if (BOARD == BOARD_NONE)
#error The Board Joystick driver cannot be used if the makefile BOARD option is not set.
#elif (BOARD == BOARD_USBKEY)
#include
"USBKEY/Joystick.h"
#elif (BOARD == BOARD_STK525)
#include
"STK525/Joystick.h"
#elif (BOARD == BOARD_STK526)
#include
"STK526/Joystick.h"
#elif (BOARD == BOARD_BUMBLEB)
#include
"BUMBLEB/Joystick.h"
#elif (BOARD == BOARD_EVK527)
#include
"EVK527/Joystick.h"
#elif (BOARD == BOARD_EVK1101)
#include
"EVK1101/Joystick.h"
#else
#include
"Board/Joystick.h"
#endif
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
/** Initialises the joystick driver so that the joystick position can be read. This sets the appropriate
* I/O pins to inputs with their pull-ups enabled.
*/
static
inline
void
Joystick_Init
(
void
);
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
/** Initialises the joystick driver so that the joystick position can be read. This sets the appropriate
* I/O pins to inputs with their pull-ups enabled.
*/
static
inline
void
Joystick_Init
(
void
);
/** Returns the current status of the joystick, as a mask indicating the direction the joystick is
* currently facing in (multiple bits can be set).
*
* \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file
* for direction masks.
*/
static
inline
uint
8
_t
Joystick_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
#endif
/** Returns the current status of the joystick, as a mask indicating the direction the joystick is
* currently facing in (multiple bits can be set).
*
* \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file
* for direction masks.
*/
static
inline
uint
_reg
_t
Joystick_GetStatus
(
void
)
ATTR_WARN_UNUSED_RESULT
;
#endif
#endif
...
...
LUFA/Drivers/Board/LEDs.h
View file @
a318f32b
...
...
@@ -199,20 +199,20 @@
*
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/
static
inline
void
LEDs_TurnOnLEDs
(
const
uint
8
_t
LEDMask
);
static
inline
void
LEDs_TurnOnLEDs
(
const
uint
_reg
_t
LEDMask
);
/** Turns off the LEDs specified in the given LED mask.
*
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/
static
inline
void
LEDs_TurnOffLEDs
(
const
uint
8
_t
LEDMask
);
static
inline
void
LEDs_TurnOffLEDs
(
const
uint
_reg
_t
LEDMask
);
/** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED
* mask.
*
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/
static
inline
void
LEDs_SetAllLEDs
(
const
uint
8
_t
LEDMask
);
static
inline
void
LEDs_SetAllLEDs
(
const
uint
_reg
_t
LEDMask
);
/** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs
* specified in both the LED and active masks.
...
...
@@ -220,21 +220,21 @@
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
* \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off.
*/
static
inline
void
LEDs_ChangeLEDs
(
const
uint
8
_t
LEDMask
,
const
uint
8
_t
ActiveMask
);
static
inline
void
LEDs_ChangeLEDs
(
const
uint
_reg
_t
LEDMask
,
const
uint
_reg
_t
ActiveMask
);
/** Toggles all LEDs in the LED mask, leaving all others in their current states.
*
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/
static
inline
void
LEDs_ToggleLEDs
(
const
uint
8
_t
LEDMask
);
static
inline
void
LEDs_ToggleLEDs
(
const
uint
_reg
_t
LEDMask
);
/** Returns the status of all the board LEDs; set LED masks in the return value indicate that the
* corresponding LED is on.
*
* \return Mask of the board LEDs which are currently turned on.
*/
static
inline
uint
8
_t
LEDs_GetLEDs
(
void
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint
_reg
_t
LEDs_GetLEDs
(
void
)
ATTR_WARN_UNUSED_RESULT
;
#endif
#endif
...
...
LUFA/Drivers/Board/Temperature.c
View file @
a318f32b
...
...
@@ -30,18 +30,19 @@
#include
"Temperature.h"
static
const
uint16_t
PROGMEM
Temperature_Lookup
[
TEMP_TABLE_SIZE
]
=
{
0x3B4
,
0x3B0
,
0x3AB
,
0x3A6
,
0x3A0
,
0x39A
,
0x394
,
0x38E
,
0x388
,
0x381
,
0x37A
,
0x373
,
0x36B
,
0x363
,
0x35B
,
0x353
,
0x34A
,
0x341
,
0x338
,
0x32F
,
0x325
,
0x31B
,
0x311
,
0x307
,
0x2FC
,
0x2F1
,
0x2E6
,
0x2DB
,
0x2D0
,
0x2C4
,
0x2B8
,
0x2AC
,
0x2A0
,
0x294
,
0x288
,
0x27C
,
0x26F
,
0x263
,
0x256
,
0x24A
,
0x23D
,
0x231
,
0x225
,
0x218
,
0x20C
,
0x200
,
0x1F3
,
0x1E7
,
0x1DB
,
0x1CF
,
0x1C4
,
0x1B8
,
0x1AC
,
0x1A1
,
0x196
,
0x18B
,
0x180
,
0x176
,
0x16B
,
0x161
,
0x157
,
0x14D
,
0x144
,
0x13A
,
0x131
,
0x128
,
0x11F
,
0x117
,
0x10F
,
0x106
,
0x0FE
,
0x0F7
,
0x0EF
,
0x0E8
,
0x0E1
,
0x0DA
,
0x0D3
,
0x0CD
,
0x0C7
,
0x0C0
,
0x0BA
,
0x0B5
,
0x0AF
,
0x0AA
,
0x0A4
,
0x09F
,
0x09A
,
0x096
,
0x091
,
0x08C
,
0x088
,
0x084
,
0x080
,
0x07C
,
0x078
,
0x074
,
0x071
,
0x06D
,
0x06A
,
0x067
,
0x064
,
0x061
,
0x05E
,
0x05B
,
0x058
,
0x055
,
0x053
,
0x050
,
0x04E
,
0x04C
,
0x049
,
0x047
,
0x045
,
0x043
,
0x041
,
0x03F
,
0x03D
,
0x03C
,
0x03A
,
0x038
};
static
const
uint16_t
PROGMEM
Temperature_Lookup
[
TEMP_TABLE_SIZE
]
=
{
0x3B4
,
0x3B0
,
0x3AB
,
0x3A6
,
0x3A0
,
0x39A
,
0x394
,
0x38E
,
0x388
,
0x381
,
0x37A
,
0x373
,
0x36B
,
0x363
,
0x35B
,
0x353
,
0x34A
,
0x341
,
0x338
,
0x32F
,
0x325
,
0x31B
,
0x311
,
0x307
,
0x2FC
,
0x2F1
,
0x2E6
,
0x2DB
,
0x2D0
,
0x2C4
,
0x2B8
,
0x2AC
,
0x2A0
,
0x294
,
0x288
,
0x27C
,
0x26F
,
0x263
,
0x256
,
0x24A
,
0x23D
,
0x231
,
0x225
,
0x218
,
0x20C
,
0x200
,
0x1F3
,
0x1E7
,
0x1DB
,
0x1CF
,
0x1C4
,
0x1B8
,
0x1AC
,
0x1A1
,
0x196
,
0x18B
,
0x180
,
0x176
,
0x16B
,
0x161
,
0x157
,
0x14D
,
0x144
,
0x13A
,
0x131
,
0x128
,
0x11F
,
0x117
,
0x10F
,
0x106
,
0x0FE
,
0x0F7
,
0x0EF
,
0x0E8
,
0x0E1
,
0x0DA
,
0x0D3
,
0x0CD
,
0x0C7
,
0x0C0
,
0x0BA
,
0x0B5
,
0x0AF
,
0x0AA
,
0x0A4
,
0x09F
,
0x09A
,
0x096
,
0x091
,
0x08C
,
0x088
,
0x084
,
0x080
,
0x07C
,
0x078
,
0x074
,
0x071
,
0x06D
,
0x06A
,
0x067
,
0x064
,
0x061
,
0x05E
,
0x05B
,
0x058
,
0x055
,
0x053
,
0x050
,
0x04E
,
0x04C
,
0x049
,
0x047
,
0x045
,
0x043
,
0x041
,
0x03F
,
0x03D
,
0x03C
,
0x03A
,
0x038
};
int8_t
Temperature_GetTemperature
(
void
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment