/// <summary> /// Sets the display configuration. This must be called by all display module constructors (even ones not using LCD displays) /// </summary> /// <param name="displayConfig">The display configuration.</param> protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig) { if (_numDisplaysConstructed != _numDisplaysConfigured + 1) { DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig() once."); } if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0)) { DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display"); } _numDisplaysConfigured++; _displayModuleToBeConfigured._config = displayConfig; if (displayConfig.LCDControllerEnabled) { if (_lcdControllerConfig != null) { if (_lcdControllerConfig == lcdPinsUsedAsIOs) { DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display"); } else { DisplayError("ERROR: Cannot use more than one LCD controller based display at a time"); } } _lcdControllerConfig = displayConfig; Mainboard.SetLCDConfiguration(displayConfig); } }
/// <summary> /// Called when a pin otherwise used for the LCD controller is reserved for another module /// We have to ensure the LCD controller pins are disabled so they can be reused /// </summary> internal static void LCDControllerPinReuse() { if (_lcdControllerConfig != null && _lcdControllerConfig.LCDControllerEnabled) { DisplayError("ERROR: Cannot use LCD controller pins as IOs simultaneously with using them to drive a display"); } Mainboard.SetLCDConfiguration(lcdPinsUsedAsIOs); // this will reboot if necessary if (_lcdControllerConfig == null) { _lcdControllerConfig = lcdPinsUsedAsIOs; } }