Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UsbHostMAX3421E_Hello
PSBuzz Class Reference
This class implements support for the PS Buzz controllers via USB. More...
#include <PSBuzz.h>
Inherits HIDUniversal.
Public Member Functions | |
| PSBuzz (Usb *p) | |
| Constructor for the PSBuzz class. | |
| bool | connected () |
| Used to check if a PS Buzz controller is connected. | |
| void | attachOnInit (void(*funcOnInit)(void)) |
| Used to call your own function when the device is successfully initialized. | |
PS Buzzer Controller functions | |
| bool | getButtonPress (ButtonEnum b, uint8_t controller=0) |
| getButtonPress(ButtonEnum b) will return true as long as the button is held down. | |
| bool | getButtonClick (ButtonEnum b, uint8_t controller=0) |
| void | setLedRaw (bool value, uint8_t controller=0) |
| Set LED value without using LEDEnum. | |
| void | setLedOffAll () |
| Turn all LEDs off. | |
| void | setLedOff (uint8_t controller=0) |
| Turn the LED off on a specific controller. | |
| void | setLedOnAll () |
| Turn all LEDs on. | |
| void | setLedOn (uint8_t controller=0) |
| Turn the LED on on a specific controller. | |
| void | setLedToggle (uint8_t controller=0) |
| Toggle the LED on a specific controller. | |
Protected Member Functions | |
| void | Reset () |
| Used to reset the different buffers to their default values. | |
HIDUniversal implementation | |
| void | ParseHIDData (USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) |
| Used to parse USB HID data. | |
| uint8_t | OnInitSuccessful () |
| Called when a device is successfully initialized. | |
USBDeviceConfig implementation | |
| virtual bool | VIDPIDOK (uint16_t vid, uint16_t pid) |
| Used by the USB core to check what this driver support. | |
Detailed Description
This class implements support for the PS Buzz controllers via USB.
It uses the HIDUniversal class for all the USB communication.
Definition at line 43 of file PSBuzz.h.
Constructor & Destructor Documentation
| PSBuzz | ( | Usb * | p ) |
Member Function Documentation
| void attachOnInit | ( | void(*)(void) | funcOnInit ) |
| bool connected | ( | ) |
| bool getButtonPress | ( | ButtonEnum | b, |
| uint8_t | controller = 0 |
||
| ) |
getButtonPress(ButtonEnum b) will return true as long as the button is held down.
While getButtonClick(ButtonEnum b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).
- Parameters:
-
b ButtonEnum to read. controller The controller to read from. Default to 0.
- Returns:
- getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
Definition at line 52 of file PSBuzz.cpp.
| uint8_t OnInitSuccessful | ( | ) | [protected] |
Called when a device is successfully initialized.
Use attachOnInit(void (*funcOnInit)(void)) to call your own function. This is useful for instance if you want to set the LEDs in a specific way.
Definition at line 41 of file PSBuzz.cpp.
| void ParseHIDData | ( | USBHID * | hid, |
| bool | is_rpt_id, | ||
| uint8_t | len, | ||
| uint8_t * | buf | ||
| ) | [protected] |
Used to parse USB HID data.
- Parameters:
-
hid Pointer to the HID class. is_rpt_id Only used for Hubs. len The length of the incoming data. buf Pointer to the data buffer.
| void Reset | ( | ) | [protected] |
| void setLedOff | ( | uint8_t | controller = 0 ) |
| void setLedOn | ( | uint8_t | controller = 0 ) |
| void setLedRaw | ( | bool | value, |
| uint8_t | controller = 0 |
||
| ) |
Set LED value without using LEDEnum.
- Parameters:
-
value See: LEDEnum. Set LED values directly. value Used to set whenever the LED should be on or off controller The controller to control. Defaults to 0.
Definition at line 64 of file PSBuzz.cpp.
| void setLedToggle | ( | uint8_t | controller = 0 ) |
Generated on Tue Jul 12 2022 18:12:05 by
1.7.2