Retrieve the current LCD configuration

Hello

On my project, i need to use some the pin that are usually connected to the LCD for other purposes. This involves to run:

GHIElectronics.NETMF.Hardware.Configuration.LCD.Set(LCD.HeadlessConfig)

After resetting the board, the pin can be used as normal IOs.

The problem is that to deploy my application on a large amount of board, I will be obliged to have a code that reset only if the config is not the good one.

My first idea was to find something like: GHIElectronics.NETMF.Hardware.Configuration.LCD.Get() in order to test before running the set and reseting (by software) the board

But this does not exist. Could it be added in following release?

If not and in order to wait for such a functionnalities, how to properly handle the exception that is generated when a pin is not available?

the idea could be :


try {LED_power.io=new OutputPort(EMX.Pin.IO65,false);}
catch(System.Exception????????????????)
{
GHIElectronics.NETMF.Hardware.Configuration.LCD.Set(LCD.HeadlessConfig)
reset the board...
}

May be some of you have already some tips to help me in achieving that?

Thanks in advance for your help.

Read carefull [url]http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/cf4f6ce9-920d-5b02-8b85-b9d756441929.htm[/url]

[quote]public static bool Set(Configuration.LCD.Configurations config)

Return Value
true if configurations where updated. false if configurations did not change.[/quote]

Ok you right, this will be usefull. I don’t know why I was expecting getter and setter as in java or EMF…

Thank for your help.

Here’s what I did:

bool cfg_chg=GHIElectronics.NETMF.Hardware.Configuration.LCD.Set(Configuration.LCD.HeadlessConfig); // to use the LCD reserved IOs, return true if config has changed false otherwise.
            if (cfg_chg==true)
            {
              GHIElectronics.NETMF.Hardware.LowLevel.Watchdog.Enable(1000);
            while(true);
            }

There is a Reset (or Reboot) method somewhere in the Hardware (I think) namespace. I think it also uses the watchdog but I recommend using it (it’s a better practice to use what is already made).

You are right, unfortunately I did not find this instruction. Sometimes looking for a method or a class is painfull on netmf or GHI library… unfortunately there’s no search tool in the GHI online library…

It’s from .NET MF standard, not from GHI.
Here it is: [url]Microsoft Learn: Build skills that open doors in your career

COOOOOL, many thanks GodFather89, I was looking for this functionnality in GHI library whereas it was in .NETMF.

My code will look nicer :slight_smile: