]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Scan/UARTConnect/connect_scan.h
Adding basic remote capabilities + UART Rx DMA buffers
[kiibohd-controller.git] / Scan / UARTConnect / connect_scan.h
index 9ba6da13f05bc62509d5e85d823e890bf289c440..cdd7ed0ae6ff5da84069e7bcdd5ecd19623db3d2 100644 (file)
 
 // Functions
 typedef enum Command {
-       CableCheck    = 0, // Comm check
-       IdRequest     = 1, // Slave initialization (request id from master)
-       IdEnumeration = 2, // Slave initialization (begin enumeration from master)
-       IdReport      = 3, // Slave initialization complete, report id to master
-       ScanCode      = 4, // ScanCode event status change
-       Animation     = 5, // Master trigger animation event (same command is sent back to master when ready)
+       CableCheck,       // Comm check
+
+       IdRequest,        // Slave initialization (request id from master)
+       IdEnumeration,    // Slave initialization (begin enumeration from master)
+       IdReport,         // Slave initialization complete, report id to master
+
+       ScanCode,         // ScanCode event status change
+       Animation,        // Master trigger animation event (same command is sent back to master when ready)
+
+       RemoteCapability, // Activate a capability on the given node
+       RemoteOutput,     // Remote debug output from a given node
+       RemoteInput,      // Remote command to send to a given node's debug cli
+
+       Command_TOP,      // Enum bounds
+       Command_SYN = 0x16, // Reserved for error handling
 } Command;
 
 // UART Rx/Tx Status
@@ -41,7 +50,7 @@ typedef enum UARTStatus {
        UARTStatus_SYN     = 1, // Rx: SYN Received, waiting for SOH
        UARTStatus_SOH     = 2, // Rx: SOH Received, waiting for Command
        UARTStatus_Command = 3, // Rx: Command Received, waiting for data
-       UARTStatus_Ready   = 4, // Tx: Ready to receive commands
+       UARTStatus_Ready   = 4, // Tx: Ready to send commands
 } UARTStatus;
 
 
@@ -71,7 +80,6 @@ typedef struct IdRequestCommand {
 
 // Id Enumeration Command
 // Issued by the master whenever an Id Request is received
-// XXX Future work may include an "external capabilities" list in this command
 typedef struct IdEnumerationCommand {
        Command command;
        uint8_t id;
@@ -79,7 +87,6 @@ typedef struct IdEnumerationCommand {
 
 // Id Report Command
 // Issued by each slave to the master when assigned an Id
-// XXX Future work will include an "external capabilities" list in this command
 typedef struct IdReportCommand {
        Command command;
        uint8_t id;
@@ -109,6 +116,47 @@ typedef struct AnimationCommand {
        uint8_t firstParam[0];
 } AnimationCommand;
 
+// Remote Capability Command
+// Initiated by the master to trigger a capability on a given node
+// RemoteOutput is enabled while capability is activated
+// Set id to 255 if command should be sent in all directions
+typedef struct RemoteCapabilityCommand {
+       Command command;
+       uint8_t id;
+       uint8_t capabilityIndex;
+       uint8_t state;
+       uint8_t stateType;
+       uint8_t numArgs; // # of bytes, args may be larger than 1 byte
+       uint8_t firstArg[0];
+} RemoteCapabilityCommand;
+
+// Remote Output Command
+// Sends debug output to the master node
+// Uses print command redirection to generate each command message
+typedef struct RemoteOutputCommand {
+       Command command;
+       uint8_t id;
+       uint8_t length;
+       uint8_t firstChar[0];
+} RemoteOutputCommand;
+
+// Remote Input Command
+// Sends debug input to given node (usually from master)
+// Uses debug cli to execute command and sends all output using Remote Output Command
+typedef struct RemoteInputCommand {
+       Command command;
+       uint8_t id;
+       uint8_t length;
+       uint8_t firstChar[0];
+} RemoteInputCommand;
+
+
+
+// ----- Variables -----
+
+extern uint8_t Connect_id;
+extern uint8_t Connect_master; // Set if master
+
 
 
 // ----- Functions -----
@@ -116,3 +164,6 @@ typedef struct AnimationCommand {
 void Connect_setup( uint8_t master );
 void Connect_scan();
 
+void Connect_send_ScanCode( uint8_t id, TriggerGuide *scanCodeStateList, uint8_t numScanCodes );
+void Connect_send_RemoteCapability( uint8_t id, uint8_t capabilityIndex, uint8_t state, uint8_t stateType, uint8_t numArgs, uint8_t *args );
+