aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-06-12 07:03:22 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-06-12 07:03:22 +0000
commit931ca42a6efc88b31cd09cebc7c74b907dd5913d (patch)
tree952e61dd9b7c6f6e2dc8a269a6d9439e7215e6e8 /Demos/Host/Incomplete
parent75d440ace31c326dc80c84c3d346a425f43f1dd6 (diff)
downloadlufa-931ca42a6efc88b31cd09cebc7c74b907dd5913d.tar.gz
lufa-931ca42a6efc88b31cd09cebc7c74b907dd5913d.tar.bz2
lufa-931ca42a6efc88b31cd09cebc7c74b907dd5913d.zip
Minor fixes to demos to add in some missing comments, printf() formatting. Make incomplete Bluetooth demo indicate connections visually via the board LEDs.
Diffstat (limited to 'Demos/Host/Incomplete')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c4
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h3
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c8
3 files changed, 12 insertions, 3 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
index 1e75f477f..b7955f6ef 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
@@ -245,6 +245,8 @@ void Bluetooth_ConnectionComplete(void)
Bluetooth_Connection.RemoteAddress[5], Bluetooth_Connection.RemoteAddress[4],
Bluetooth_Connection.RemoteAddress[3], Bluetooth_Connection.RemoteAddress[2],
Bluetooth_Connection.RemoteAddress[1], Bluetooth_Connection.RemoteAddress[0]);
+
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
}
/** Bluetooth stack callback event for a completed Bluetooth disconnection. When this callback is made,
@@ -258,6 +260,8 @@ void Bluetooth_DisconnectionComplete(void)
Bluetooth_Connection.RemoteAddress[5], Bluetooth_Connection.RemoteAddress[4],
Bluetooth_Connection.RemoteAddress[3], Bluetooth_Connection.RemoteAddress[2],
Bluetooth_Connection.RemoteAddress[1], Bluetooth_Connection.RemoteAddress[0]);
+
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
/** Bluetooth stack callback event for a Bluetooth ACL Channel connection request. When is callback fires,
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
index ce7d1f500..b628f8b89 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
@@ -70,6 +70,9 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_USB_BUSY LEDS_LED2
+
/* Task Definitions: */
void Bluetooth_Host_Task(void);
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
index 46cc182ec..75fe17b08 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
@@ -73,6 +73,7 @@ void RFCOMM_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel)
const uint8_t* FrameData = (const uint8_t*)Data + sizeof(RFCOMM_Header_t);
uint16_t FrameDataLen = RFCOMM_GetFrameDataLength(FrameData);
+ /* Adjust the frame data pointer to skip over the variable size field */
FrameData += (FrameDataLen < 128) ? 1 : 2;
/* Decode the RFCOMM frame type from the header */
@@ -192,6 +193,8 @@ static void RFCOMM_ProcessControlCommand(const RFCOMM_Command_t* CommandHeader,
RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH, sizeof(RFCOMM_Command_t), &Response, Channel);
break;
+ default:
+ BT_RFCOMM_DEBUG(1, "<< Unknown Command");
}
}
@@ -242,11 +245,10 @@ static void RFCOMM_SendFrame(const uint8_t DLCI, const bool CommandResponse, con
static uint8_t RFCOMM_GetFCSValue(const void* FrameStart, uint8_t Length)
{
- const uint8_t* CurrPos = FrameStart;
- uint8_t FCS = 0xFF;
+ uint8_t FCS = 0xFF;
for (uint8_t i = 0; i < Length; i++)
- FCS = pgm_read_byte(&CRC8_Table[FCS ^ *(CurrPos++)]);
+ FCS = pgm_read_byte(&CRC8_Table[FCS ^ ((uint8_t*)FrameStart)[i]]);
return ~FCS;
}