diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-07-02 03:06:16 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-07-02 03:06:16 +0000 |
commit | 31a34154dbbc20adc523eb08678977d218ae8135 (patch) | |
tree | 613bc0069075d8a365a07f60159f2d784c387e1d /Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c | |
parent | fbabecee66b93596acc6f99a92be4a9dd3a750ce (diff) | |
download | lufa-31a34154dbbc20adc523eb08678977d218ae8135.tar.gz lufa-31a34154dbbc20adc523eb08678977d218ae8135.tar.bz2 lufa-31a34154dbbc20adc523eb08678977d218ae8135.zip |
Move out RFCOMM channel structure init code to a seperate routine, to save on compiled code space and to prevent copy-paste errors.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c')
-rw-r--r-- | Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c index 2495bb49e..e5bce54d2 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c @@ -195,23 +195,8 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader /* Check if the channel has no corresponding entry - remote did not open it first */
if (RFCOMMChannel == NULL)
{
- /* Find a free entry in the RFCOMM channel multiplexer state array */
- for (uint8_t i = 0; i < RFCOMM_MAX_OPEN_CHANNELS; i++)
- {
- /* If the channel's state is closed, the channel state entry is free */
- if (RFCOMM_Channels[i].State == RFCOMM_Channel_Closed)
- {
- RFCOMMChannel = &RFCOMM_Channels[i];
- RFCOMMChannel->DLCI = Params->DLCI;
- RFCOMMChannel->MTU = 0xFFFF;
- RFCOMMChannel->Remote.Signals = 0 | (1 << 0);
- RFCOMMChannel->Remote.BreakSignal = 0 | (1 << 0);
- RFCOMMChannel->Local.Signals = RFCOMM_SIGNAL_RTC | RFCOMM_SIGNAL_RTR | RFCOMM_SIGNAL_DV | (1 << 0);
- RFCOMMChannel->Local.BreakSignal = 0 | (1 << 0);
- RFCOMMChannel->ConfigFlags = 0;
- break;
- }
- }
+ /* Create a new entry in the channel table for the new channel */
+ RFCOMMChannel = RFCOMM_GetFreeChannelEntry(Params->DLCI);
/* No free entry was found, discard the request */
if (RFCOMMChannel == NULL)
|