drivers/pn532: adapted to SPI interface changes#6478
drivers/pn532: adapted to SPI interface changes#6478cgundogan merged 2 commits intoRIOT-OS:masterfrom
Conversation
|
build the test-app with |
| } | ||
| else { | ||
| #ifdef PN532_SUPPORT_SPI | ||
| ret = spi_init_master(dev->conf->spi, SPI_CONF_FIRST_RISING, |
There was a problem hiding this comment.
ret is initially set to -1 and this function returns ret => pn532_init always returns -1 this way and thusly fails
|
cf. haukepetersen#36 some fixes to get the |
|
fixed init function and removed debug output from test makefile |
|
@haukepetersen please look at haukepetersen#36 there is another bug |
|
ACK works as expected now. Please squash 👍 |
3d80e72 to
d32cf28
Compare
|
squashed. |
drivers/pn532/pn532.c
Outdated
| } | ||
|
|
||
| buff[0] = 0x80; | ||
| reverse(buff, ret); |
There was a problem hiding this comment.
no idea what happened, but this fix didn't survive the squash operation (: please replace ret with len.
There was a problem hiding this comment.
should be ok now.
d32cf28 to
678a97e
Compare
lebrush
left a comment
There was a problem hiding this comment.
Changes look good except these two small comments. Thanks for the effort @haukepetersen :-) and thanks @cgundogan for testing !!!
tests/driver_pn532/main.c
Outdated
| #elif defined(PN532_SUPPORT_SPI) | ||
| ret = pn532_init_spi(&pn532, &pn532_conf[0]); | ||
| #else | ||
| #error "Error: bus mode not defined" |
There was a problem hiding this comment.
This check is already included in pn532.h :-)
drivers/pn532/pn532.c
Outdated
| else { | ||
| #ifdef PN532_SUPPORT_SPI | ||
| spi_acquire(dev->conf->spi); | ||
| spi_acquire(dev->conf->spi, GPIO_UNDEF, SPI_MODE, SPI_CLK); |
There was a problem hiding this comment.
Documentation in spi.h says cs shall be set to SPI_CS_UNDEF instead of GPIO_UNDEF
|
Btw, I really like that the test application now supports spi too :-) |
678a97e to
3527173
Compare
|
Comments are addressed.
you are absolutely right, will propose a fix. |
|
Nope codewise looks fine :-) but now some boards are not happy about SPI... |
tests/driver_pn532/Makefile
Outdated
|
|
||
| # select if you want to build the SPI or the I2C version of the driver: | ||
| # set PN532_MODE to `i2c` or to `spi` | ||
| TPN532_MODE ?= i2c |
3527173 to
1ae0ad2
Compare
|
hm, that capital |
|
tested again with my local setup. looks fine and both CIs agree => GO |
|
@lebrush can you please provide a backport to the 2017.01 release branch? |
|
👍 will do |
missed in #4780: driver needed adaption to SPI interface changes for its SPI mode.