implement wiz helper functions to access spi

This commit is contained in:
Wolfgang Hottgenroth 2020-11-07 22:37:33 +01:00
parent 3bd79b1741
commit bd78c7afa1
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
4 changed files with 79 additions and 49 deletions

View File

@ -37,7 +37,7 @@ BUILD_DIR = build
###################################### ######################################
# C sources # C sources
C_SOURCES = \ C_SOURCES = \
User/Src/eeprom.c User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c hottislib/PontCoopScheduler.c \ User/Src/wizHelper.c User/Src/eeprom.c User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c hottislib/PontCoopScheduler.c \
libmbus/mbus/mbus-protocol.c \ libmbus/mbus/mbus-protocol.c \
Core/Src/main.c \ Core/Src/main.c \
Core/Src/gpio.c \ Core/Src/gpio.c \

View File

@ -0,0 +1,6 @@
#ifndef _WIZHELPER_H_
#define _WIZHELPER_H_
#endif // _WIZHELPER_H_

33
cube/User/Src/wizHelper.c Normal file
View File

@ -0,0 +1,33 @@
#include <wizHelper.h>
#include <stdint.h>
#include <main2.h>
#include <spi.h>
void wizchip_cs_select(void) {
HAL_GPIO_WritePin(ETHER_CS_GPIO_Port, ETHER_CS_Pin, GPIO_PIN_RESET);
}
void wizchip_cs_deselect(void) {
HAL_GPIO_WritePin(ETHER_CS_GPIO_Port, ETHER_CS_Pin, GPIO_PIN_SET);
}
uint8_t wizchip_spi_readbyte(void) {
uint8_t rbuf;
HAL_SPI_Receive(&etherSpi, &rbuf, 1, HAL_MAX_DELAY);
return rbuf;
}
void wizchip_spi_writebyte(uint8_t wb) {
HAL_SPI_Transmit(&etherSpi, &wb, 1, HAL_MAX_DELAY);
}
void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {
}
void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {
}

View File

@ -1,9 +0,0 @@
#!/bin/bash
rm w5500/*
pushd ioLibrary_Driver
for D in Ethernet Ethernet/W5500 Internet/DHCP Internet/DNS Internet/httpServer Internet/MQTT; do
cp $D/*.c $D/.h ../w5500
done
popd