Skip to content

Commit 2007290

Browse files
committed
Add GetOffset() function to GamecubeController and add missing docs
1 parent 74ac47e commit 2007290

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

include/GamecubeController.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,26 @@ class GamecubeController {
2828
*/
2929
~GamecubeController();
3030

31+
/**
32+
* @brief Send a poll to the GameCube controller. Delay will be added if necessary to conform
33+
* with the chosen polling rate.
34+
*
35+
* @param report The report buffer to write the controller's response into
36+
* @param rumble True to enable rumble, false to disable
37+
*
38+
* @return true if the controller responded, false otherwise
39+
*/
3140
bool Poll(gc_report_t *report, bool rumble);
3241

42+
/**
43+
* @brief Get the offset at which the PIO program was installed. Useful if you want to
44+
* communicate with multiple joybus devices without having to load multiple copies of the PIO
45+
* program.
46+
*
47+
* @return The offset at which the PIO program was installed
48+
*/
49+
int GetOffset();
50+
3351
private:
3452
static constexpr uint incoming_bit_length_us = 4;
3553
// Give a whole 5 bytes of leniency on receive so the controller has time to do processing

src/GamecubeController.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,7 @@ bool __no_inline_not_in_flash_func(GamecubeController::Poll)(gc_report_t *report
104104

105105
return true;
106106
}
107+
108+
int GamecubeController::GetOffset() {
109+
return _port.offset;
110+
}

0 commit comments

Comments
 (0)