forked from mfulz_github/qmk_firmware
Update board driver common APIs to use uint_reg_t.
This commit is contained in:
parent
86be7f9330
commit
a318f32b31
LUFA
|
@ -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
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
*
|
||||
* \return Mask indicating which board buttons are currently pressed.
|
||||
*/
|
||||
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint_reg_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -86,8 +86,8 @@
|
|||
AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
|
||||
}
|
||||
|
||||
static inline uintN_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uintN_t Buttons_GetStatus(void)
|
||||
static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint32_t Buttons_GetStatus(void)
|
||||
{
|
||||
return (~(AVR32_GPIO.port[JOY_MOVE_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2)));
|
||||
}
|
||||
|
|
|
@ -102,10 +102,10 @@
|
|||
AVR32_GPIO.port[JOY_PRESS_PORT].puers = JOY_PRESS_MASK;
|
||||
};
|
||||
|
||||
static inline uintN_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uintN_t Joystick_GetStatus(void)
|
||||
static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint32_t Joystick_GetStatus(void)
|
||||
{
|
||||
return (uintN_t)(~(((AVR32_GPIO.port[JOY_MOVE_PORT].pvr & JOY_MOVE_MASK) |
|
||||
return (uint32_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
|
||||
|
|
|
@ -98,23 +98,23 @@
|
|||
AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOnLEDs(const uintN_t LedMask)
|
||||
static inline void LEDs_TurnOnLEDs(const uint32_t LedMask)
|
||||
{
|
||||
AVR32_GPIO.port[LEDS_PORT].ovrc = LedMask;
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uintN_t LedMask)
|
||||
static inline void LEDs_TurnOffLEDs(const uint32_t LedMask)
|
||||
{
|
||||
AVR32_GPIO.port[LEDS_PORT].ovrs = LedMask;
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uintN_t LedMask)
|
||||
static inline void LEDs_SetAllLEDs(const uint32_t LedMask)
|
||||
{
|
||||
AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS;
|
||||
AVR32_GPIO.port[LEDS_PORT].ovrc = LedMask;
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uintN_t LedMask, const uintN_t ActiveMask)
|
||||
static inline void LEDs_ChangeLEDs(const uint32_t LedMask, const uint32_t ActiveMask)
|
||||
{
|
||||
AVR32_GPIO.port[LEDS_PORT].ovrs = LedMask;
|
||||
AVR32_GPIO.port[LEDS_PORT].ovrc = ActiveMask;
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
* \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file
|
||||
* for direction masks.
|
||||
*/
|
||||
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint_reg_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 uint8_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 uint8_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 uint8_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 uint8_t LEDMask,
|
||||
const uint8_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 uint8_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 uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint_reg_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
#include "Temperature.h"
|
||||
|
||||
static const uint16_t PROGMEM Temperature_Lookup[TEMP_TABLE_SIZE] = {
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue