Loading...
Searching...
No Matches
atwinc15x0.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef ATWINC15X0_H
21#define ATWINC15X0_H
22
23#include "bsp/include/nm_bsp.h"
24#include "net/ethernet.h"
25#include "net/wifi.h"
26#include "net/netdev.h"
27#include "periph/gpio.h"
28#include "periph/spi.h"
29#include "ringbuffer.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
41#ifndef CONFIG_ATWINC15X0_RECV_BCAST
42#define CONFIG_ATWINC15X0_RECV_BCAST (1)
43#endif
44
49#ifndef CONFIG_ATWINC15X0_SCAN_LIST_NUMOF
50#define CONFIG_ATWINC15X0_SCAN_LIST_NUMOF (3)
51#endif
52
56typedef struct {
57 spi_t spi;
59 gpio_t ssn_pin;
60 gpio_t reset_pin;
61 gpio_t irq_pin;
62 gpio_t chip_en_pin;
63 gpio_t wake_pin;
65
80
84typedef struct atwinc15x0 {
89#if IS_USED(MODULE_ATWINC15X0_DYNAMIC_CONNECT) || defined(DOXYGEN)
91#endif
92 uint8_t channel;
93 int8_t rssi;
95 uint8_t* rx_buf;
96 uint16_t rx_len;
99 tpfNmBspIsr bsp_isr;
102
110void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx);
111
112#ifdef __cplusplus
113}
114#endif
115
116#endif /* ATWINC15X0_H */
atwinc15x0_state_t
ATWINC15x0 internal states.
Definition atwinc15x0.h:69
@ ATWINC15X0_STATE_DISCONNECTED_SCANNING
Scanning state when disconnected.
Definition atwinc15x0.h:73
@ ATWINC15X0_STATE_CONNECTED_CONNECTING
Connecting state where disconnect event is not yet received.
Definition atwinc15x0.h:77
@ ATWINC15X0_STATE_DISCONNECTED
Disconnect state.
Definition atwinc15x0.h:72
@ ATWINC15X0_STATE_SLEEP
Sleep state.
Definition atwinc15x0.h:70
@ ATWINC15X0_STATE_CONNECTED
Connected state.
Definition atwinc15x0.h:75
@ ATWINC15X0_STATE_DISCONNECTING
Disconnect received when connected before.
Definition atwinc15x0.h:71
@ ATWINC15X0_STATE_DISCONNECTED_CONNECTING
Connecting state where disconnected before.
Definition atwinc15x0.h:74
@ ATWINC15X0_STATE_CONNECTED_SCANNING
Scanning state when connected.
Definition atwinc15x0.h:76
struct atwinc15x0 atwinc15x0_t
ATWINC15x0 device descriptor type.
void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx)
Setup the ATWINC15x0 WiFi module.
spi_clk_t
Definition periph_cpu.h:352
Definitions low-level network driver interface.
Low-level GPIO peripheral driver interface definitions.
Definitions for Ethernet.
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition hdr.h:32
#define WIFI_SSID_LEN_MAX
Maximum length of an SSID.
Definition wifi.h:115
A utility for storing and retrieving byte data using a ring buffer.
Low-level SPI peripheral driver interface definition.
ATWINC15x0 hardware and global parameters.
Definition atwinc15x0.h:56
spi_clk_t spi_clk
SPI clock speed used.
Definition atwinc15x0.h:58
spi_t spi
SPI device.
Definition atwinc15x0.h:57
gpio_t chip_en_pin
CHIP_EN pin.
Definition atwinc15x0.h:62
gpio_t reset_pin
RESET_N pin (LOW active)
Definition atwinc15x0.h:60
gpio_t irq_pin
IRQN pin (LOW active)
Definition atwinc15x0.h:61
gpio_t ssn_pin
SPI SS pin (slave select LOW active)
Definition atwinc15x0.h:59
gpio_t wake_pin
WAKE pin.
Definition atwinc15x0.h:63
ATWINC15x0 device descriptor type.
Definition atwinc15x0.h:84
int8_t rssi
RSSI last measured by the WiFi module.
Definition atwinc15x0.h:93
uint8_t channel
Channel used for current AP.
Definition atwinc15x0.h:92
atwinc15x0_state_t state
Device state.
Definition atwinc15x0.h:87
tpfNmBspIsr bsp_isr
Board support package ISR
Definition atwinc15x0.h:99
bool bsp_irq_enabled
Board support package interrupt enabled.
Definition atwinc15x0.h:100
netdev_t netdev
Pulls in the netdev fields.
Definition atwinc15x0.h:85
uint8_t * rx_buf
Incoming packet in receive buffer.
Definition atwinc15x0.h:95
uint16_t rx_len
Length of an incoming packet, if there is no packet in the buffer, it is 0.
Definition atwinc15x0.h:96
char ssid[WIFI_SSID_LEN_MAX+1]
SSID of current AP.
Definition atwinc15x0.h:90
atwinc15x0_params_t params
Device initialization parameters.
Definition atwinc15x0.h:86
char ap[ETHERNET_ADDR_LEN]
BSSID of current AP.
Definition atwinc15x0.h:88
Structure to hold driver state.
Definition netdev.h:365
Definitions for Wi-Fi.