code: public Producer createProducer() throws Exception {
          LOG.debug(this.toString());
          ObjectHelper.notNull(this.mode, "mode");
          GpioPin pin = isAlreadyProvisioned();
          if (pin == null) {
              switch (this.mode) {
              case DIGITAL_OUTPUT:
                  pin = getOrCreateController().provisionDigitalOutputPin(getPin(), state);
                  break;
              case ANALOG_OUTPUT:
                  pin = getOrCreateController().provisionAnalogOutputPin(getPin(), value);
                  break;
              case PWM_OUTPUT:
                  pin = getOrCreateController().provisionPwmOutputPin(getPin(), (int) value);
                  break;
              case ANALOG_INPUT: // PinMode.allInput()
              case DIGITAL_INPUT:
                  LOG.error("Cannot create Producer with INPUT Mode");
                  return null;
              default:
                  LOG.error("Cannot create Producer w/o Mode");
                  break;
              }
              pin.setMode(this.mode); // Force Mode to avoid NPE
          } else { // enhancement we could manage several pins with one producer
              throw new IllegalArgumentException(
                      "Cannot create twice same output gpio [" + this.gpioId + "] for Producer");
          }
  
          // shutdownOption(pin);
          return new GPIOProducer(this, pin, action);
      }
docs: Create producer map to an Output PIN