File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ void GameCubeController::sendBits(uint32_t data, uint8_t bits) {
5151 bits--;
5252 while (DWT->CYCCNT < timerEnd) ;
5353 } while (bits);
54+ DWT->CYCCNT = 0 ;
55+ gpio_write_bit (port.device , port.pinNumber , 0 );
56+ while (DWT->CYCCNT < quarterBitSendingCycles) ;
57+ DWT->CYCCNT = 0 ;
58+ gpio_write_bit (port.device , port.pinNumber , 1 );
59+ while (DWT->CYCCNT < 2 *quarterBitSendingCycles) ;
5460}
5561
5662
@@ -170,13 +176,13 @@ bool GameCubeController::receiveBits(void* data0, uint32_t bits) {
170176bool GameCubeController::readWithRumble (GameCubeData_t* data, bool rumble) {
171177 if (fails >= maxFails) {
172178 nvic_globalirq_disable ();
173- sendBits (0b000000001l , 9 );
179+ sendBits (0b00000000l , 8 );
174180 nvic_globalirq_enable ();
175181 delayMicroseconds (410 );
176182 fails = 0 ;
177183 }
178184 nvic_globalirq_disable ();
179- sendBits (rumble ? 0b0100000000000011000000011l : 0b0100000000000011000000001l , 25 );
185+ sendBits (rumble ? 0b010000000000001100000001l : 0b010000000000001100000000l , 24 );
180186 bool success = receiveBits (data, 64 );
181187 nvic_globalirq_enable ();
182188 return success;
You can’t perform that action at this time.
0 commit comments