mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Renamed BTD_NUMDEVICES to BTD_NUMSERVICES
This commit is contained in:
parent
9e51675c18
commit
c349327c88
2 changed files with 7 additions and 7 deletions
6
BTD.cpp
6
BTD.cpp
|
@ -293,7 +293,7 @@ void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
|
||||||
|
|
||||||
/* Performs a cleanup after failed Init() attempt */
|
/* Performs a cleanup after failed Init() attempt */
|
||||||
uint8_t BTD::Release() {
|
uint8_t BTD::Release() {
|
||||||
for (uint8_t i=0; i<BTD_NUMDEVICES; i++)
|
for (uint8_t i=0; i<BTD_NUMSERVICES; i++)
|
||||||
if (btService[i])
|
if (btService[i])
|
||||||
btService[i]->Reset(); // Reset all Bluetooth services
|
btService[i]->Reset(); // Reset all Bluetooth services
|
||||||
pUsb->GetAddressPool().FreeAddress(bAddress);
|
pUsb->GetAddressPool().FreeAddress(bAddress);
|
||||||
|
@ -600,7 +600,7 @@ void BTD::ACL_event_task() {
|
||||||
uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE;
|
uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE;
|
||||||
uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_DATAIN_PIPE ].epAddr, &MAX_BUFFER_SIZE, l2capinbuf); // input on endpoint 2
|
uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_DATAIN_PIPE ].epAddr, &MAX_BUFFER_SIZE, l2capinbuf); // input on endpoint 2
|
||||||
if(!rcode) { // Check for errors
|
if(!rcode) { // Check for errors
|
||||||
for (uint8_t i=0; i<BTD_NUMDEVICES; i++)
|
for (uint8_t i=0; i<BTD_NUMSERVICES; i++)
|
||||||
if (btService[i])
|
if (btService[i])
|
||||||
btService[i]->ACLData(l2capinbuf);
|
btService[i]->ACLData(l2capinbuf);
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ void BTD::ACL_event_task() {
|
||||||
PrintHex<uint8_t>(rcode);
|
PrintHex<uint8_t>(rcode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (uint8_t i=0; i<BTD_NUMDEVICES; i++)
|
for (uint8_t i=0; i<BTD_NUMSERVICES; i++)
|
||||||
if (btService[i])
|
if (btService[i])
|
||||||
btService[i]->Run();
|
btService[i]->Run();
|
||||||
}
|
}
|
||||||
|
|
8
BTD.h
8
BTD.h
|
@ -110,7 +110,7 @@
|
||||||
#define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface
|
#define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface
|
||||||
|
|
||||||
#define BTD_MAX_ENDPOINTS 4
|
#define BTD_MAX_ENDPOINTS 4
|
||||||
#define BTD_NUMDEVICES 7 // Max number of Bluetooth devices
|
#define BTD_NUMSERVICES 4 // Max number of Bluetooth devices
|
||||||
|
|
||||||
class BluetoothService { // All services should include this class
|
class BluetoothService { // All services should include this class
|
||||||
public:
|
public:
|
||||||
|
@ -136,14 +136,14 @@ public:
|
||||||
|
|
||||||
bool watingForConnection; // Use this to see if it is waiting for a incoming connection
|
bool watingForConnection; // Use this to see if it is waiting for a incoming connection
|
||||||
void disconnect() { // Used this void to disconnect all services
|
void disconnect() { // Used this void to disconnect all services
|
||||||
for (uint8_t i=0; i<BTD_NUMDEVICES; i++)
|
for (uint8_t i=0; i<BTD_NUMSERVICES; i++)
|
||||||
if (btService[i])
|
if (btService[i])
|
||||||
btService[i]->disconnect(); // Disconnect both the L2CAP Channel and the HCI Connection
|
btService[i]->disconnect(); // Disconnect both the L2CAP Channel and the HCI Connection
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Register bluetooth dongle members/services */
|
/* Register bluetooth dongle members/services */
|
||||||
uint8_t registerServiceClass(BluetoothService *pService) {
|
uint8_t registerServiceClass(BluetoothService *pService) {
|
||||||
for (uint8_t i=0; i<BTD_NUMDEVICES; i++) {
|
for (uint8_t i=0; i<BTD_NUMSERVICES; i++) {
|
||||||
if (!btService[i]) {
|
if (!btService[i]) {
|
||||||
btService[i] = pService;
|
btService[i] = pService;
|
||||||
return 0; // Success
|
return 0; // Success
|
||||||
|
@ -206,7 +206,7 @@ protected:
|
||||||
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
|
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BluetoothService* btService[BTD_NUMDEVICES];
|
BluetoothService* btService[BTD_NUMSERVICES];
|
||||||
|
|
||||||
bool bPollEnable;
|
bool bPollEnable;
|
||||||
uint8_t pollInterval;
|
uint8_t pollInterval;
|
||||||
|
|
Loading…
Reference in a new issue