Merge pull request #5 from TKJElectronics/master

bmNakPower issue fixed
This commit is contained in:
Oleg Mazurov 2012-03-04 08:36:10 -08:00
commit 8e9517570d
4 changed files with 20 additions and 15 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2011 TKJ Electronics. All rights reserved.
/* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
This software may be distributed and modified under the terms of the GNU
General Public License version 2 (GPL2) as published by the Free Software
@ -10,9 +10,9 @@
Contact information
-------------------
TKJ Electronics
Kristian Lauszus, TKJ Electronics
Web : http://www.tkjelectronics.com
e-mail : mail@tkjelectronics.com
e-mail : kristianl@tkjelectronics.com
*/
#include "PS3BT.h"
@ -41,10 +41,9 @@ PS3BT::PS3BT(USB *p):
{
epInfo[i].epAddr = 0;
epInfo[i].maxPktSize = (i) ? 0 : 8;
epInfo[i].epAttribs = 0;
if (!i)
epInfo[i].bmNakPower = USB_NAK_DEFAULT;//USB_NAK_MAX_POWER
epInfo[i].epAttribs = 0;
if (!i)
epInfo[i].bmNakPower = USB_NAK_DEFAULT;
}
if (pUsb) // register in USB subsystem
@ -190,17 +189,19 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
/* Initialize data structures for endpoints of device */
epInfo[ CSR_EVENT_PIPE ].epAddr = 0x01; // Bluetooth event endpoint
epInfo[ CSR_EVENT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ CSR_EVENT_PIPE ].bmNakPower = USB_NAK_NOWAIT;//Only poll once for interrupt endpoints
epInfo[ CSR_EVENT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ CSR_EVENT_PIPE ].maxPktSize = INT_MAXPKTSIZE;
epInfo[ CSR_EVENT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ CSR_EVENT_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ CSR_DATAIN_PIPE ].epAddr = 0x02; // Bluetoth data endpoint
epInfo[ CSR_DATAIN_PIPE ].epAttribs = EP_BULK;
epInfo[ CSR_DATAIN_PIPE ].bmNakPower = USB_NAK_NOWAIT;
epInfo[ CSR_DATAIN_PIPE ].maxPktSize = BULK_MAXPKTSIZE;
epInfo[ CSR_DATAIN_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ CSR_DATAIN_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ CSR_DATAOUT_PIPE ].epAddr = 0x02; // Bluetooth data endpoint
epInfo[ CSR_DATAOUT_PIPE ].epAttribs = EP_BULK;
epInfo[ CSR_DATAOUT_PIPE ].bmNakPower = USB_NAK_NOWAIT;
epInfo[ CSR_DATAOUT_PIPE ].maxPktSize = BULK_MAXPKTSIZE;
epInfo[ CSR_DATAOUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ CSR_DATAOUT_PIPE ].bmRcvToggle = bmRCVTOG0;
@ -230,13 +231,13 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
/* Initialize data structures for endpoints of device */
epInfo[ PS3_OUTPUT_PIPE ].epAddr = 0x02; // PS3 output endpoint
epInfo[ PS3_OUTPUT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ PS3_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT;//Only poll once for interrupt endpoints
epInfo[ PS3_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ PS3_OUTPUT_PIPE ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ PS3_OUTPUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ PS3_OUTPUT_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ PS3_INPUT_PIPE ].epAddr = 0x01; // PS3 report endpoint
epInfo[ PS3_INPUT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ PS3_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT;//Only poll once for interrupt endpoints
epInfo[ PS3_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ PS3_INPUT_PIPE ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ PS3_INPUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ PS3_INPUT_PIPE ].bmRcvToggle = bmRCVTOG0;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2011 TKJ Electronics. All rights reserved.
/* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
This software may be distributed and modified under the terms of the GNU
General Public License version 2 (GPL2) as published by the Free Software
@ -10,9 +10,9 @@
Contact information
-------------------
TKJ Electronics
Kristian Lauszus, TKJ Electronics
Web : http://www.tkjelectronics.com
e-mail : mail@tkjelectronics.com
e-mail : kristianl@tkjelectronics.com
*/
#ifndef _ps3bt_h_

View file

@ -1,7 +1,5 @@
The PS3BT.cpp PS3BT.h was developed by Kristian Lauszus
If it doesn't work then try comment "nak_limit--;" in "SetAddress()" in "Usb.cpp", as this caused some problems.
For more information regarding the PS3 protocol etc. visit my blog at: http://blog.tkjelectronics.dk/ or send me an email at kristianl at tkjelectronics dot dk.
You could also visit the official wiki: https://github.com/TKJElectronics/USB_Host_Shield_2.0/wiki for information.

View file

@ -1,3 +1,9 @@
/*
Example sketch for the PS3 Bluetooth library - developed by Kristian Lauszus
For more information visit my blog: http://blog.tkjelectronics.dk/ or
send me an e-mail: kristianl@tkjelectronics.com
*/
#include <PS3BT.h>
USB Usb;
PS3BT BT(&Usb);