Added new LEDs_Disable(), Buttons_Disable() and Joystick_Disable() functions to the board hardware drivers.

pull/1469/head
Dean Camera 13 years ago
parent a147cee95f
commit 5563da6a62

@ -67,6 +67,11 @@
// 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 void Buttons_Disable(void)
{
// TODO: Clear the appropriate port pins as high impedance inputs here
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -79,6 +79,11 @@
// TODO: Initialize joystick port pins as inputs with pull-ups // TODO: Initialize joystick port pins as inputs with pull-ups
} }
static inline void Joystick_Disable(void)
{
// TODO: Clear the joystick pins as high impedance inputs here
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uint8_t Joystick_GetStatus(void)
{ {

@ -82,6 +82,11 @@
// 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_Disable(void)
{
// TODO: Clear the LED port pins as high impedance inputs here
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_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

@ -16,6 +16,7 @@
* - Added new Android Accessory Host class driver * - Added new Android Accessory Host class driver
* - Added new USB_Host_GetDescriptor(), USB_Host_GetDeviceConfiguration() and USB_Host_GetInterfaceAltSetting() functions * - Added new USB_Host_GetDescriptor(), USB_Host_GetDeviceConfiguration() and USB_Host_GetInterfaceAltSetting() functions
* - Added new CALLBACK_Audio_Device_GetSetInterfaceProperty() callback to the Audio Device Class driver * - Added new CALLBACK_Audio_Device_GetSetInterfaceProperty() callback to the Audio Device Class driver
* - Added new LEDs_Disable(), Buttons_Disable() and Joystick_Disable() functions to the board hardware drivers
* - Library Applications: * - Library Applications:
* - Added User Application APIs to the CDC and DFU class bootloaders * - Added User Application APIs to the CDC and DFU class bootloaders
* - Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs) * - Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs)

@ -80,6 +80,12 @@
PORTE &= ~LEDS_ALL_LEDS; PORTE &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRE &= ~LEDS_ALL_LEDS;
PORTE &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTE |= LEDMask; PORTE |= LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -92,6 +92,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= (LEDMask & LEDS_ALL_LEDS); PORTD |= (LEDMask & LEDS_ALL_LEDS);

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -83,6 +83,12 @@
PORTC |= LEDS_ALL_LEDS; PORTC |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRC &= ~LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTC &= ~LEDMask; PORTC &= ~LEDMask;

@ -83,6 +83,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;

@ -83,6 +83,13 @@
static inline void LEDs_Init(void) static inline void LEDs_Init(void)
{ {
DDRC |= LEDS_ALL_LEDS; DDRC |= LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_Disable(void)
{
DDRC &= ~LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)

@ -76,6 +76,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -94,6 +94,12 @@
PORTD |= JOY_MASK; PORTD |= JOY_MASK;
} }
static inline void Joystick_Disable(void)
{
DDRD &= ~JOY_MASK;
PORTD &= ~JOY_MASK;
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uint8_t Joystick_GetStatus(void)
{ {

@ -91,6 +91,12 @@
PORTB &= ~LEDS_ALL_LEDS; PORTB &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRB &= ~LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
{ {
PORTB |= LedMask; PORTB |= LedMask;

@ -74,6 +74,12 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -80,6 +80,12 @@
PORTE &= ~LEDS_ALL_LEDS; PORTE &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRE &= ~LEDS_ALL_LEDS;
PORTE &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTE |= LEDMask; PORTE |= LEDMask;

@ -74,6 +74,12 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -91,13 +91,22 @@
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
static inline void Joystick_Init(void) static inline void Joystick_Init(void)
{ {
DDRF &= ~(JOY_FMASK); DDRF &= ~JOY_FMASK;
DDRC &= ~(JOY_CMASK); DDRC &= ~JOY_CMASK;
PORTF |= JOY_FMASK; PORTF |= JOY_FMASK;
PORTC |= JOY_CMASK; PORTC |= JOY_CMASK;
} }
static inline void Joystick_Disable(void)
{
DDRF &= ~JOY_FMASK;
DDRC &= ~JOY_CMASK;
PORTF &= ~JOY_FMASK;
PORTC &= ~JOY_CMASK;
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uint8_t Joystick_GetStatus(void)
{ {

@ -86,6 +86,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -80,6 +80,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;

@ -83,6 +83,12 @@
PORTB &= ~LEDS_ALL_LEDS; PORTB &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRB &= ~LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTB |= LEDMask; PORTB |= LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -80,6 +80,12 @@
PORTD |= LEDS_ALL_LEDS; PORTD |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -83,6 +83,12 @@
PORTD |= LEDS_ALL_LEDS; PORTD |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -80,6 +80,12 @@
PORTD |= LEDS_ALL_LEDS; PORTD |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;

@ -102,6 +102,15 @@
PORTE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); PORTE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT);
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_PORTD_LEDS;
PORTD &= ~LEDS_PORTD_LEDS;
DDRE &= ~(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 uint8_t LEDMask)
{ {
PORTD |= (LEDMask & LEDS_LED1); PORTD |= (LEDMask & LEDS_LED1);

@ -80,6 +80,12 @@
PORTB |= LEDS_ALL_LEDS; PORTB |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRB &= ~LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTB &= ~LEDMask; PORTB &= ~LEDMask;

@ -74,6 +74,12 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -91,13 +91,22 @@
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
static inline void Joystick_Init(void) static inline void Joystick_Init(void)
{ {
DDRB &= ~(JOY_BMASK); DDRB &= ~JOY_BMASK;
DDRE &= ~(JOY_EMASK); DDRE &= ~JOY_EMASK;
PORTB |= JOY_BMASK; PORTB |= JOY_BMASK;
PORTE |= JOY_EMASK; PORTE |= JOY_EMASK;
} }
static inline void Joystick_Disable(void)
{
DDRB &= ~JOY_BMASK;
DDRE &= ~JOY_EMASK;
PORTB &= ~JOY_BMASK;
PORTE &= ~JOY_EMASK;
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uint8_t Joystick_GetStatus(void)
{ {

@ -89,6 +89,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -93,6 +93,13 @@
PORTB |= JOY_BMASK; PORTB |= JOY_BMASK;
} }
static inline void Joystick_Disable(void)
{
DDRB &= ~JOY_BMASK;
PORTB &= ~JOY_BMASK;
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uint8_t Joystick_GetStatus(void)
{ {

@ -89,6 +89,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;

@ -94,6 +94,12 @@
#endif #endif
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
#if (BOARD == BOARD_TEENSY2) #if (BOARD == BOARD_TEENSY2)

@ -74,6 +74,12 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -80,6 +80,12 @@
PORTF &= ~LEDS_ALL_LEDS; PORTF &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRF &= ~LEDS_ALL_LEDS;
PORTF &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTF |= LEDMask; PORTF |= LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -98,6 +98,12 @@
DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
} }
static inline void LEDs_Disable(void)
{
DDRB &= ~LEDS_PORTB_LEDS;
DDRD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTB |= (LEDMask & LEDS_PORTB_LEDS); PORTB |= (LEDMask & LEDS_PORTB_LEDS);

@ -83,6 +83,12 @@
PORTD |= LEDS_ALL_LEDS; PORTD |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;

@ -83,6 +83,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -104,6 +104,17 @@
#endif #endif
} }
static inline void LEDs_Disable(void)
{
#if (BOARD == BOARD_USB2AX)
DDRC &= ~LEDS_ALL_LEDS;
PORTC &= ~LEDS_ALL_LEDS;
#else
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
#endif
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
#if (BOARD == BOARD_USB2AX) #if (BOARD == BOARD_USB2AX)

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -80,6 +80,12 @@
PORTD |= LEDS_ALL_LEDS; PORTD |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD &= ~LEDMask; PORTD &= ~LEDMask;

@ -74,6 +74,12 @@
PORTE |= BUTTONS_BUTTON1; PORTE |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRE &= ~BUTTONS_BUTTON1;
PORTE &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -91,13 +91,22 @@
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
static inline void Joystick_Init(void) static inline void Joystick_Init(void)
{ {
DDRB &= ~(JOY_BMASK); DDRB &= ~JOY_BMASK;
DDRE &= ~(JOY_EMASK); DDRE &= ~JOY_EMASK;
PORTB |= JOY_BMASK; PORTB |= JOY_BMASK;
PORTE |= JOY_EMASK; PORTE |= JOY_EMASK;
} }
static inline void Joystick_Disable(void)
{
DDRB &= ~JOY_BMASK;
DDRE &= ~JOY_EMASK;
PORTB &= ~JOY_BMASK;
PORTE &= ~JOY_EMASK;
}
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void) static inline uint8_t Joystick_GetStatus(void)
{ {

@ -89,6 +89,12 @@
PORTD &= ~LEDS_ALL_LEDS; PORTD &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRD &= ~LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTD |= LEDMask; PORTD |= LEDMask;

@ -74,6 +74,12 @@
PORTD |= BUTTONS_BUTTON1; PORTD |= BUTTONS_BUTTON1;
} }
static inline void Buttons_Disable(void)
{
DDRD &= ~BUTTONS_BUTTON1;
PORTD &= ~BUTTONS_BUTTON1;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -86,6 +86,12 @@
PORTB &= ~LEDS_ALL_LEDS; PORTB &= ~LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRB &= ~LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
{ {
PORTB |= LedMask; PORTB |= LedMask;

@ -87,6 +87,12 @@
PORTB |= LEDS_ALL_LEDS; PORTB |= LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
DDRB &= ~LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTB &= ~LEDMask; PORTB &= ~LEDMask;

@ -141,13 +141,16 @@
/* Pseudo-Functions for Doxygen: */ /* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Initializes the BUTTONS driver, so that the current button position can be read. This sets the appropriate /** Initializes 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. * I/O pins to an inputs with pull-ups enabled.
* *
* This must be called before any Button driver functions are used. * This must be called before any Button driver functions are used.
*/ */
static inline void Buttons_Init(void); static inline void Buttons_Init(void);
/** Disables the buttons driver, releasing the I/O pins back to their default high-impedence input mode. */
static inline void Buttons_Disable(void);
/** Returns a mask indicating which board buttons are currently pressed. /** Returns a mask indicating which board buttons are currently pressed.
* *
* \return Mask indicating which board buttons are currently pressed. * \return Mask indicating which board buttons are currently pressed.

@ -126,6 +126,9 @@
*/ */
static inline void Joystick_Init(void); static inline void Joystick_Init(void);
/** Disables the joystick driver, releasing the I/O pins back to their default high-impedence input mode. */
static inline void Joystick_Disable(void);
/** Returns the current status of the joystick, as a mask indicating the direction the joystick is /** Returns the current status of the joystick, as a mask indicating the direction the joystick is
* currently facing in (multiple bits can be set). * currently facing in (multiple bits can be set).
* *

@ -205,6 +205,9 @@
*/ */
static inline void LEDs_Init(void); static inline void LEDs_Init(void);
/** Disables the board LED driver, releasing the I/O pins back to their default high-impedence input mode. */
static inline void LEDs_Disable(void);
/** Turns on the LEDs specified in the given LED mask. /** Turns on 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). * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).

@ -86,6 +86,12 @@
AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
} }
static inline void Buttons_Disable(void)
{
AVR32_GPIO.port[BUTTONS_PORT].gperc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
AVR32_GPIO.port[BUTTONS_PORT].puerc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
}
static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint32_t Buttons_GetStatus(void) static inline uint32_t Buttons_GetStatus(void)
{ {

@ -93,6 +93,12 @@
AVR32_GPIO.port[JOY_PORT].gpers = JOY_MASK; AVR32_GPIO.port[JOY_PORT].gpers = JOY_MASK;
}; };
static inline void Joystick_Disable(void)
{
AVR32_GPIO.port[JOY_PORT].gperc = JOY_MASK;
AVR32_GPIO.port[JOY_PORT].gperc = JOY_MASK;
};
static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint32_t Joystick_GetStatus(void) static inline uint32_t Joystick_GetStatus(void)
{ {

@ -109,6 +109,13 @@
AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS; AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
AVR32_GPIO.port[LEDS_PORT].gperc = LEDS_ALL_LEDS;
AVR32_GPIO.port[LEDS_PORT].oderc = LEDS_ALL_LEDS;
AVR32_GPIO.port[LEDS_PORT].ovrc = LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask)
{ {
AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask; AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask;

@ -83,6 +83,12 @@
AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
} }
static inline void Buttons_Disable(void)
{
AVR32_GPIO.port[BUTTONS_PORT].gperc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
AVR32_GPIO.port[BUTTONS_PORT].puerc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
}
static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint32_t Buttons_GetStatus(void) static inline uint32_t Buttons_GetStatus(void)
{ {

@ -98,6 +98,15 @@
AVR32_GPIO.port[JOY_PRESS_PORT].puers = JOY_PRESS_MASK; AVR32_GPIO.port[JOY_PRESS_PORT].puers = JOY_PRESS_MASK;
}; };
static inline void Joystick_Disable(void)
{
AVR32_GPIO.port[JOY_MOVE_PORT].gperc = JOY_MOVE_MASK;
AVR32_GPIO.port[JOY_PRESS_PORT].gperc = JOY_PRESS_MASK;
AVR32_GPIO.port[JOY_MOVE_PORT].puerc = JOY_MOVE_MASK;
AVR32_GPIO.port[JOY_PRESS_PORT].puerc = JOY_PRESS_MASK;
};
static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint32_t Joystick_GetStatus(void) static inline uint32_t Joystick_GetStatus(void)
{ {

@ -96,6 +96,13 @@
AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS; AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
AVR32_GPIO.port[LEDS_PORT].gperc = LEDS_ALL_LEDS;
AVR32_GPIO.port[LEDS_PORT].oderc = LEDS_ALL_LEDS;
AVR32_GPIO.port[LEDS_PORT].ovrc = LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask)
{ {
AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask; AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask;

@ -80,6 +80,12 @@
AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
} }
static inline void Buttons_Disable(void)
{
AVR32_GPIO.port[BUTTONS_PORT].gperc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
AVR32_GPIO.port[BUTTONS_PORT].puerc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);
}
static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint32_t Buttons_GetStatus(void) static inline uint32_t Buttons_GetStatus(void)
{ {

@ -101,6 +101,17 @@
AVR32_GPIO.port[3].ovrs = LEDS_LEDMASK3; AVR32_GPIO.port[3].ovrs = LEDS_LEDMASK3;
} }
static inline void LEDs_Disable(void)
{
AVR32_GPIO.port[2].gperc = LEDS_LEDMASK2;
AVR32_GPIO.port[2].oderc = LEDS_LEDMASK2;
AVR32_GPIO.port[2].ovrc = LEDS_LEDMASK2;
AVR32_GPIO.port[3].gperc = LEDS_LEDMASK3;
AVR32_GPIO.port[3].oderc = LEDS_LEDMASK3;
AVR32_GPIO.port[3].ovrc = LEDS_LEDMASK3;
}
static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask)
{ {
AVR32_GPIO.port[2].ovrc = (LEDMask & LEDS_LEDMASK2); AVR32_GPIO.port[2].ovrc = (LEDMask & LEDS_LEDMASK2);

@ -84,6 +84,16 @@
PORTF_PIN2CTRL = PORT_OPC_PULLUP_gc; PORTF_PIN2CTRL = PORT_OPC_PULLUP_gc;
} }
static inline void Buttons_Disable(void)
{
PORTE_OUTCLR = BUTTONS_BUTTON1;
PORTF_OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3);
PORTE_PIN5CTRL = 0;
PORTF_PIN1CTRL = 0;
PORTF_PIN2CTRL = 0;
}
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Buttons_GetStatus(void) static inline uint8_t Buttons_GetStatus(void)
{ {

@ -83,6 +83,12 @@
PORTR_OUTSET = LEDS_ALL_LEDS; PORTR_OUTSET = LEDS_ALL_LEDS;
} }
static inline void LEDs_Disable(void)
{
PORTR_DIRCLR = LEDS_ALL_LEDS;
PORTR_OUTCLR = LEDS_ALL_LEDS;
}
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{ {
PORTR_OUTCLR = LEDMask; PORTR_OUTCLR = LEDMask;

Loading…
Cancel
Save