I am converting code that runs fine on the Panda over to a custom board using the USBizi 100 chip. I changed the referenced assembly from the Panda assembly to the USBizi assemblly in the project window.
The problem is I cannot get the proper reference to the USBizi pin in the variable passed to the function. In the oc statement, I cannot figure out the correct reference to the USBizi pin.
The specific code is:
If suing USBizi then you should use the USBizi pinout document along with USBizi DLL. Do not refer to anything from FEZ boards for example. See download section on USBizi page on GHI’s online catalog.
This is the code. I know the physical pin from the USBizi documentation. I cannot get the compiler to accept my attempts at proper reference for the pin, ie does Cpu.pin change to USBizi.pin? I cannot get anything to work.
Cannot convert to static type 'GHIElectronics.NETMF.Hardware.USBizi’The best overloaded method match for ‘GHIElectronics.NETMF.Hardware.OutputCompare.OutputCompare(Microsoft.SPOT.Hardware.Cpu.Pin, bool, int)’ has some invalid arguments
Argument 1: cannot convert from ‘GHIElectronics.NETMF.Hardware.USBizi’ to ‘Microsoft.SPOT.Hardware.Cpu.Pin’
If the code is exactly as it is in your example, with just the single line before setting the oc variable, i’m not sure what the issue is. You shouldn’t need the Cpu.Pin cast, as pin is already a Cpu.Pin as defined in the method parameter.
As far as the compiler is aware for your code, it should only see a Cpu.Pin.
This compiles for me:
public SerialLCD(Microsoft.SPOT.Hardware.Cpu.Pin pin)
{
BYTE_TIME_MS = (int)System.Math.Ceiling((double)BIT_TIME_US *AX_TIMINGS_BUFFER_SIZE / 1000);
OutputCompare oc = new OutputCompare(pin, true, MAX_TIMINGS_BUFFER_SIZE);
}
FEZ_Components.SerialLCD ThisLCD = new FEZ_Components.SerialLCD((Cpu.Pin)USBizi.Pin.IO5);
This is the instruction I am trying to use to access the function previously shared. Hopefully it is properly code tagged.
I have looked at the many example in an effort to solve my problem. I am no code guru, but someone trying to get a product to a customer that pays the bills.
The only possible issue that I can think of is that you have already used that pin with another managed object (InputPort, OutputPort, etc.) and that managed object is not disposed yet, keeping the pin “reserved”.