mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-04-26 10:16:05 -05:00
FIX: LinkRawWireless enables the library before calling any action
This commit is contained in:
parent
6868ca18cd
commit
dcbdf37250
|
|
@ -229,11 +229,16 @@ class LinkRawWireless {
|
||||||
bool activate(bool _stopFirst = true) {
|
bool activate(bool _stopFirst = true) {
|
||||||
LINK_READ_TAG(LINK_RAW_WIRELESS_VERSION);
|
LINK_READ_TAG(LINK_RAW_WIRELESS_VERSION);
|
||||||
|
|
||||||
|
LINK_BARRIER;
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
|
LINK_BARRIER;
|
||||||
|
|
||||||
bool success = reset(_stopFirst);
|
bool success = reset(_stopFirst);
|
||||||
|
|
||||||
|
LINK_BARRIER;
|
||||||
isEnabled = true;
|
isEnabled = true;
|
||||||
|
LINK_BARRIER;
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,10 +251,16 @@ class LinkRawWireless {
|
||||||
* \warning This should be used as a replacement for `activate()`.
|
* \warning This should be used as a replacement for `activate()`.
|
||||||
*/
|
*/
|
||||||
bool restoreExistingConnection() {
|
bool restoreExistingConnection() {
|
||||||
|
LINK_BARRIER;
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
|
LINK_BARRIER;
|
||||||
|
|
||||||
_resetState();
|
_resetState();
|
||||||
|
|
||||||
|
LINK_BARRIER;
|
||||||
|
isEnabled = true;
|
||||||
|
LINK_BARRIER;
|
||||||
|
|
||||||
_LRWLOG_("setting SPI to 2Mbps");
|
_LRWLOG_("setting SPI to 2Mbps");
|
||||||
linkSPI.activate(LinkSPI::Mode::MASTER_2MBPS);
|
linkSPI.activate(LinkSPI::Mode::MASTER_2MBPS);
|
||||||
|
|
||||||
|
|
@ -286,7 +297,6 @@ class LinkRawWireless {
|
||||||
|
|
||||||
_LRWLOG_("restored ok!");
|
_LRWLOG_("restored ok!");
|
||||||
|
|
||||||
isEnabled = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -296,14 +296,17 @@ class LinkWireless {
|
||||||
static_assert(LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH >= 2 &&
|
static_assert(LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH >= 2 &&
|
||||||
LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH <= 4);
|
LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH <= 4);
|
||||||
|
|
||||||
lastError = Error::NONE;
|
LINK_BARRIER;
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
|
|
||||||
LINK_BARRIER;
|
LINK_BARRIER;
|
||||||
|
|
||||||
|
lastError = Error::NONE;
|
||||||
bool success = reset();
|
bool success = reset();
|
||||||
|
|
||||||
|
LINK_BARRIER;
|
||||||
|
isEnabled = true;
|
||||||
LINK_BARRIER;
|
LINK_BARRIER;
|
||||||
|
|
||||||
isEnabled = true;
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,7 +319,9 @@ class LinkWireless {
|
||||||
* \warning This should be used as a replacement for `activate()`.
|
* \warning This should be used as a replacement for `activate()`.
|
||||||
*/
|
*/
|
||||||
bool restoreExistingConnection() {
|
bool restoreExistingConnection() {
|
||||||
|
LINK_BARRIER;
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
|
LINK_BARRIER;
|
||||||
|
|
||||||
resetState();
|
resetState();
|
||||||
stopTimer();
|
stopTimer();
|
||||||
|
|
@ -328,7 +333,10 @@ class LinkWireless {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LINK_BARRIER;
|
||||||
isEnabled = true;
|
isEnabled = true;
|
||||||
|
LINK_BARRIER;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user