ARMmbed/mbed-os-5-docs

Can't create a SPISlave Object

marcoumlaut opened this issue · 4 comments

When I try to create a SPISlave Object the compiler throws an error :

src\main.cpp:7:1: error: 'SPISlave' does not name a type; did you mean 'SPIName'?
SPISlave device(D12, D11, D13, D10); // mosi, miso, sclk, ssel
^~~~~~~~
SPIName
src\main.cpp: In function 'int main()':
src\main.cpp:11:5: error: 'device' was not declared in this scope
device.reply(0x00); // Prime SPI with first reply
^~~~~~
src\main.cpp:11:5: note: suggested alternative: 'dev_t'
device.reply(0x00); // Prime SPI with first reply
^~~~~~
dev_t
C:\Users\mabs.platformio\packages\framework-arduino-nrf52-mbedos\cores\arduino\USB\USBCDC.cpp: In member function 'virtual const uint8_t* arduino::USBCDC::configuration_desc(uint8_t)':
C:\Users\mabs.platformio\packages\framework-arduino-nrf52-mbedos\cores\arduino\USB\USBCDC.cpp:544:35: warning: narrowing conversion of '((((arduino::USBCDC*)this)->arduino::USBCDC::extraDescriptor != 0) ? 5 : 0)' from 'int'
to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]
(extraDescriptor != NULL) ? 0x5 : 0x0, // iInterface
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
Compiling .pio\build\nano33ble\FrameworkArduino\main.cpp.o
*** [.pio\build\nano33ble\src\main.cpp.o] Error 1
Compiling .pio\build\nano33ble\FrameworkArduino\mbed\platform\cxxsupport\mstd_mutex.cpp.o

I think maybe the problem is, that in the SPISlave.h library there are inactive regions.

This is my code:

#include <mbed.h>

void frequency(int hz = 10000000);
void format(int bits = 8, int mode = 0);

SPISlave device(D12, D11, D13, D10); // mosi, miso, sclk, ssel

int main()
{
device.reply(0x00); // Prime SPI with first reply
while (1) {
if (device.receive()) {
int v = device.read(); // Read byte from master
v = (v + 1) % 0x100; // Add one to it, modulo 256
device.reply(v); // Make this the next reply
}
}
}

Here you see the inactive codesession. How can I solve the problem, that I can create SPISlave objects?

image
image

Code and error:
image

@marcoumlaut This issue has an incomplete or old issue template.For future reference please use an up to date clone of the repository before raising issues. Many thanks.

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTOSM-3209

@ciarmcom Thank you for the response.
This page https://os.mbed.com/docs/mbed-os/v6.6/mbed-os-api-doxy/_s_p_i_slave_8h_source.html referenced to this repo sorry.
Where can I track my issue now? The Jira page is unavailable for me.

see in the new issue