Skip to content

Commit dc4e6b8

Browse files
authored
Merge pull request #9624 from mprse/SPI_fix
SPI::write: fix number of transmitted symbols.
2 parents 335a65f + e88dec2 commit dc4e6b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/SPI.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ namespace mbed {
2727

2828
SPI::spi_peripheral_s SPI::_peripherals[DEVICE_SPI_COUNT];
2929

30-
SPI::spi_peripheral_s::spi_peripheral_s() : owner(NULL) {
30+
SPI::spi_peripheral_s::spi_peripheral_s() : owner(NULL)
31+
{
3132

3233
}
3334

@@ -80,7 +81,8 @@ SPI::~SPI()
8081
unlock();
8182
}
8283

83-
struct SPI::spi_peripheral_s *SPI::_lookup(SPIName name, bool or_last) {
84+
struct SPI::spi_peripheral_s *SPI::_lookup(SPIName name, bool or_last)
85+
{
8486
struct SPI::spi_peripheral_s *result = NULL;
8587
core_util_critical_section_enter();
8688
for (uint32_t idx = 0; idx < DEVICE_SPI_COUNT; idx++) {
@@ -156,7 +158,7 @@ int SPI::write(int value)
156158
lock();
157159
_acquire();
158160
uint32_t ret = 0;
159-
spi_transfer(&_peripheral->spi, &value, (_bits+7)/8, &ret, (_bits+7)/8, NULL);
161+
spi_transfer(&_peripheral->spi, &value, 1, &ret, 1, NULL);
160162
unlock();
161163
return ret;
162164
}

0 commit comments

Comments
 (0)