private void Rotary_Rotated(IRotaryEncoder sender, RotaryEncoderRotatedEventArgs args) { Dispatcher.Run(() => { AddOutput(string.Format("Rotary rotated {0}", args.Direction)); }); }
private void Init(ITextDisplay display, IRotaryEncoder encoder, IButton buttonNext, IButton buttonPrevious, IButton buttonSelect, MenuPage menuTree) { if (encoder != null) { _encoder = encoder; } else if (buttonNext != null && buttonPrevious != null) { _buttonPrevious = buttonPrevious; _buttonNext = buttonNext; } else { throw new ArgumentNullException("Must have either a Rotary Encoder or Next/Previous buttons"); } _display = display; _buttonSelect = buttonSelect; _rootMenuPage = menuTree; _menuLevel = new Stack(); // Save our custom characters _display.SaveCustomCharacter(TextCharacters.RightArrow.CharMap, TextCharacters.RightArrow.MemorySlot); _display.SaveCustomCharacter(TextCharacters.RightArrowSelected.CharMap, TextCharacters.RightArrow.MemorySlot); _display.SaveCustomCharacter(TextCharacters.BoxSelected.CharMap, TextCharacters.BoxSelected.MemorySlot); }
public void Init(ITextDisplay display, IRotaryEncoder encoder, IButton buttonSelect) { _display = display; _encoder = encoder; _buttonSelect = buttonSelect; _isInit = true; }
public LocalControlModule(ILCDCharDisplay display, IRotaryEncoder encoder, AudioCore audio) { LcmActivated = false; // this module is default in-active _display = display; _encoder = encoder; _audio = audio; Keyboard2.Clear(); //Keyboard2.Clear(); }
void EncoderOnRotated(IRotaryEncoder sender, RotaryEncoderRotatedEventArgs args) { if (args.Direction == RotationDirection.Clockwise) { _counter++; } else { _counter--; } Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => EncoderValue.Text = _counter.ToString()); }
public KnobSet(IRotaryEncoder rotaryEncoder, ILCDCharDisplay charDisplay, AudioCore audio, SchedulingCore scheduler, LocalControlModule lcm) { PlayModeActivated = true; _audio = audio; _lcm = lcm; _currentButtonState = (ButtonState) (-1); _position = -1; _playingPosition = -1; _playing = false; _isKnobPressed = false; KnobEntries = new ArrayList(); _encoder = rotaryEncoder; // TODO : Optimize is to not to install eventhandlers when knob is disabled by user settings // TODO : also no need to load the knob file _encoder.RotaryMoved += EncoderMoved; _encoder.ButtonStateChanged += EncoderButtonStateChanged; _encoder.RotaryMoved += _lcm.EncoderMoved; Parse(); }
public Menu(ITextDisplay display, IRotaryEncoder encoder, IButton buttonSelect, byte[] menuResource, bool showBackOnRoot = false) { _showBackOnRoot = showBackOnRoot; Init(display, encoder, null, null, buttonSelect, ParseMenuData(menuResource)); }