mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-03 21:48:22 +00:00
Rename mg_tcpip_spi to mg_spi and move it to flash.h
This commit is contained in:
1 parent
1d8c55c892
commit
e7bfbf99fa
23 files changed
+104
-106
No files matched your search
@@ -9,7 +9,7 @@
|
||||
|
||||
struct mg_connection *mqtt_connection;
|
||||
// SPI bus used by the W5500 driver, see MG_TCPIP_DRIVER_W5500_INIT
|
||||
struct mg_tcpip_spi mg_spi = {
|
||||
struct mg_spi mg_spi = {
|
||||
NULL, // SPI metadata
|
||||
[](void *) { digitalWrite(SS_PIN, LOW); SPI.beginTransaction(SPISettings()); },
|
||||
[](void *) { digitalWrite(SS_PIN, HIGH); SPI.endTransaction(); },
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#define SS_PIN 17 // Slave select pin for the W5500 module
|
||||
|
||||
// SPI bus used by the W5500 driver, see MG_TCPIP_DRIVER_W5500_INIT
|
||||
struct mg_tcpip_spi mg_spi = {
|
||||
struct mg_spi mg_spi = {
|
||||
NULL, // SPI metadata
|
||||
[](void *) { digitalWrite(SS_PIN, LOW); SPI.beginTransaction(SPISettings()); },
|
||||
[](void *) { digitalWrite(SS_PIN, HIGH); SPI.endTransaction(); },
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
struct mg_connection *mqtt_connection;
|
||||
// SPI bus used by the W5500 driver, see MG_TCPIP_DRIVER_W5500_INIT
|
||||
struct mg_tcpip_spi mg_spi = {
|
||||
struct mg_spi mg_spi = {
|
||||
NULL, // SPI metadata
|
||||
[](void *) { digitalWrite(SS_PIN, LOW); SPI.beginTransaction(SPISettings()); },
|
||||
[](void *) { digitalWrite(SS_PIN, HIGH); SPI.endTransaction(); },
|
||||
|
||||
@@ -165,7 +165,7 @@ void hwspecific_spi_end(void *arg) {
|
||||
(void) arg;
|
||||
}
|
||||
|
||||
static const struct mg_tcpip_spi spi = {NULL, hwspecific_spi_begin,
|
||||
static const struct mg_spi spi = {NULL, hwspecific_spi_begin,
|
||||
hwspecific_spi_end, hwspecific_spi_txn};
|
||||
|
||||
#ifndef CYW43_RESOURCE_ATTRIBUTE
|
||||
@@ -274,7 +274,7 @@ static void mif_fn(struct mg_tcpip_if *ifp, int ev, void *ev_data) {
|
||||
|
||||
static struct mg_tcpip_driver_cyw_data d = {
|
||||
{WIFI_SSID, WIFI_PASS, "mongoose", "mongoose", 0, 0, 0, 0, 10, true},
|
||||
(struct mg_tcpip_spi *) &spi,
|
||||
(struct mg_spi *) &spi,
|
||||
(struct mg_tcpip_driver_cyw_firmware *) &fw,
|
||||
false,
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ static void spi_txn(void *spi, uint8_t *tx, uint8_t *rx, size_t len) {
|
||||
}
|
||||
|
||||
// SPI bus used by the W5500 driver, see MG_TCPIP_DRIVER_W5500_INIT
|
||||
struct mg_tcpip_spi mg_spi = {NULL, spi_begin, spi_end, spi_txn};
|
||||
struct mg_spi mg_spi = {NULL, spi_begin, spi_end, spi_txn};
|
||||
|
||||
static void ethernet_init(void) {
|
||||
// Init SPI pins
|
||||
|
||||
@@ -151,7 +151,7 @@ static void spi_txn(void *arg, uint8_t *txdata, uint8_t *rxdata, size_t len) {
|
||||
}
|
||||
|
||||
// SPI bus used by the W5500 driver, see MG_TCPIP_DRIVER_W5500_INIT
|
||||
struct mg_tcpip_spi mg_spi = {NULL, spi_begin, spi_end, spi_txn};
|
||||
struct mg_spi mg_spi = {NULL, spi_begin, spi_end, spi_txn};
|
||||
|
||||
|
||||
static void blink_task(void) {
|
||||
|
||||
@@ -66,7 +66,7 @@ static void hwspecific_spi_init(void) {
|
||||
mg_delayms(50);
|
||||
}
|
||||
|
||||
static const struct mg_tcpip_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
static const struct mg_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
|
||||
#ifndef CYW43_RESOURCE_ATTRIBUTE
|
||||
#define CYW43_RESOURCE_ATTRIBUTE
|
||||
@@ -162,7 +162,7 @@ static void mif_fn(struct mg_tcpip_if *ifp, int ev, void *ev_data) {
|
||||
|
||||
|
||||
static struct mg_tcpip_driver_cyw_data d = {
|
||||
{WIFI_SSID, WIFI_PASS, "mongoose", "mongoose", 0, 0, 0, 0, 10, true}, (struct mg_tcpip_spi *)&spi, (struct mg_tcpip_driver_cyw_firmware *)&fw, false};
|
||||
{WIFI_SSID, WIFI_PASS, "mongoose", "mongoose", 0, 0, 0, 0, 10, true}, (struct mg_spi *)&spi, (struct mg_tcpip_driver_cyw_firmware *)&fw, false};
|
||||
|
||||
int main(void) {
|
||||
uart_init(UART_DEBUG, 115200); // Initialise debug printf
|
||||
|
||||
@@ -66,7 +66,7 @@ static void hwspecific_spi_init(void) {
|
||||
mg_delayms(50);
|
||||
}
|
||||
|
||||
static const struct mg_tcpip_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
static const struct mg_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
|
||||
#ifndef CYW43_RESOURCE_ATTRIBUTE
|
||||
#define CYW43_RESOURCE_ATTRIBUTE
|
||||
@@ -162,7 +162,7 @@ static void mif_fn(struct mg_tcpip_if *ifp, int ev, void *ev_data) {
|
||||
|
||||
|
||||
static struct mg_tcpip_driver_cyw_data d = {
|
||||
{WIFI_SSID, WIFI_PASS, "mongoose", "mongoose", 0, 0, 0, 0, 10, true}, (struct mg_tcpip_spi *)&spi, (struct mg_tcpip_driver_cyw_firmware *)&fw, false};
|
||||
{WIFI_SSID, WIFI_PASS, "mongoose", "mongoose", 0, 0, 0, 0, 10, true}, (struct mg_spi *)&spi, (struct mg_tcpip_driver_cyw_firmware *)&fw, false};
|
||||
|
||||
int main(void) {
|
||||
uart_init(UART_DEBUG, 115200); // Initialise debug printf
|
||||
|
||||
@@ -22,7 +22,7 @@ static struct spi spi_pins = {
|
||||
};
|
||||
|
||||
// SPI bus used by the W5500 driver, see MG_TCPIP_DRIVER_W5500_INIT
|
||||
struct mg_tcpip_spi mg_spi = {
|
||||
struct mg_spi mg_spi = {
|
||||
.begin = (void (*)(void *)) spi_begin,
|
||||
.end = (void (*)(void *)) spi_end,
|
||||
.txn = (void (*)(void *, uint8_t *, uint8_t *, size_t)) spi_txn,
|
||||
|
||||
@@ -114,7 +114,7 @@ void hwspecific_spi_init(void) {
|
||||
HAL_GPIO_WritePin(SPI_CHIP_EN_GPIO_Port, SPI_CHIP_EN_Pin, 1);
|
||||
}
|
||||
|
||||
static const struct mg_tcpip_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
static const struct mg_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
|
||||
void wifi_setconfig(void *data) {
|
||||
struct mg_tcpip_driver_st67w6_data *d = (struct mg_tcpip_driver_st67w6_data *) data;
|
||||
@@ -128,6 +128,6 @@ void wifi_setconfig(void *data) {
|
||||
d->wifi.apsecurity = 0;
|
||||
d->wifi.apchannel = 10;
|
||||
d->wifi.apmode = ENABLE_WIFI_AP;
|
||||
d->spi = (struct mg_tcpip_spi *) &spi;
|
||||
d->spi = (struct mg_spi *) &spi;
|
||||
d->is_ready = hwspecific_is_ready;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ void hwspecific_spi_init(void) {
|
||||
hal_gpio_write(SPI_CHIP_EN, 1);
|
||||
}
|
||||
|
||||
static const struct mg_tcpip_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
static const struct mg_spi spi = {NULL, hwspecific_spi_begin, hwspecific_spi_end, hwspecific_spi_txn};
|
||||
|
||||
void wifi_setconfig(void *data) {
|
||||
struct mg_tcpip_driver_st67w6_data *d = (struct mg_tcpip_driver_st67w6_data *) data;
|
||||
@@ -71,6 +71,6 @@ void wifi_setconfig(void *data) {
|
||||
d->wifi.apsecurity = 0;
|
||||
d->wifi.apchannel = 10;
|
||||
d->wifi.apmode = ENABLE_WIFI_AP;
|
||||
d->spi = (struct mg_tcpip_spi *) &spi;
|
||||
d->spi = (struct mg_spi *) &spi;
|
||||
d->is_ready = hwspecific_is_ready;
|
||||
}
|
||||
Reference in new issue
Block a user