Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI._read_byte() is still used when SPI._read_burst() is defined #107

Open
Frovu opened this issue Apr 8, 2021 · 0 comments
Open

SPI._read_byte() is still used when SPI._read_burst() is defined #107

Frovu opened this issue Apr 8, 2021 · 0 comments

Comments

@Frovu
Copy link

Frovu commented Apr 8, 2021

In w5500.c WIZCHIP_READ() on line ret = WIZCHIP.IF.SPI._read_byte(); function _read_byte() is called even if _read_burst() is defined.

While reading general logic of these WIZCHIP_READ/WRITE functions I assumed that if user defines burst variants of SPI operation one byte variants are not required anymore, but this only mentioned line forces me to implement _read_byte() function explicitly, however in my case it's essentially same as _read_burst(&ret, 1). (I use this driver with STM32 HAL)

Probably it's not an issue and maybe in other implementations using read byte would be faster than read burst (1), but imo it would be nice to allow user to not define one byte callback functions if they defined burst variants already.

Like:

if (!WIZCHIP.IF.SPI._read_burst) {
    ret = WIZCHIP.IF.SPI._read_byte();
} else {
    WIZCHIP.IF.SPI._read_burst(&ret, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant