public static void setPlatform ( Platform platform ) throws PlatformAlreadyAssignedException { // prevent changing the platform once it has been initially set if ( PlatformManager . platform != null ) { throw new PlatformAlreadyAssignedException ( PlatformManager . platform ) ; } // set internal platform instance PlatformManager . platform = platform ; // apply Pi4J platform system property System . setProperty ( "pi4j.platform" , platform . id ( ) ) ; }
Set the runtime platform for Pi4J to use . This platform selection will be used to determine the default GPIO providers and I2C providers specific to the selected platform . A platform assignment can only be set once . If a second attempt to set a platform is attempted the PlatformAlreadyAssignedException will be thrown . Please note that platform assignment can be made automatically if you use a provider class prior to manually assigning a platform .