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
9#pragma once
10
21
22#include "bsp/include/nm_bsp.h"
23#include "net/ethernet.h"
24#include "net/wifi.h"
25#include "net/netdev.h"
26#include "periph/gpio.h"
27#include "periph/spi.h"
28#include "ringbuffer.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
40#ifndef CONFIG_ATWINC15X0_RECV_BCAST
41#define CONFIG_ATWINC15X0_RECV_BCAST (1)
42#endif
43
48#ifndef CONFIG_ATWINC15X0_SCAN_LIST_NUMOF
49#define CONFIG_ATWINC15X0_SCAN_LIST_NUMOF (3)
50#endif
51
55typedef struct {
56 spi_t spi;
58 gpio_t ssn_pin;
59 gpio_t reset_pin;
60 gpio_t irq_pin;
61 gpio_t chip_en_pin;
62 gpio_t wake_pin;
64
79
83typedef struct atwinc15x0 {
88#if IS_USED(MODULE_ATWINC15X0_DYNAMIC_CONNECT) || defined(DOXYGEN)
90#endif
91 uint8_t channel;
92 int8_t rssi;
93
94 uint8_t* rx_buf;
95 uint16_t rx_len;
97
98 tpfNmBspIsr bsp_isr;
101
109void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx);
110
111#ifdef __cplusplus
112}
113#endif
114
atwinc15x0_state_t
ATWINC15x0 internal states.
Definition atwinc15x0.h:68
@ ATWINC15X0_STATE_DISCONNECTED_SCANNING
Scanning state when disconnected.
Definition atwinc15x0.h:72
@ ATWINC15X0_STATE_CONNECTED_CONNECTING
Connecting state where disconnect event is not yet received.
Definition atwinc15x0.h:76
@ ATWINC15X0_STATE_DISCONNECTED
Disconnect state.
Definition atwinc15x0.h:71
@ ATWINC15X0_STATE_SLEEP
Sleep state.
Definition atwinc15x0.h:69
@ ATWINC15X0_STATE_CONNECTED
Connected state.
Definition atwinc15x0.h:74
@ ATWINC15X0_STATE_DISCONNECTING
Disconnect received when connected before.
Definition atwinc15x0.h:70
@ ATWINC15X0_STATE_DISCONNECTED_CONNECTING
Connecting state where disconnected before.
Definition atwinc15x0.h:73
@ ATWINC15X0_STATE_CONNECTED_SCANNING
Scanning state when connected.
Definition atwinc15x0.h:75
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:348
Definitions low-level network driver interface.
Definitions for Ethernet.
Low-level GPIO peripheral driver interface definitions.
struct netdev netdev_t
Forward declaration for netdev struct.
Definition netdev.h:288
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition hdr.h:31
#define WIFI_SSID_LEN_MAX
Maximum length of an SSID.
Definition wifi.h:114
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:55
spi_clk_t spi_clk
SPI clock speed used.
Definition atwinc15x0.h:57
spi_t spi
SPI device.
Definition atwinc15x0.h:56
gpio_t chip_en_pin
CHIP_EN pin.
Definition atwinc15x0.h:61
gpio_t reset_pin
RESET_N pin (LOW active)
Definition atwinc15x0.h:59
gpio_t irq_pin
IRQN pin (LOW active)
Definition atwinc15x0.h:60
gpio_t ssn_pin
SPI SS pin (slave select LOW active)
Definition atwinc15x0.h:58
gpio_t wake_pin
WAKE pin.
Definition atwinc15x0.h:62
ATWINC15x0 device descriptor type.
Definition atwinc15x0.h:83
int8_t rssi
RSSI last measured by the WiFi module.
Definition atwinc15x0.h:92
uint8_t channel
Channel used for current AP.
Definition atwinc15x0.h:91
atwinc15x0_state_t state
Device state.
Definition atwinc15x0.h:86
tpfNmBspIsr bsp_isr
Board support package ISR.
Definition atwinc15x0.h:98
bool bsp_irq_enabled
Board support package interrupt enabled.
Definition atwinc15x0.h:99
netdev_t netdev
Pulls in the netdev fields.
Definition atwinc15x0.h:84
uint8_t * rx_buf
Incoming packet in receive buffer.
Definition atwinc15x0.h:94
uint16_t rx_len
Length of an incoming packet, if there is no packet in the buffer, it is 0.
Definition atwinc15x0.h:95
char ssid[WIFI_SSID_LEN_MAX+1]
SSID of current AP.
Definition atwinc15x0.h:89
atwinc15x0_params_t params
Device initialization parameters.
Definition atwinc15x0.h:85
char ap[ETHERNET_ADDR_LEN]
BSSID of current AP.
Definition atwinc15x0.h:87
Definitions for Wi-Fi.