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/netdev.h"
26 #include "periph/gpio.h"
27 #include "periph/spi.h"
28 #include "ringbuffer.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 typedef struct {
40  gpio_t ssn_pin;
41  gpio_t reset_pin;
42  gpio_t irq_pin;
43  gpio_t chip_en_pin;
44  gpio_t wake_pin;
46 
50 typedef struct atwinc15x0 {
54  bool connected;
56  uint8_t channel;
57  int8_t rssi;
59  uint8_t* rx_buf;
60  uint16_t rx_len;
63  tpfNmBspIsr bsp_isr;
65 } atwinc15x0_t;
66 
73 void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif /* ATWINC15X0_H */
80 
atwinc15x0
ATWINC15x0 device descriptor type.
Definition: atwinc15x0.h:50
atwinc15x0::rx_len
uint16_t rx_len
Length of an incoming packet, if there is no packet in the buffer, it is 0.
Definition: atwinc15x0.h:60
atwinc15x0_params_t::chip_en_pin
gpio_t chip_en_pin
CHIP_EN pin.
Definition: atwinc15x0.h:43
ringbuffer.h
A utility for storing and retrieving byte data using a ring buffer.
atwinc15x0::channel
uint8_t channel
Channel used for current AP.
Definition: atwinc15x0.h:56
spi.h
Low-level SPI peripheral driver interface definition.
atwinc15x0::connected
bool connected
Indicates whether connected to an AP.
Definition: atwinc15x0.h:54
atwinc15x0::params
atwinc15x0_params_t params
Device initialization parameters.
Definition: atwinc15x0.h:52
atwinc15x0::rssi
int8_t rssi
RSSI last measured by the WiFi module.
Definition: atwinc15x0.h:57
atwinc15x0::ap
char ap[ETHERNET_ADDR_LEN]
BSSID of current AP.
Definition: atwinc15x0.h:55
ethernet.h
Definitions for Ethernet.
atwinc15x0_params_t::ssn_pin
gpio_t ssn_pin
SPI SS pin (slave select LOW active)
Definition: atwinc15x0.h:40
atwinc15x0_params_t::irq_pin
gpio_t irq_pin
IRQN pin (LOW active)
Definition: atwinc15x0.h:42
atwinc15x0_params_t::reset_pin
gpio_t reset_pin
RESET_N pin (LOW active)
Definition: atwinc15x0.h:41
atwinc15x0_params_t
ATWINC15x0 hardware and global parameters.
Definition: atwinc15x0.h:37
spi_clk_t
spi_clk_t
Available SPI clock speeds.
Definition: spi.h:173
atwinc15x0::rx_buf
uint8_t * rx_buf
Incoming packet in receive buffer.
Definition: atwinc15x0.h:59
atwinc15x0::bsp_irq_enabled
bool bsp_irq_enabled
Board support package interrupt enabled.
Definition: atwinc15x0.h:64
netdev.h
Definitions low-level network driver interface.
ETHERNET_ADDR_LEN
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition: hdr.h:33
atwinc15x0_params_t::spi_clk
spi_clk_t spi_clk
SPI clock speed used.
Definition: atwinc15x0.h:39
atwinc15x0_params_t::wake_pin
gpio_t wake_pin
WAKE pin.
Definition: atwinc15x0.h:44
atwinc15x0::bsp_isr
tpfNmBspIsr bsp_isr
Board support package ISR
Definition: atwinc15x0.h:63
netdev
Structure to hold driver state.
Definition: netdev.h:302
atwinc15x0_t
struct atwinc15x0 atwinc15x0_t
ATWINC15x0 device descriptor type.
gpio.h
Low-level GPIO peripheral driver interface definitions.
atwinc15x0::netdev
netdev_t netdev
Pulls in the netdev fields.
Definition: atwinc15x0.h:51
atwinc15x0_setup
void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params)
Setup the ATWINC15x0 WiFi module.
atwinc15x0_params_t::spi
spi_t spi
SPI device.
Definition: atwinc15x0.h:38
spi_t
unsigned int spi_t
Default type for SPI devices.
Definition: spi.h:118