Skip to content

SPI::write: fix number of transmitted symbols. #9624

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

Merged
merged 2 commits into from
May 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions drivers/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace mbed {

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

SPI::spi_peripheral_s::spi_peripheral_s() : owner(NULL) {
SPI::spi_peripheral_s::spi_peripheral_s() : owner(NULL)
{

}

Expand Down Expand Up @@ -80,7 +81,8 @@ SPI::~SPI()
unlock();
}

struct SPI::spi_peripheral_s *SPI::_lookup(SPIName name, bool or_last) {
struct SPI::spi_peripheral_s *SPI::_lookup(SPIName name, bool or_last)
{
struct SPI::spi_peripheral_s *result = NULL;
core_util_critical_section_enter();
for (uint32_t idx = 0; idx < DEVICE_SPI_COUNT; idx++) {
Expand Down Expand Up @@ -156,7 +158,7 @@ int SPI::write(int value)
lock();
_acquire();
uint32_t ret = 0;
spi_transfer(&_peripheral->spi, &value, (_bits+7)/8, &ret, (_bits+7)/8, NULL);
spi_transfer(&_peripheral->spi, &value, 1, &ret, 1, NULL);
unlock();
return ret;
}
Expand Down