MCPcopy Create free account
hub / github.com/Santroller/Santroller / getResponse

Method getResponse

lib/n64_gamecube_controller/Controller.cpp:65–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void Controller::getResponse(PIO pio, uint sm, uint8_t *response,
66 uint8_t responseLength) {
67 int16_t remainingResponseBytes = responseLength;
68 while (remainingResponseBytes > 0) {
69 absolute_time_t timeout_us = make_timeout_time_us(600);
70 bool timedOut = false;
71 while (pio_sm_is_rx_fifo_empty(pio, sm) && !timedOut) {
72 timedOut = time_reached(timeout_us);
73 }
74 if (timedOut) {
75 // throw 0;
76 }
77 uint32_t data = pio_sm_get(pio, sm);
78 response[responseLength - remainingResponseBytes] = (uint8_t)(data & 0xFF);
79 remainingResponseBytes--;
80 }
81}
82
83double Controller::getScaledAnalogAxis(double axisPos, double *minAxis,
84 double *maxAxis) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected