mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-10-01 21:36:53 -05:00
Updating README and fixing mobile stuff
This commit is contained in:
@@ -32,7 +32,9 @@ A set of Game Boy Advance (GBA) C++ libraries to interact with the Serial Port.
|
||||
* The examples can be tested on real GBAs or using emulators.
|
||||
* For `LinkCable`/`LinkWireless`/`LinkUniversal`, there are stress tests that you can use to tweak your configuration.
|
||||
|
||||
To learn implementation details, you might also want to check out the [docs](docs) folder, which contains important documentation.
|
||||
> The example ROMs were compiled using [devkitPro](https://devkitpro.org) with GCC `14.1.0`.
|
||||
|
||||
> To learn implementation details, you might also want to check out the [docs](docs) folder, which contains important documentation.
|
||||
|
||||
### Makefile actions (for all examples)
|
||||
|
||||
@@ -461,4 +463,4 @@ Name | Return type | Description
|
||||
|DATA --> SO |
|
||||
|VCC ---> VCC|
|
||||
|GND ---> GND|
|
||||
```
|
||||
```
|
||||
|
||||
@@ -16,7 +16,6 @@ void waitFor(u16 key);
|
||||
void wait(u32 verticalLines);
|
||||
void hang();
|
||||
|
||||
LinkMobile::Error lastError;
|
||||
LinkMobile* linkMobile = NULL;
|
||||
|
||||
void init() {
|
||||
@@ -31,14 +30,9 @@ int main() {
|
||||
|
||||
start:
|
||||
// Options
|
||||
log("LinkMobile_demo (v6.7.0)\n\n\n\n"
|
||||
log("LinkMobile_demo (v7.0.0)\n\n"
|
||||
"Press A to start");
|
||||
waitFor(KEY_A);
|
||||
// u16 initialKeys = ~REG_KEYS & KEY_ANY;
|
||||
// forwarding = !(initialKeys & KEY_LEFT);
|
||||
// retransmission = !(initialKeys & KEY_UP);
|
||||
// maxPlayers = (initialKeys & KEY_B) ? 2 : LINK_MOBILE_MAX_PLAYERS;
|
||||
// asyncACK = initialKeys & KEY_START;
|
||||
|
||||
// (1) Create a LinkMobile instance
|
||||
linkMobile = new LinkMobile();
|
||||
@@ -59,16 +53,16 @@ start:
|
||||
// (3) Initialize the library
|
||||
linkMobile->activate();
|
||||
|
||||
bool activating = false;
|
||||
bool reading = false;
|
||||
|
||||
while (true) {
|
||||
u16 keys = ~REG_KEYS & KEY_ANY;
|
||||
|
||||
// Menu
|
||||
log(std::string("") +
|
||||
log(std::string("") + "State = " + std::to_string(linkMobile->getState()) +
|
||||
"\n\n" +
|
||||
"L = Read Configuration\n\n (DOWN = ok)\n "
|
||||
"(SELECT = cancel)\n (START = reactivate)");
|
||||
"(SELECT = stop)");
|
||||
|
||||
// SELECT = back
|
||||
if (keys & KEY_SELECT) {
|
||||
@@ -78,14 +72,6 @@ start:
|
||||
goto start;
|
||||
}
|
||||
|
||||
// START = Activate
|
||||
if ((keys & KEY_START) && !activating) {
|
||||
activating = true;
|
||||
activate();
|
||||
}
|
||||
if (activating && !(keys & KEY_START))
|
||||
activating = false;
|
||||
|
||||
// L = Read Configuration
|
||||
if ((keys & KEY_L) && !reading) {
|
||||
reading = true;
|
||||
|
||||
@@ -166,7 +166,7 @@ class LinkMobile {
|
||||
* @brief ...
|
||||
*/
|
||||
void activate() {
|
||||
lastError = {};
|
||||
error = {};
|
||||
|
||||
LINK_MOBILE_BARRIER;
|
||||
isEnabled = false;
|
||||
@@ -183,7 +183,7 @@ class LinkMobile {
|
||||
}
|
||||
|
||||
void deactivate() {
|
||||
lastError = {};
|
||||
error = {};
|
||||
isEnabled = false;
|
||||
resetState();
|
||||
stop();
|
||||
@@ -203,11 +203,11 @@ class LinkMobile {
|
||||
return linkSPI->getDataSize();
|
||||
}
|
||||
|
||||
Error getLastError(bool clear = true) {
|
||||
auto error = lastError;
|
||||
Error getError(bool clear = true) {
|
||||
auto err = error;
|
||||
if (clear)
|
||||
lastError = {};
|
||||
return error;
|
||||
error = {};
|
||||
return err;
|
||||
}
|
||||
|
||||
~LinkMobile() { delete linkSPI; }
|
||||
@@ -395,7 +395,7 @@ class LinkMobile {
|
||||
u32 nextCommandDataSize = 0;
|
||||
bool hasPendingTransfer = false;
|
||||
u32 pendingTransfer = 0;
|
||||
Error lastError = {};
|
||||
Error error = {};
|
||||
volatile bool isEnabled = false;
|
||||
|
||||
void processNewFrame() {
|
||||
@@ -568,7 +568,7 @@ class LinkMobile {
|
||||
}
|
||||
|
||||
void abort(Error::Type errorType) {
|
||||
lastError =
|
||||
error =
|
||||
Error{.type = errorType,
|
||||
.state = state,
|
||||
.cmdId = (u8)(asyncCommand.cmd.header.commandId & (~OR_VALUE)),
|
||||
@@ -578,10 +578,10 @@ class LinkMobile {
|
||||
asyncCommand.direction == AsyncCommand::Direction::SENDING};
|
||||
|
||||
_LMLOG_(
|
||||
"!! aborted:\n error:%d\n cmdId=%s%d\n cmdResult=%d\n "
|
||||
"cmdErrorCode=%d",
|
||||
lastError.type, lastError.cmdIsSending ? ">" : "<", lastError.cmdId,
|
||||
lastError.cmdResult, lastError.cmdErrorCode);
|
||||
"!! aborted:\n error: %d\n cmdId: %s$%X\n cmdResult: %d\n "
|
||||
"cmdErrorCode: %d",
|
||||
error.type, error.cmdIsSending ? ">" : "<", error.cmdId,
|
||||
error.cmdResult, error.cmdErrorCode);
|
||||
|
||||
resetState();
|
||||
stop();
|
||||
|
||||
Reference in New Issue
Block a user