<root>
<file schema='102' />
<macros >
<macro >
<flowline name='CheckForChanges' description='Polling function to check changes
Returns 1 for chaged, 0 for no change, 255 for error' statediag='0' >
<return name='Return' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
<local name='maskcheck' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
<local name='p1' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
<local name='p2' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
<command class_type='calculation' title='Mark success' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.Return = 0' />
</command>
<command class_type='decision' title='If enabled' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Enabled' swap='0' >
<flowline >
<command class_type='decision' title='Decision' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='pin_a' swap='0' >
<flowline >
<command class_type='calculation' title='Calculation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.p1 = 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Calculation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.p1 = 0' />
</command>
</flowline>
</command>
<command class_type='decision' title='Decision' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='pin_b' swap='0' >
<flowline >
<command class_type='calculation' title='Calculation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.p2 = 2' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Calculation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.p2 = 0' />
</command>
</flowline>
</command>
<command class_type='calculation' title='Set up mask correctly' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.maskcheck = .p1 | .p2' />
<exp exp='' />
</command>
<command class_type='decision' title='Check no change' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='.maskcheck = Encoder_Mask' swap='0' >
<flowline >
<command class_type='goto' title='Goto Connection Point' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' labelid='0' labelname='' />
</flowline>
<flowline />
</command>
<command class_type='decision' title='Check corruption' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='.maskcheck == ((~Encoder_Mask) &amp; 0x03)' swap='0' >
<flowline >
<command class_type='calculation' title='Reset Encoder mask for next operation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Mask = .maskcheck' />
</command>
<command class_type='calculation' title='Corrupted' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.Return = 255' />
</command>
<command class_type='goto' title='Goto Connection Point' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' labelid='0' labelname='' />
</flowline>
<flowline />
</command>
<command class_type='decision' title='Decision' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='VarType = 0' swap='0' >
<flowline >
<command class_type='switch' title='Switch' textarea='219,65,219,65' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='.maskcheck' >
<case >
<flowline />
</case>
<case exp='0' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 2' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
<case exp='1' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 0' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
<case exp='2' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 3' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
<case exp='3' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 1' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count = Encoder_Count - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
</command>
</flowline>
<flowline />
</command>
<command class_type='decision' title='Decision' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='VarType = 1' swap='0' >
<flowline >
<command class_type='switch' title='Switch' textarea='219,65,219,65' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='.maskcheck' >
<case >
<flowline />
</case>
<case exp='0' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 2' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
<case exp='1' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 0' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
<case exp='2' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 3' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
<case exp='3' >
<flowline >
<command class_type='decision' title='If moved up' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='Encoder_Mask == 1' swap='0' >
<flowline >
<command class_type='calculation' title='Increment' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long + 1' />
</command>
</flowline>
<flowline >
<command class_type='calculation' title='Decrement' textshow='0' textarea='36,0,37,1' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Count_Long = Encoder_Count_Long - 1' />
</command>
</flowline>
</command>
</flowline>
</case>
</command>
</flowline>
<flowline />
</command>
<command class_type='calculation' title='Reset Encoder mask for next operation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='Encoder_Mask = .maskcheck' />
</command>
<command class_type='calculation' title='Mark success' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
<exp exp='.Return = 1' />
</command>
</flowline>
<flowline />
</command>
<command class_type='label' title='Connection Point' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' labelid='0' labelname='A' />
</flowline>
</macro>
</macros>
<variables >
<variable public='0' >
<def class_type='variable' name='Encoder_Count' type='s16' description='A counter for the encoder position' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
</variable>
<variable public='0' >
<def class_type='variable' name='Encoder_Mask' type='u8' description='Mask of the pin state for the encoder' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
</variable>
<variable public='0' >
<def class_type='variable' name='Encoder_Count_Long' type='s32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
</variable>
<variable public='0' >
<def class_type='variable' name='Encoder_Enabled' type='u8' description='True if enabled, else false' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
</variable>
</variables>
</root>
