aboutsummaryrefslogtreecommitdiff
path: root/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
diff options
context:
space:
mode:
authorDean Camera <[email protected]>2010-04-06 08:14:08 +0000
committerDean Camera <[email protected]>2010-04-06 08:14:08 +0000
commitc77f136661ae0fa779c02ef6efeab95aa4b92068 (patch)
treef01814bcc62d2498f733bc954c364283c0b721aa /Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
parentb9c7d196152652df918a822522061c3fe193d273 (diff)
downloadqmk_firmware-c77f136661ae0fa779c02ef6efeab95aa4b92068.tar.gz
qmk_firmware-c77f136661ae0fa779c02ef6efeab95aa4b92068.zip
Add bidirectional channel configuration -- remote device is not ACKing sent Configuration Requests, needs further debugging. Implement Bluetooth spec's channel states.
Use abbreviations for the structure and function names where possible to try to cut down on the code verbosity.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
index 5da4d0b167..1d3d19908a 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
@@ -50,21 +50,20 @@ void Bluetooth_Stack_Init(void)
void Bluetooth_Stack_USBTask(void)
{
- Bluetooth_ProcessHCICommands();
- Bluetooth_ProcessACLPackets();
+ Bluetooth_HCITask();
+ Bluetooth_ACLTask();
}
Bluetooth_Channel_t* Bluetooth_GetChannelData(uint16_t ChannelNumber, bool SearchBySource)
{
for (uint8_t i = 0; i < BLUETOOTH_MAX_OPEN_CHANNELS; i++)
{
- Bluetooth_Channel_t* CurrentChannelStructure = &Bluetooth_Connection.Channels[i];
+ Bluetooth_Channel_t* ChannelData = &Bluetooth_Connection.Channels[i];
- uint16_t CurrentChannelNumber = (SearchBySource) ? CurrentChannelStructure->RemoteNumber :
- CurrentChannelStructure->LocalNumber;
+ uint16_t CurrentChannelNumber = (SearchBySource) ? ChannelData->RemoteNumber : ChannelData->LocalNumber;
if (CurrentChannelNumber == ChannelNumber)
- return CurrentChannelStructure;
+ return ChannelData;
}
return NULL;
@@ -74,16 +73,16 @@ Bluetooth_Channel_t* Bluetooth_InitChannelData(uint16_t RemoteChannelNumber, uin
{
for (uint8_t i = 0; i < BLUETOOTH_MAX_OPEN_CHANNELS; i++)
{
- Bluetooth_Channel_t* CurrentChannelStructure = &Bluetooth_Connection.Channels[i];
+ Bluetooth_Channel_t* ChannelData = &Bluetooth_Connection.Channels[i];
- if (CurrentChannelStructure->State == Channel_Closed)
+ if (ChannelData->State == Channel_Closed)
{
- CurrentChannelStructure->RemoteNumber = RemoteChannelNumber;
- CurrentChannelStructure->LocalNumber = (BLUETOOTH_CHANNELNUMBER_BASEOFFSET + i);
- CurrentChannelStructure->PSM = PSM;
- CurrentChannelStructure->State = Channel_Config;
+ ChannelData->RemoteNumber = RemoteChannelNumber;
+ ChannelData->LocalNumber = (BLUETOOTH_CHANNELNUMBER_BASEOFFSET + i);
+ ChannelData->PSM = PSM;
+ ChannelData->State = Channel_Config_WaitConfig;
- return CurrentChannelStructure;
+ return ChannelData;
}
}