Main Site Documentation

Cpu.pin


#1

why is it when you define an outputport and inputport you type

 OutputPort((Cpu.Pin)FEZ_Pin.AnalogOut

and not

OutputPort(FEZ_Pin.AnalogOut

ex in the manual it shows the top example and the range finder example code shows the lower one?


#2

You can take a look here

http://msdn.microsoft.com/en-us/library/cc138362.aspx

By default the underlying type of each element in the enum is int

But you don’t want the integer representation , you need the Pin name. So you have to cast to the right type here to Cpu.Pin

 OutputPort((Cpu.Pin)FEZ_Pin.AnalogOut

is the correct usage. The other is maybe a typo or you didn’t have the newest release of the ebook


#3

If you are using the “USBizi pin definitions” then you do not need to cast. We changed the type on FEZ to make the drivers easier for beginners. Also, not all USBizi pins are available on FEZ.
It is a long story but anyway we had reasons to change the type, and so, you need to cast to use.