Change over board hardware drivers to use the custom uintN_t and intN_t native word size types.

This commit is contained in:
Dean Camera 2010-02-22 12:58:40 +00:00
parent d2ed97e34b
commit 2590452104
26 changed files with 83 additions and 98 deletions

View File

@ -190,10 +190,16 @@
/* Type Defines: */ /* Type Defines: */
#if defined(__AVR32__) #if defined(__AVR32__)
/** Type define for an unsigned native word-sized chunk of data. */
typedef uint32_t uintN_t; typedef uint32_t uintN_t;
/** Type define for a signed native word-sized chunk of data. */
typedef int32_t intN_t; typedef int32_t intN_t;
#else #else
/** Type define for an unsigned native word-sized chunk of data. */
typedef uint8_t uintN_t; typedef uint8_t uintN_t;
/** Type define for a signed native word-sized chunk of data. */
typedef int8_t intN_t; typedef int8_t intN_t;
#endif #endif
#endif #endif

View File

@ -70,8 +70,7 @@
// TODO: Initialize the appropriate port pins as an inputs here, with pull-ups // TODO: Initialize the appropriate port pins as an inputs here, with pull-ups
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void)
static inline uint8_t Buttons_GetStatus(void)
{ {
// TODO: Return current button status here, debounced if required // TODO: Return current button status here, debounced if required
} }

View File

@ -82,8 +82,7 @@
// TODO: Initialize joystick port pins as inputs with pull-ups // TODO: Initialize joystick port pins as inputs with pull-ups
} }
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void)
static inline uint8_t Joystick_GetStatus(void)
{ {
// TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros // TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros
} }

View File

@ -84,33 +84,32 @@
// TODO: Add code to initialize LED port pins as outputs here // TODO: Add code to initialize LED port pins as outputs here
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
// TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is // TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
// TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is // TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
// TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off // TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
// TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here // TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
// TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others // TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
// TODO: Add code to return the current LEDs status' here which can be masked against LED_LED* macros // TODO: Add code to return the current LEDs status' here which can be masked against LED_LED* macros
} }

View File

@ -79,8 +79,7 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void)
static inline uint8_t Buttons_GetStatus(void)
{ {
return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
} }

View File

@ -96,33 +96,32 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTD |= (LEDMask & LEDS_ALL_LEDS); PORTD |= (LEDMask & LEDS_ALL_LEDS);
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTD &= ~(LEDMask & LEDS_ALL_LEDS); PORTD &= ~(LEDMask & LEDS_ALL_LEDS);
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD & ~LEDS_ALL_LEDS) | (LEDMask & LEDS_ALL_LEDS); PORTD = (PORTD & ~LEDS_ALL_LEDS) | (LEDMask & LEDS_ALL_LEDS);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS)); PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS)); PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
return (PORTD & LEDS_ALL_LEDS); return (PORTD & LEDS_ALL_LEDS);
} }

View File

@ -81,8 +81,7 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void)
static inline uint8_t Buttons_GetStatus(void)
{ {
return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
} }

View File

@ -98,8 +98,7 @@
PORTD |= JOY_MASK; PORTD |= JOY_MASK;
} }
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void)
static inline uint8_t Joystick_GetStatus(void)
{ {
return (uint8_t)(~PIND & JOY_MASK); return (uint8_t)(~PIND & JOY_MASK);
} }

View File

@ -95,28 +95,27 @@
PORTB &= ~LEDS_ALL_LEDS; PORTB &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) static inline void LEDs_TurnOnLEDs(const uintN_t LedMask)
{ {
PORTB |= LedMask; PORTB |= LedMask;
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LedMask) static inline void LEDs_TurnOffLEDs(const uintN_t LedMask)
{ {
PORTB &= ~LedMask; PORTB &= ~LedMask;
} }
static inline void LEDs_SetAllLEDs(const uint8_t LedMask) static inline void LEDs_SetAllLEDs(const uintN_t LedMask)
{ {
PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask); PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LedMask, const uintN_t ActiveMask)
{ {
PORTB = ((PORTB & ~LedMask) | ActiveMask); PORTB = ((PORTB & ~LedMask) | ActiveMask);
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
return (PORTB & LEDS_ALL_LEDS); return (PORTB & LEDS_ALL_LEDS);
} }

View File

@ -82,8 +82,7 @@
AVR32_GPIO.port[1].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); AVR32_GPIO.port[1].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
} }
static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void)
static inline uint32_t Buttons_GetStatus(void)
{ {
return (~AVR32_GPIO.port[1].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2)); return (~AVR32_GPIO.port[1].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2));
} }

View File

@ -99,8 +99,7 @@
AVR32_GPIO.port[1].puers = JOY_MASK_PB; AVR32_GPIO.port[1].puers = JOY_MASK_PB;
} }
static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void)
static inline uint32_t Joystick_GetStatus(void)
{ {
return ((~AVR32_GPIO.port[1].pvr & JOY_MASK_PB) | return ((~AVR32_GPIO.port[1].pvr & JOY_MASK_PB) |
(~AVR32_GPIO.port[0].pvr & JOY_MASK_PA)); (~AVR32_GPIO.port[0].pvr & JOY_MASK_PA));

View File

@ -94,35 +94,34 @@
AVR32_GPIO.port[0].ovrs = LEDS_ALL_LEDS; AVR32_GPIO.port[0].ovrs = LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
AVR32_GPIO.port[0].ovrc = LEDMask; AVR32_GPIO.port[0].ovrc = LEDMask;
} }
static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
AVR32_GPIO.port[0].ovrs = LEDMask; AVR32_GPIO.port[0].ovrs = LEDMask;
} }
static inline void LEDs_SetAllLEDs(const uint32_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
AVR32_GPIO.port[0].ovrs = LEDS_ALL_LEDS; AVR32_GPIO.port[0].ovrs = LEDS_ALL_LEDS;
AVR32_GPIO.port[0].ovrc = LEDMask; AVR32_GPIO.port[0].ovrc = LEDMask;
} }
static inline void LEDs_ChangeLEDs(const uint32_t LEDMask, const uint32_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
AVR32_GPIO.port[0].ovrs = LEDMask; AVR32_GPIO.port[0].ovrs = LEDMask;
AVR32_GPIO.port[0].ovrc = ActiveMask; AVR32_GPIO.port[0].ovrc = ActiveMask;
} }
static inline void LEDs_ToggleLEDs(const uint32_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
AVR32_GPIO.port[0].ovrt = LEDMask; AVR32_GPIO.port[0].ovrt = LEDMask;
} }
static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint32_t LEDs_GetLEDs(void)
{ {
return (AVR32_GPIO.port[0].ovr & LEDS_ALL_LEDS); return (AVR32_GPIO.port[0].ovr & LEDS_ALL_LEDS);
} }

View File

@ -85,8 +85,7 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void)
static inline uint8_t Buttons_GetStatus(void)
{ {
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
} }

View File

@ -68,7 +68,7 @@
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
/* Macros: */ /* Macros: */
#define JOY_FMASK ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)) #define JOY_FMASK ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7))
#define JOY_CMASK (1 << 6)) #define JOY_CMASK (1 << 6))
#endif #endif
@ -100,8 +100,7 @@
PORTC |= JOY_CMASK; PORTC |= JOY_CMASK;
} }
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void)
static inline uint8_t Joystick_GetStatus(void)
{ {
return (((uint8_t)~PINF & JOY_FMASK) | (((uint8_t)~PINC & JOY_CMASK) >> 3)); return (((uint8_t)~PINF & JOY_FMASK) | (((uint8_t)~PINC & JOY_CMASK) >> 3));
} }

View File

@ -90,32 +90,31 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTD = ((PORTD & ~LEDMask) | ActiveMask); PORTD = ((PORTD & ~LEDMask) | ActiveMask);
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS)); PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void) static inline uint8_t LEDs_GetLEDs(void)
{ {
return (PORTD & LEDS_ALL_LEDS); return (PORTD & LEDS_ALL_LEDS);

View File

@ -106,21 +106,21 @@
PORTE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); PORTE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT);
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTD |= (LEDMask & LEDS_LED1); PORTD |= (LEDMask & LEDS_LED1);
PORTD &= ~(LEDMask & LEDS_LED2); PORTD &= ~(LEDMask & LEDS_LED2);
PORTE &= ~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); PORTE &= ~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTD &= ~(LEDMask & LEDS_LED1); PORTD &= ~(LEDMask & LEDS_LED1);
PORTD |= (LEDMask & LEDS_LED2); PORTD |= (LEDMask & LEDS_LED2);
PORTE |= ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); PORTE |= ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTD = (((PORTD & ~LEDS_LED1) | (LEDMask & LEDS_LED1)) | PORTD = (((PORTD & ~LEDS_LED1) | (LEDMask & LEDS_LED1)) |
((PORTD | LEDS_LED2) & ~(LEDMask & LEDS_LED2))); ((PORTD | LEDS_LED2) & ~(LEDMask & LEDS_LED2)));
@ -128,7 +128,7 @@
~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)); ~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTD = (((PORTD & ~(LEDMask & LEDS_LED1)) | (ActiveMask & LEDS_LED1)) | PORTD = (((PORTD & ~(LEDMask & LEDS_LED1)) | (ActiveMask & LEDS_LED1)) |
((PORTD | (LEDMask & LEDS_LED2)) & ~(ActiveMask & LEDS_LED2))); ((PORTD | (LEDMask & LEDS_LED2)) & ~(ActiveMask & LEDS_LED2)));
@ -136,13 +136,12 @@
~((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)); ~((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD ^ (LEDMask & LEDS_PORTD_LEDS)); PORTD = (PORTD ^ (LEDMask & LEDS_PORTD_LEDS));
PORTE = (PORTE ^ ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)); PORTE = (PORTE ^ ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void) static inline uint8_t LEDs_GetLEDs(void)
{ {
return (((PORTD & LEDS_LED1) | (~PORTD & LEDS_LED2)) | return (((PORTD & LEDS_LED1) | (~PORTD & LEDS_LED2)) |

View File

@ -85,8 +85,7 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void)
static inline uint8_t Buttons_GetStatus(void)
{ {
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
} }

View File

@ -100,8 +100,7 @@
PORTE |= JOY_EMASK; PORTE |= JOY_EMASK;
} }
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void)
static inline uint8_t Joystick_GetStatus(void)
{ {
return (((uint8_t)~PINB & JOY_BMASK) | (((uint8_t)~PINE & JOY_EMASK) >> 1)); return (((uint8_t)~PINB & JOY_BMASK) | (((uint8_t)~PINE & JOY_EMASK) >> 1));
} }

View File

@ -93,33 +93,32 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTD = ((PORTD & ~LEDMask) | ActiveMask); PORTD = ((PORTD & ~LEDMask) | ActiveMask);
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS)); PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
return (PORTD & LEDS_ALL_LEDS); return (PORTD & LEDS_ALL_LEDS);
} }

View File

@ -85,8 +85,8 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uintN_t Buttons_GetStatus(void)
{ {
return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
} }

View File

@ -97,8 +97,8 @@
PORTB |= JOY_BMASK; PORTB |= JOY_BMASK;
} }
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uintN_t Joystick_GetStatus(void)
{ {
return ((uint8_t)~PINB & JOY_BMASK); return ((uint8_t)~PINB & JOY_BMASK);
} }

View File

@ -93,33 +93,32 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS)); PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS)); PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
return (PORTD & LEDS_ALL_LEDS); return (PORTD & LEDS_ALL_LEDS);
} }

View File

@ -79,8 +79,8 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uintN_t Buttons_GetStatus(void)
{ {
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
} }

View File

@ -100,8 +100,8 @@
PORTE |= JOY_EMASK; PORTE |= JOY_EMASK;
} }
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uintN_t Joystick_GetStatus(void)
{ {
return (((uint8_t)~PINB & JOY_BMASK) | (((uint8_t)~PINE & JOY_EMASK) >> 1)); return (((uint8_t)~PINB & JOY_BMASK) | (((uint8_t)~PINE & JOY_EMASK) >> 1));
} }

View File

@ -93,33 +93,32 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTD = ((PORTD & ~LEDMask) | ActiveMask); PORTD = ((PORTD & ~LEDMask) | ActiveMask);
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS)); PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
return (PORTD & LEDS_ALL_LEDS); return (PORTD & LEDS_ALL_LEDS);
} }

View File

@ -84,33 +84,32 @@
PORTB |= LEDS_ALL_LEDS; PORTB |= LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask)
{ {
PORTB &= ~LEDMask; PORTB &= ~LEDMask;
} }
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask)
{ {
PORTB |= LEDMask; PORTB |= LEDMask;
} }
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) static inline void LEDs_SetAllLEDs(const uintN_t LEDMask)
{ {
PORTB = ((PORTB | LEDS_ALL_LEDS) & ~LEDMask); PORTB = ((PORTB | LEDS_ALL_LEDS) & ~LEDMask);
} }
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask)
{ {
PORTB = ((PORTB | (LEDMask & LEDS_ALL_LEDS)) & (~ActiveMask & LEDS_ALL_LEDS)); PORTB = ((PORTB | (LEDMask & LEDS_ALL_LEDS)) & (~ActiveMask & LEDS_ALL_LEDS));
} }
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) static inline void LEDs_ToggleLEDs(const uintN_t LEDMask)
{ {
PORTD = (PORTB ^ (LEDMask & LEDS_ALL_LEDS)); PORTD = (PORTB ^ (LEDMask & LEDS_ALL_LEDS));
} }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uintN_t LEDs_GetLEDs(void)
static inline uint8_t LEDs_GetLEDs(void)
{ {
return (~PORTB & LEDS_ALL_LEDS); return (~PORTB & LEDS_ALL_LEDS);
} }