Hi,
I am fairly new to MBedOS
I have the SPI Asynch example running on my STM32F429 pcb
but I cannot separate the class structure from the app_start
- How can I save the SPI_Asynch class in a separate file, away from the app_startā¦
The code from the example is shown below, but I have several questions about the syntax.
-
Why does this class use the namespace minar ?
-
where can I see some documentation for the declaration and this usage ?
<>
>
spi.transfer()
.tx(tx_buf, SHORT_XFR)
.rx(rx_buf, SHORT_XFR)
.callback(SPI::event_callback_t(this, &SPITest::short_transfer_complete_cb), SPI_EVENT_COMPLETE)
.apply());
<
I understand how to adjust the SPI pins for my PCB (yotta_targets\stm32f429i-disco-gcc\target.json) but
4. where are these declarations ?
YOTTA_CFG_HARDWARE_TEST_PINS_SPI_MOSI
-
where can I find the documentation that describes āthisā in the eventcallback
-
is thisScheduled callback FunctionPointer0 limited to a single class ? mbed::util ?? ( I am new to this)
<>
>
Scheduler::postCallback(mbed::util::FunctionPointer0(&test, &SPITest::start).bind());
<
SPI_Asynch example works unadjusted;
<>
using namespace minar;
class SPITest {
public:
SPITest(): spi(YOTTA_CFG_HARDWARE_TEST_PINS_SPI_MOSI, YOTTA_CFG_HARDWARE_TEST_PINS_SPI_MISO,
YOTTA_CFG_HARDWARE_TEST_PINS_SPI_SCLK), cs(YOTTA_CFG_HARDWARE_TEST_PINS_SPI_SSEL) {
for (uint32_t i = 0; i < sizeof(tx_buf); i++) {
tx_buf[i] = i + TEST_BYTE_TX_BASE;
}
cs = 1;
}
void start() {
printf("Starting short transfer test\r\n");
init_rx_buffer();
cs = 0;
printf("Result is %d\r\n", spi.transfer()
.tx(tx_buf, SHORT_XFR)
.rx(rx_buf, SHORT_XFR)
.callback(SPI::event_callback_t(this, &SPITest::short_transfer_complete_cb), SPI_EVENT_COMPLETE)
.apply());
}
private:
>
void init_rx_buffer() {
. . . . .
<