@web-font-path: "roboto-debian.css";
Loading...
Searching...
No Matches
cyw43_driver.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_CYW43_DRIVER_H
8#define _PICO_CYW43_DRIVER_H
9
16
17#include "pico.h"
18
19#if CYW43_PIN_WL_DYNAMIC
20#include "cyw43_configport.h"
21#endif
22
23#if CYW43_USE_FIRMWARE_PARTITION
24// PICO_CONFIG: CYW43_FIRMWARE_PARTITION_ID, ID of Wi-Fi firmware partition which must match the ID used in the partition table JSON, type=int, default=0x776966696669726d, group=pico_cyw43_driver
25#ifndef CYW43_FIRMWARE_PARTITION_ID
26// The default 0x776966696669726d value is the ASCII encoding of "wififirm"
27#define CYW43_FIRMWARE_PARTITION_ID 0x776966696669726d
28#endif
29#endif
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35struct async_context;
36
45bool cyw43_driver_init(struct async_context *context);
46
52void cyw43_driver_deinit(struct async_context *context);
53
54// PICO_CONFIG: CYW43_PIO_CLOCK_DIV_DYNAMIC, Enable runtime configuration of the clock divider for communication with the wireless chip, type=bool, default=0, group=pico_cyw43_driver
55#ifndef CYW43_PIO_CLOCK_DIV_DYNAMIC
56#define CYW43_PIO_CLOCK_DIV_DYNAMIC 0
57#endif
58
59// PICO_CONFIG: CYW43_PIO_CLOCK_DIV_INT, Integer part of the clock divider for communication with the wireless chip, type=int, default=2, group=pico_cyw43_driver
60#ifndef CYW43_PIO_CLOCK_DIV_INT
61// backwards compatibility using old define
62#ifdef CYW43_PIO_CLOCK_DIV
63#define CYW43_PIO_CLOCK_DIV_INT CYW43_PIO_CLOCK_DIV
64#else
65#define CYW43_PIO_CLOCK_DIV_INT 2
66#endif
67#endif
68
69// PICO_CONFIG: CYW43_PIO_CLOCK_DIV_FRAC8, Fractional part of the clock divider for communication with the wireless chip 0-255, type=int, min=0, max=255, default=0, group=pico_cyw43_driver
70#ifndef CYW43_PIO_CLOCK_DIV_FRAC8
71#ifdef CYW43_PIO_CLOCK_DIV_FRAC
72#define CYW43_PIO_CLOCK_DIV_FRAC8 CYW43_PIO_CLOCK_DIV_FRAC
73#else
74#define CYW43_PIO_CLOCK_DIV_FRAC8 0
75#endif
76#endif
77
78// PICO_CONFIG: CYW43_PIN_WL_DYNAMIC, flag to indicate if cyw43 SPI pins can be changed at runtime, type=bool, advanced=true, group=pico_cyw43_driver
79
80// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_REG_ON, gpio pin to power up the cyw43 chip, type=int, min=0, max=47 on RP2350B, 29 otherwise, advanced=true, group=pico_cyw43_driver
81
82// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_OUT, gpio pin for spi data out to the cyw43 chip, type=int, min=0, max=47 on RP2350B, 29 otherwise, advanced=true, group=pico_cyw43_driver
83
84// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_IN, gpio pin for spi data in from the cyw43 chip, type=int, min=0, max=47 on RP2350B, 29 otherwise, advanced=true, group=pico_cyw43_driver
85
86// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio (irq) pin for the irq line from the cyw43 chip, type=int, min=0, max=47 on RP2350B, 29 otherwise, advanced=true, group=pico_cyw43_driver
87
88// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CLOCK, gpio pin for the spi clock line to the cyw43 chip, type=int, min=0, max=47 on RP2350B, 29 otherwise, advanced=true, group=pico_cyw43_driver
89
90// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, min=0, max=47 on RP2350B, 29 otherwise, advanced=true, group=pico_cyw43_driver
91
92#if CYW43_PIO_CLOCK_DIV_DYNAMIC
103void cyw43_set_pio_clkdiv_int_frac8(uint32_t clock_div_int, uint8_t clock_div_frac8);
104
105// backwards compatibility
106static inline void cyw43_set_pio_clock_divisor(uint16_t clock_div_int, uint8_t clock_div_frac8) {
107 return cyw43_set_pio_clkdiv_int_frac8(clock_div_int, clock_div_frac8);
108}
109#endif
110
111#if CYW43_PIN_WL_DYNAMIC
123int cyw43_set_pins_wl(uint pins[CYW43_PIN_INDEX_WL_COUNT]);
124#endif
125
126#ifdef __cplusplus
127}
128#endif
129#endif
bool cyw43_driver_init(struct async_context *context)
Initializes the lower level cyw43_driver and integrates it with the provided async_context.
Definition cyw43_driver.c:117
void cyw43_driver_deinit(struct async_context *context)
De-initialize the lowever level cyw43_driver and unhooks it from the async_context.
Definition cyw43_driver.c:208
Base structure type of all async_contexts. For details about its use, see pico_async_context.
Definition async_context.h:179