+instance fromByteCode MTaskDeviceSpec where
+ fromByteCode s = let c = toInt s.[0] in
+ {MTaskDeviceSpec
+ |haveLed=(c bitand 1) > 0
+ ,haveAio=(c bitand 2) > 0
+ ,haveDio=(c bitand 4) > 0
+ ,bytesMemory=from16bit $ s % (1,3)
+ }
+
+derive gPrint Long, UserLED, Button, AnalogPin, DigitalPin, PinMode, Pin, BC, MTaskDeviceSpec
+derive class gCons BC, BCShare
+
+consIndex{|BCValue|} _ = 0
+consName{|BCValue|} _ = "BCValue"
+conses{|BCValue|} = [BCValue 0]
+consNum{|BCValue|} _ = 1
+gPrint{|BCValue|} v ps = gPrint{|*|} (readable $ BCPush v) ps
+
+gEditor{|BCValue|} = {Editor|genUI=genUI`,onEdit=onEdit`,onRefresh=onRefresh`}
+ where
+ genUI` dp (BCValue a) vst = (castEditor a).Editor.genUI dp a vst
+ onEdit` dp jsn (BCValue a) em vst = appSnd3 BCValue $ (castEditor a).Editor.onEdit dp jsn a em vst
+ onRefresh` dp (BCValue a) (BCValue a`) em vst = appSnd3 BCValue $ (castEditor a).Editor.onRefresh dp a (fromByteCode $ toByteCode a`) em vst