diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-04-05 08:09:12 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-04-05 08:09:12 +0000 |
commit | fa1a092901319b3b41bf09e0c4cb9cbbec470d6b (patch) | |
tree | aa75acf5f00faa999f4622ce8754fe713d312b23 /Projects | |
parent | fd96b288824caaa3ee4e5e03887f016de9df80cf (diff) | |
download | lufa-fa1a092901319b3b41bf09e0c4cb9cbbec470d6b.tar.gz lufa-fa1a092901319b3b41bf09e0c4cb9cbbec470d6b.tar.bz2 lufa-fa1a092901319b3b41bf09e0c4cb9cbbec470d6b.zip |
Add user callback function to the Bluetooth host demo to filter out connections from remote devices. Add in ability to reject connections based on their bluetooth device address.
Clean up RelayBoard project code.
Make AVRISP project clear the XMEGA target's reset register twice; this does not appear to take affect properly the first time under some circumstances.
Diffstat (limited to 'Projects')
-rw-r--r-- | Projects/AVRISP-MKII/Descriptors.h | 2 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c | 4 | ||||
-rw-r--r-- | Projects/RelayBoard/RelayBoard.c | 36 |
3 files changed, 25 insertions, 17 deletions
diff --git a/Projects/AVRISP-MKII/Descriptors.h b/Projects/AVRISP-MKII/Descriptors.h index 9f6a41208..3a4828364 100644 --- a/Projects/AVRISP-MKII/Descriptors.h +++ b/Projects/AVRISP-MKII/Descriptors.h @@ -42,7 +42,7 @@ #include <LUFA/Drivers/USB/USB.h>
/* Macros: */
- #if !defined(WIN_LIBUSB_COMPAT)
+ #if !defined(LIBUSB_FILTERDRV_COMPAT)
/** Endpoint number of the AVRISP data OUT endpoint. */
#define AVRISP_DATA_OUT_EPNUM 2
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c index ef86e30f2..cc521ce87 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c @@ -179,6 +179,10 @@ static void XPROGProtocol_LeaveXPROGMode(void) XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
XPROGTarget_SendByte(0x00);
+ /* Do it twice to make sure it takes affect (silicon bug?) */
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(0x00);
+
XPROGTarget_DisableTargetPDI();
}
else
diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c index 0936c4d7e..a496679ae 100644 --- a/Projects/RelayBoard/RelayBoard.c +++ b/Projects/RelayBoard/RelayBoard.c @@ -77,8 +77,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) /** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_Device_UnhandledControlRequest(void)
{
- const uint8_t serial[5] = { 0, 0, 0, 0, 1 };
- uint8_t data[2] = { 0, 0 };
+ const uint8_t SerialNumber[5] = { 0, 0, 0, 0, 1 };
+ uint8_t ControlData[2] = { 0, 0 };
switch (USB_ControlRequest.bRequest)
{
@@ -89,20 +89,22 @@ void EVENT_USB_Device_UnhandledControlRequest(void) Endpoint_ClearSETUP();
- Endpoint_Read_Control_Stream_LE(data, sizeof(data));
+ Endpoint_Read_Control_Stream_LE(ControlData, sizeof(ControlData));
Endpoint_ClearIN();
switch (USB_ControlRequest.wValue)
{
case 0x303:
- if (data[1]) PORTC &= ~RELAY1; else PORTC |= RELAY1; break;
+ if (ControlData[1]) PORTC &= ~RELAY1; else PORTC |= RELAY1;
+ break;
case 0x306:
- if (data[1]) PORTC &= ~RELAY2; else PORTC |= RELAY2; break;
+ if (ControlData[1]) PORTC &= ~RELAY2; else PORTC |= RELAY2;
+ break;
case 0x309:
- if (data[1]) PORTC &= ~RELAY3; else PORTC |= RELAY3; break;
+ if (ControlData[1]) PORTC &= ~RELAY3; else PORTC |= RELAY3;
+ break;
case 0x30c:
- if (data[1]) PORTC &= ~RELAY4; else PORTC |= RELAY4; break;
- default:
+ if (ControlData[1]) PORTC &= ~RELAY4; else PORTC |= RELAY4;
break;
}
}
@@ -118,22 +120,24 @@ void EVENT_USB_Device_UnhandledControlRequest(void) switch (USB_ControlRequest.wValue)
{
case 0x301:
- Endpoint_Write_Control_Stream_LE(serial, sizeof(serial));
+ Endpoint_Write_Control_Stream_LE(SerialNumber, sizeof(SerialNumber));
break;
case 0x303:
- if (PORTC & RELAY1) data[1] = 2; else data[1] = 3; break;
+ ControlData[1] = (PORTC & RELAY1) ? 2 : 3;
+ break;
case 0x306:
- if (PORTC & RELAY2) data[1] = 2; else data[1] = 3; break;
+ ControlData[1] = (PORTC & RELAY2) ? 2 : 3;
+ break;
case 0x309:
- if (PORTC & RELAY3) data[1] = 2; else data[1] = 3; break;
+ ControlData[1] = (PORTC & RELAY3) ? 2 : 3;
+ break;
case 0x30c:
- if (PORTC & RELAY4) data[1] = 2; else data[1] = 3; break;
- default:
+ ControlData[1] = (PORTC & RELAY4) ? 2 : 3;
break;
}
- if (data[1])
- Endpoint_Write_Control_Stream_LE(data, sizeof(data));
+ if (ControlData[1])
+ Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData));
Endpoint_ClearOUT();
}
|