public void Initialize(MethodDispatchTablePointer firmware, IntExpression pinNumber, bool initialValue) { firmware.GetPIOAndBitmask(pinNumber, ref pio, ref bitmask); pio.PER=bitmask; //enable PIO function if(initialValue) { pio.SODR=bitmask; //output should start high } else { pio.CODR=bitmask; //output should start low } pio.OER=bitmask; //enable output }
public void Initialize(MethodDispatchTablePointer firmware, IntExpression pinNumber, bool initialValue) { firmware.GetPIOAndBitmask(pinNumber, ref pio, ref bitmask); pio.PER = bitmask; //enable PIO function if (initialValue) { pio.SODR = bitmask; //output should start high } else { pio.CODR = bitmask; //output should start low } pio.OER = bitmask; //enable output }
public void InitializeForISR(MethodDispatchTablePointer firmware, FuncPointer isr) { firmware.HAL_InitializeForISR(storage, isr, ((IntExpression)0).AsIntPointer()); }
public void Abort(MethodDispatchTablePointer firmware) { firmware.HAL_Abort(storage); }
public void EnqueueDelta(MethodDispatchTablePointer firmware, IntExpression delayInMicroseconds) { firmware.HAL_EnqueueDelta(storage, delayInMicroseconds); }
public static void GetPIOAndBitmask(this MethodDispatchTablePointer md, IntExpression pin, ref PIOReferenceVariable pio, ref IntVariable bitmask) { md.GetPIOReference(ref pio, pin.ShiftRight(5)); // pin/32 bitmask.Value = ((IntExpression)1).ShiftLeft(pin & 0x1f); // 1<<(pin%32) }
public MethodDispatchTableVariable MethodDispatchTable(string name, MethodDispatchTablePointer optionalInitialValue = null) { return((MethodDispatchTableVariable)DeclareHelper(name, new MethodDispatchTableVariable(), optionalInitialValue)); }
public void Abort(MethodDispatchTablePointer firmware) { firmware.HAL_Abort(storage); }
public void EnqueueDelta(MethodDispatchTablePointer firmware, IntExpression delayInMicroseconds) { firmware.HAL_EnqueueDelta(storage, delayInMicroseconds); }
public void InitializeForISR(MethodDispatchTablePointer firmware, FuncPointer isr) { firmware.HAL_InitializeForISR(storage, isr, ((IntExpression)0).AsIntPointer()); }