public ESP32Driver(ITestBench testBench, Gpio p_wifi_en, Gpio p_wifi_io0, Serial serial, bool debug) { this.testBench = testBench; _p_wifi_en = p_wifi_en; _p_wifi_io0 = p_wifi_io0; _serial = serial; _baudrate = serial.baudrate; _rts = serial.rts; _cts = serial.cts; _flow_control = serial.flow_control; _smutex = new object(); _parser = new ATCmdParser(testBench, serial, "\r\n"); _parser.oob("+IPD", new EventHandler(_packet_handler)); _parser.oob("0,CONNECT", new EventHandler(_connect_handler_0)); _parser.oob("1,CONNECT", new EventHandler(_connect_handler_1)); _parser.oob("2,CONNECT", new EventHandler(_connect_handler_2)); _parser.oob("3,CONNECT", new EventHandler(_connect_handler_3)); _parser.oob("4,CONNECT", new EventHandler(_connect_handler_4)); _parser.oob("0,CLOSED", new EventHandler(_closed_handler_0)); _parser.oob("1,CLOSED", new EventHandler(_closed_handler_1)); _parser.oob("2,CLOSED", new EventHandler(_closed_handler_2)); _parser.oob("3,CLOSED", new EventHandler(_closed_handler_3)); _parser.oob("4,CLOSED", new EventHandler(_closed_handler_4)); _parser.oob("WIFI ", new EventHandler(_connection_status_handler)); }
private IUnitInterface CreateGpio(ref gpio_t obj, PinName pin) { if (pin == PinName.NC) { return(null); } if (!interfaces.TryGetValue(obj.id, out var uif)) { if (pin_if.ContainsKey(pin)) { throw new ArgumentException(); } uif = new Gpio(pin); obj.id = uif.GetHashCode(); interfaces.Add(obj.id, uif); if (pin == PinName.P4_5) { obj.fthandle = fthandle; obj.ftpin = 3; } } return(uif); }
public IESP32 esp32_init(PinName en, PinName io0, PinName tx, PinName rx, bool debug, PinName rts, PinName cts, int baudrate) { if (esp != null) { return(esp); } Gpio gpio_en = null; if (en != PinName.NC) { var en_obj = new gpio_t(); gpio_en = (Gpio)CreateGpio(ref en_obj, en); gpio_en.SetDirection(PinDirection.PIN_OUTPUT); } Gpio gpio_io0 = null; if (io0 != PinName.NC) { var io0_obj = new gpio_t(); gpio_io0 = (Gpio)CreateGpio(ref io0_obj, io0); gpio_io0.SetDirection(PinDirection.PIN_OUTPUT); } var serial_obj = new serial_t(); var serial = (Serial)CreateSerial(ref serial_obj, tx, rx, rts, cts); serial.SetBaudRate(baudrate); esp = new ESP32Driver(this, gpio_en, gpio_io0, serial, debug); return(esp); }
public GpioLED(Gpio gpio, Label label, Color on, Color off) { this.gpio = gpio; this.label = label; this.on = on; this.off = off; }
public GpioButton(Gpio gpio, Button button) { this.gpio = gpio; this.button = button; button.MouseDown += Button_MouseDown; button.MouseUp += Button_MouseUp; }