Using default waitstates in all examplesm, allowing knobs to be defined outside

This commit is contained in:
Rodrigo Alfonso 2024-08-26 03:22:47 -03:00
parent 70308ed9c8
commit d18cf5ec3d
9 changed files with 32 additions and 2 deletions

View File

@ -17,8 +17,6 @@ LinkWirelessMultiboot* linkWirelessMultiboot = new LinkWirelessMultiboot();
int main() {
setUpInterrupts();
REG_WAITCNT = 0x4317; // (3,1 waitstates, prefetch ON)
engine->setScene(multibootScene.get());
while (true) {

View File

@ -44,6 +44,7 @@
#include "_link_common.hpp"
#ifndef LINK_CABLE_QUEUE_SIZE
/**
* @brief Buffer size (how many incoming and outgoing messages the queues can
* store at max **per player**). The default value is `15`, which seems fine for
@ -54,6 +55,7 @@
* approximate the usage with `LINK_CABLE_QUEUE_SIZE * 26`.
*/
#define LINK_CABLE_QUEUE_SIZE 15
#endif
static volatile char LINK_CABLE_VERSION[] = "LinkCable/v7.0.0";
@ -472,10 +474,12 @@ class LinkCable {
bool isOnline(u8 playerId) {
return _state.msgTimeouts[playerId] != REMOTE_TIMEOUT_OFFLINE;
}
void setOnline(u8 playerId) {
_state.msgTimeouts[playerId] = 0;
_state.msgFlags[playerId] = true;
}
void setOffline(u8 playerId) {
_state.msgTimeouts[playerId] = REMOTE_TIMEOUT_OFFLINE;
_state.msgFlags[playerId] = false;

View File

@ -26,12 +26,14 @@
#include "LinkRawCable.hpp"
#include "LinkSPI.hpp"
#ifndef LINK_CABLE_MULTIBOOT_PALETTE_DATA
/**
* @brief Palette data (controls how the logo is displayed).
* Format: 0b1CCCDSS1, where C=color, D=direction, S=speed.
* Default: 0b10010011
*/
#define LINK_CABLE_MULTIBOOT_PALETTE_DATA 0b10010011
#endif
static volatile char LINK_CABLE_MULTIBOOT_VERSION[] =
"LinkCableMultiboot/v7.0.0";

View File

@ -28,6 +28,7 @@
#include "_link_common.hpp"
#ifndef LINK_CUBE_QUEUE_SIZE
/**
* @brief Buffer size (how many incoming and outgoing values the queues can
* store at max). The default value is `10`, which seems fine for most games.
@ -37,6 +38,7 @@
* \warning You can approximate the usage with `LINK_CUBE_QUEUE_SIZE * 12`.
*/
#define LINK_CUBE_QUEUE_SIZE 10
#endif
static volatile char LINK_CUBE_VERSION[] = "LinkCube/v7.0.0";

View File

@ -62,6 +62,7 @@
#include "LinkGPIO.hpp"
#include "LinkSPI.hpp"
#ifndef LINK_MOBILE_QUEUE_SIZE
/**
* @brief Request queue size (how many commands can be queued at the same time).
* The default value is `10`, which seems fine for most games.
@ -69,6 +70,7 @@
* it's around 3 KB.
*/
#define LINK_MOBILE_QUEUE_SIZE 10
#endif
static volatile char LINK_MOBILE_VERSION[] = "LinkMobile/v7.0.0";

View File

@ -26,10 +26,12 @@
#include "_link_common.hpp"
#ifndef LINK_UART_QUEUE_SIZE
/**
* @brief Buffer size in bytes.
*/
#define LINK_UART_QUEUE_SIZE 256
#endif
static volatile char LINK_UART_VERSION[] = "LinkUART/v7.0.0";

View File

@ -51,18 +51,22 @@
#include "LinkCable.hpp"
#include "LinkWireless.hpp"
#ifndef LINK_UNIVERSAL_MAX_PLAYERS
/**
* @brief Maximum number of players. Default = 5
* \warning Keep in mind that LinkCable's limit is 4.
*/
#define LINK_UNIVERSAL_MAX_PLAYERS LINK_WIRELESS_MAX_PLAYERS
#endif
#ifndef LINK_UNIVERSAL_GAME_ID_FILTER
/**
* @brief Game ID Filter (`0x0000` ~ `0x7fff`). Default = 0 (no filter)
* This restricts wireless connections to rooms with a specific game ID.
* When disabled, it connects to any game ID and uses `0x7fff` when serving.
*/
#define LINK_UNIVERSAL_GAME_ID_FILTER 0
#endif
static volatile char LINK_UNIVERSAL_VERSION[] = "LinkUniversal/v7.0.0";

View File

@ -63,6 +63,7 @@
// #include <string>
// #include <functional>
#ifndef LINK_WIRELESS_QUEUE_SIZE
/**
* @brief Buffer size (how many incoming and outgoing messages the queues can
* store at max). The default value is `30`, which seems fine for most games.
@ -72,21 +73,27 @@
* \warning You can approximate the usage with `LINK_WIRELESS_QUEUE_SIZE * 32`.
*/
#define LINK_WIRELESS_QUEUE_SIZE 30
#endif
#ifndef LINK_WIRELESS_MAX_SERVER_TRANSFER_LENGTH
/**
* @brief Max server transfer length per timer tick. Must be in the range
* `[6;20]`. The default value is `20`, but you might want to set it a bit lower
* to reduce CPU usage.
*/
#define LINK_WIRELESS_MAX_SERVER_TRANSFER_LENGTH 20
#endif
#ifndef LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH
/**
* @brief Max client transfer length per timer tick. Must be in the range
* `[2;4]`. The default value is `4`. Changing this is not recommended, it's
* already too low.
*/
#define LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH 4
#endif
#ifndef LINK_WIRELESS_PUT_ISR_IN_IWRAM
/**
* @brief Put Interrupt Service Routines (ISR) in IWRAM (uncomment to enable).
* This can significantly improve performance due to its faster access, but it's
@ -96,7 +103,9 @@
* `SRCDIRS` list.
*/
// #define LINK_WIRELESS_PUT_ISR_IN_IWRAM
#endif
#ifndef LINK_WIRELESS_ENABLE_NESTED_IRQ
/**
* @brief Allow LINK_WIRELESS_ISR_* functions to be interrupted (uncomment to
* enable).
@ -106,7 +115,9 @@
* disabled.
*/
// #define LINK_WIRELESS_ENABLE_NESTED_IRQ
#endif
#ifndef LINK_WIRELESS_USE_SEND_RECEIVE_LATCH
/**
* @brief Use send/receive latch (uncomment to enable).
* This makes it alternate between sends and receives on each timer tick
@ -114,7 +125,9 @@
* also reduce overall CPU usage.
*/
// #define LINK_WIRELESS_USE_SEND_RECEIVE_LATCH
#endif
#ifndef LINK_WIRELESS_TWO_PLAYERS_ONLY
/**
* @brief Optimize the library for two players (uncomment to enable).
* This will make the code smaller and use less CPU. It will also let you
@ -123,6 +136,7 @@
* `QUICK_RECEIVE` properties.
*/
// #define LINK_WIRELESS_TWO_PLAYERS_ONLY
#endif
static volatile char LINK_WIRELESS_VERSION[] = "LinkWireless/v7.0.0";

View File

@ -32,11 +32,13 @@
#include "LinkRawWireless.hpp"
#include "LinkWirelessOpenSDK.hpp"
#ifndef LINK_WIRELESS_MULTIBOOT_ENABLE_LOGGING
/**
* @brief Enable logging.
* \warning Set `linkWirelessMultiboot->logger` and uncomment to enable!
*/
// #define LINK_WIRELESS_MULTIBOOT_ENABLE_LOGGING
#endif
static volatile char LINK_WIRELESS_MULTIBOOT_VERSION[] =
"LinkWirelessMultiboot/v7.0.0";