mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
s/ConnectTimeo/ConnectTimeout, s/WatchdogTimeo/WatchdogTimeout/
This commit is contained in:
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -23,7 +23,7 @@ var cfg = rtl8720dn.Config{
|
||||
Rx: machine.PC24,
|
||||
Baudrate: 614400,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = rtl8720dn.New(&cfg)
|
||||
|
||||
@@ -27,7 +27,7 @@ var cfg = wifinina.Config{
|
||||
Gpio0: machine.NINA_GPIO0,
|
||||
Resetn: machine.NINA_RESETN,
|
||||
// Watchdog (set to 0 to disable)
|
||||
WatchdogTimeo: time.Duration(20 * time.Second),
|
||||
WatchdogTimeout: time.Duration(20 * time.Second),
|
||||
}
|
||||
|
||||
var netdev = wifinina.New(&cfg)
|
||||
|
||||
@@ -63,7 +63,7 @@ type Config struct {
|
||||
// downed connection and try to recover the connection. Default is
|
||||
// 0secs, which means no watchdog. Set to non-zero to enable
|
||||
// watchodog.
|
||||
WatchdogTimeo time.Duration
|
||||
WatchdogTimeout time.Duration
|
||||
}
|
||||
|
||||
type rtl8720dn struct {
|
||||
@@ -226,7 +226,7 @@ func (r *rtl8720dn) networkDown() bool {
|
||||
}
|
||||
|
||||
func (r *rtl8720dn) watchdog() {
|
||||
ticker := time.NewTicker(r.cfg.WatchdogTimeo)
|
||||
ticker := time.NewTicker(r.cfg.WatchdogTimeout)
|
||||
for {
|
||||
select {
|
||||
case <-r.killWatchdog:
|
||||
@@ -290,7 +290,7 @@ func (r *rtl8720dn) NetConnect() error {
|
||||
|
||||
r.netConnected = true
|
||||
|
||||
if r.cfg.WatchdogTimeo != 0 {
|
||||
if r.cfg.WatchdogTimeout != 0 {
|
||||
go r.watchdog()
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ func (r *rtl8720dn) NetDisconnect() {
|
||||
return
|
||||
}
|
||||
|
||||
if r.cfg.WatchdogTimeo != 0 {
|
||||
if r.cfg.WatchdogTimeout != 0 {
|
||||
r.killWatchdog <- true
|
||||
}
|
||||
r.netDisconnect()
|
||||
|
||||
@@ -195,13 +195,13 @@ type Config struct {
|
||||
Retries int
|
||||
|
||||
// Timeout duration for each connection attempt. Default is 10sec.
|
||||
ConnectTimeo time.Duration
|
||||
ConnectTimeout time.Duration
|
||||
|
||||
// Watchdog ticker duration. On tick, the watchdog will check for
|
||||
// downed connection or hardware fault and try to recover the
|
||||
// connection. Default is 0secs, which means no watchdog. Set to
|
||||
// non-zero to enable watchodog.
|
||||
WatchdogTimeo time.Duration
|
||||
WatchdogTimeout time.Duration
|
||||
}
|
||||
|
||||
type wifinina struct {
|
||||
@@ -244,8 +244,8 @@ func New(cfg *Config) *wifinina {
|
||||
resetn: cfg.Resetn,
|
||||
}
|
||||
|
||||
if w.cfg.ConnectTimeo == 0 {
|
||||
w.cfg.ConnectTimeo = 10 * time.Second
|
||||
if w.cfg.ConnectTimeout == 0 {
|
||||
w.cfg.ConnectTimeout = 10 * time.Second
|
||||
}
|
||||
|
||||
drivers.UseNetdev(&w)
|
||||
@@ -404,7 +404,7 @@ func (w *wifinina) networkDown() bool {
|
||||
}
|
||||
|
||||
func (w *wifinina) watchdog() {
|
||||
ticker := time.NewTicker(w.cfg.WatchdogTimeo)
|
||||
ticker := time.NewTicker(w.cfg.WatchdogTimeout)
|
||||
for {
|
||||
select {
|
||||
case <-w.killWatchdog:
|
||||
@@ -439,7 +439,7 @@ func (w *wifinina) netConnect(reset bool) error {
|
||||
w.showDevice()
|
||||
|
||||
for i := 0; w.cfg.Retries == 0 || i < w.cfg.Retries; i++ {
|
||||
if err := w.connectToAP(w.cfg.ConnectTimeo); err != nil {
|
||||
if err := w.connectToAP(w.cfg.ConnectTimeout); err != nil {
|
||||
switch err {
|
||||
case drivers.ErrConnectTimeout, drivers.ErrConnectFailed:
|
||||
continue
|
||||
@@ -475,7 +475,7 @@ func (w *wifinina) NetConnect() error {
|
||||
|
||||
w.netConnected = true
|
||||
|
||||
if w.cfg.WatchdogTimeo != 0 {
|
||||
if w.cfg.WatchdogTimeout != 0 {
|
||||
go w.watchdog()
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ func (w *wifinina) NetDisconnect() {
|
||||
return
|
||||
}
|
||||
|
||||
if w.cfg.WatchdogTimeo != 0 {
|
||||
if w.cfg.WatchdogTimeout != 0 {
|
||||
w.killWatchdog <- true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user