Software Control

The USB-C-Switch Pro is part of a family of Acroname devices that share interface conventions and capabilities.

Acroname provides multi-language APIs for interacting with the USB-C-Switch Pro, with consistent syntax and structure across supported languages. The underlying protocol and API design is called BrainStem® (see BrainStem).

The API represents the the connection to a USB-C-Switch Pro as a Module class, an instance of which represents the connection to a specific USB-C-Switch Pro. This class provides access to hardware functions through a set of sub-objects called Entities, each representing a specific interface or capability of the device. Once instantiated and connected, the USB-C-Switch Pro can be controlled through its entity interfaces.

A complete list of all entities and functions can be found in the Module Entities page.

Example: Discovery and Connection

 #include <iostream>
#include "BrainStem2/BrainStem-all.h"

int main(int argc, const char * argv[]) {

    // Locate and connect to the first Acroname object you find
    aUSBCSwitchPro cswitch;
    auto err = cswitch.discoverAndConnect(USB);      // Over USB
    // auto err = cswitch.discoverAndConnect(TCPIP); // Over TCP/IP
    if (err != aErrNone) {
        printf("Error %d encountered connecting to BrainStem module\n", err);
       return 1;

    } else { printf("Connected to BrainStem module.\n"); }

    //Prep USBCSwitchPro for testing
    cswitch.usb.setPortDisable(0);
    cswitch.mux.setEnable(false);
    cswitch.mux.setChannel(0);

    ////////////
    //Do Stuff: other test initialization
    ////////////

    //Ready for testing
    //Enable Port AND Mux
    cswitch.usb.setPortEnable(0);
    cswitch.mux.setEnable(true);

    ////////////
    //Do Stuff on Mux Channel 0
    ////////////

    cswitch.mux.setChannel(1);

    ////////////
    //Do Stuff on Mux Channel 1
    ////////////

    cswitch.mux.setChannel(2);

    ////////////
    //Do Stuff on Mux Channel 2
    ////////////

    cswitch.mux.setChannel(3);

    ////////////
    //Do Stuff on Mux Channel 3
    ////////////

    //Finished with testing.
    //De-initialize.
    cswitch.usb.setPortDisable(0);
    cswitch.mux.setEnable(false);

    //Disconnect
    cswitch.disconnect();
 }

Device Drivers

The USB-C-Switch Pro leverages common operating system drivers that do not require custom installations on modern operating systems.

Some older operating systems may require the installation of a BrainStem USB driver information files to enable software control. Installation details on installing USB drivers can be found within the BrainStem Development Kit under the “drivers” folder. For example, Windows 7 requires the supplied INF to communicate with BrainStem USB devices.