tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
614 stars 194 forks source link

How about adding ConnectToAP to net.DeviceDriver interface? #294

Closed sago35 closed 2 years ago

sago35 commented 3 years ago

If we want to use tinygo-org/drivers/net, we must connect to AccessPoint. I have implemented ConnectToAP() on rtl8720dn, but not on espat and wifinina. By implementing ConnectToAP(), espat/wifinina/rtl8720dn will be able to use almost the same code.

net.DeviceDriver interface https://github.com/tinygo-org/drivers/blob/a0119ffc6f09c088e1bf93639e8775fd8747d7e4/net/driver.go#L3-L17

rtl8720dn.ConnectToAP(ssid string, password string) error https://github.com/tinygo-org/drivers/blob/a0119ffc6f09c088e1bf93639e8775fd8747d7e4/rtl8720dn/wifi.go#L8

ref: https://github.com/tinygo-org/drivers/pull/273#discussion_r659211641

deadprogram commented 2 years ago

@sago35 please see https://github.com/tinygo-org/drivers/pull/357 where I am working on something related to this.

deadprogram commented 2 years ago

I think this is done now @sago35

sago35 commented 2 years ago

Yes, this Issue can be closed. @deadprogram

https://github.com/tinygo-org/drivers/blob/1bb1b621c6cfa60544ff89c510da46858dbe29bb/net/adapter.go#L16-L18