forked from rsta2/circle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'usbgamepad' into develop
- Loading branch information
Showing
43 changed files
with
3,081 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// devicenameservice.h | ||
// | ||
// Circle - A C++ bare metal environment for Raspberry Pi | ||
// Copyright (C) 2014-2017 R. Stange <[email protected]> | ||
// Copyright (C) 2014-2018 R. Stange <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
|
@@ -32,18 +32,45 @@ struct TDeviceInfo | |
boolean bBlockDevice; | ||
}; | ||
|
||
class CDeviceNameService | ||
class CDeviceNameService /// Devices can be registered by name and retrieved later by this name | ||
{ | ||
public: | ||
CDeviceNameService (void); | ||
~CDeviceNameService (void); | ||
|
||
/// \param pName Device name string | ||
/// \param pDevice Pointer to the device object | ||
/// \param bBlockDevice TRUE if this is a block device, otherwise character device | ||
void AddDevice (const char *pName, CDevice *pDevice, boolean bBlockDevice); | ||
/// \param pPrefix Device name prefix string | ||
/// \param nIndex Device name index | ||
/// \param pDevice Pointer to the device object | ||
/// \param bBlockDevice TRUE if this is a block device, otherwise character device | ||
void AddDevice (const char *pPrefix, unsigned nIndex, CDevice *pDevice, boolean bBlockDevice); | ||
|
||
/// \param pName Device name string | ||
/// \param bBlockDevice TRUE if this is a block device, otherwise character device | ||
void RemoveDevice (const char *pName, boolean bBlockDevice); | ||
/// \param pPrefix Device name prefix string | ||
/// \param nIndex Device name index | ||
/// \param bBlockDevice TRUE if this is a block device, otherwise character device | ||
void RemoveDevice (const char *pPrefix, unsigned nIndex, boolean bBlockDevice); | ||
|
||
/// \param pName Device name string | ||
/// \param bBlockDevice TRUE if this is a block device, otherwise character device | ||
/// \return Pointer to the device object or 0 if not found | ||
CDevice *GetDevice (const char *pName, boolean bBlockDevice); | ||
/// \param pPrefix Device name prefix string | ||
/// \param nIndex Device name index | ||
/// \param bBlockDevice TRUE if this is a block device, otherwise character device | ||
/// \return Pointer to the device object or 0 if not found | ||
CDevice *GetDevice (const char *pPrefix, unsigned nIndex, boolean bBlockDevice); | ||
|
||
/// \brief Generate device listing | ||
/// \param pTarget Device to be used for output | ||
void ListDevices (CDevice *pTarget); | ||
|
||
/// \return The single CDeviceNameService instance of the system | ||
static CDeviceNameService *Get (void); | ||
|
||
private: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// mouse.h | ||
// | ||
// Circle - A C++ bare metal environment for Raspberry Pi | ||
// Copyright (C) 2014-2018 R. Stange <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
#ifndef _circle_input_mouse_h | ||
#define _circle_input_mouse_h | ||
|
||
#include <circle/device.h> | ||
#include <circle/input/mousebehaviour.h> | ||
#include <circle/types.h> | ||
|
||
#define MOUSE_DISPLACEMENT_MIN -127 | ||
#define MOUSE_DISPLACEMENT_MAX 127 | ||
|
||
typedef void TMouseStatusHandler (unsigned nButtons, int nDisplacementX, int nDisplacementY); | ||
|
||
class CMouseDevice : public CDevice /// Generic mouse interface device ("mouse1") | ||
{ | ||
public: | ||
CMouseDevice (void); | ||
~CMouseDevice (void); | ||
|
||
/// \brief Setup mouse device in cooked mode | ||
/// \param nScreenWidth Width of the screen in pixels | ||
/// \param nScreenHeight Height of the screen in pixels | ||
/// \return FALSE on failure | ||
boolean Setup (unsigned nScreenWidth, unsigned nScreenHeight); | ||
|
||
/// \brief Register event handler in cooked mode | ||
/// \param pEventHandler Pointer to the event handler (see: mousebehaviour.h) | ||
void RegisterEventHandler (TMouseEventHandler *pEventHandler); | ||
|
||
/// \brief Set mouse cursor to a specific position in cooked mode | ||
/// \param nPosX X-coordinate of the position in pixels (0 is on the left border) | ||
/// \param nPosY Y-coordinate of the position in pixels (0 is on the top border) | ||
/// \return FALSE on failure | ||
boolean SetCursor (unsigned nPosX, unsigned nPosY); | ||
/// \brief Switch mouse cursor on or off in cooked mode | ||
/// \param bShow TRUE shows the mouse cursor | ||
/// \return Previous state | ||
boolean ShowCursor (boolean bShow); | ||
|
||
/// \brief Call this frequently from TASK_LEVEL (cooked mode only) | ||
void UpdateCursor (void); | ||
|
||
/// \brief Register mouse status handler in raw mode | ||
/// \param pStatusHandler Pointer to the mouse status handler | ||
void RegisterStatusHandler (TMouseStatusHandler *pStatusHandler); | ||
|
||
public: | ||
/// \warning Do not call this from application! | ||
void ReportHandler (unsigned nButtons, int nDisplacementX, int nDisplacementY); | ||
|
||
private: | ||
CMouseBehaviour m_Behaviour; | ||
|
||
TMouseStatusHandler *m_pStatusHandler; | ||
|
||
unsigned m_nDeviceNumber; | ||
static unsigned s_nDeviceNumber; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// usbfunction.h | ||
// | ||
// Circle - A C++ bare metal environment for Raspberry Pi | ||
// Copyright (C) 2014-2016 R. Stange <[email protected]> | ||
// Copyright (C) 2014-2018 R. Stange <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
|
@@ -51,7 +51,12 @@ class CUSBFunction : public CDevice | |
const TUSBDescriptor *GetDescriptor (u8 ucType); // returns 0 if not found | ||
void ConfigurationError (const char *pSource) const; | ||
|
||
// select a specific USB interface, called in constructor of derived class, | ||
// if device has been detected by vendor/product ID | ||
boolean SelectInterfaceByClass (u8 uchClass, u8 uchSubClass, u8 uchProtocol); | ||
|
||
u8 GetInterfaceNumber (void) const; | ||
u8 GetInterfaceClass (void) const; | ||
u8 GetInterfaceSubClass (void) const; | ||
u8 GetInterfaceProtocol (void) const; | ||
|
||
|
Oops, something went wrong.