/**************************************************************************** * * Copyright © 2018-2019 STMicroelectronics - All Rights Reserved * * License terms: STMicroelectronics Proprietary in accordance with licensing * terms SLA0089 at www.st.com * * THIS SOFTWARE IS DISTRIBUTED "AS IS," AND ALL WARRANTIES ARE DISCLAIMED, * INCLUDING MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * EVALUATION ONLY - NOT FOR USE IN PRODUCTION *****************************************************************************/ /* Inclusion of the main header files of all the imported components in the order specified in the application wizard. The file is generated automatically.*/ #include "components.h" #include "spi_lld_cfg.h" #include "FreeRTOS.h" #include "task.h" /* * SPI TX and RX buffers. */ static uint8_t txbuf[512]; static uint8_t rxbuf[512]; /* Demo tasks */ portTASK_FUNCTION( vTaskOne, pvParameters ) { ( void ) pvParameters; TickType_t xLastWakeTime = xTaskGetTickCount(); for ( ;; ) { vTaskSuspendAll(); xTaskResumeAll(); spi_lld_exchange(&SPID1, 4, txbuf, rxbuf); pal_lld_togglepad(PORT_E, PE_LED1); vTaskDelayUntil( &xLastWakeTime, 200 ); } } /* * Application entry point. */ int main(void) { unsigned i; /* Initialization of all the imported components in the order specified in the application wizard. The function is generated automatically.*/ componentsInit(); /* Enable Interrupts */ irqIsrEnable(); /* Prepare transmit pattern.*/ for (i = 0; i < sizeof(txbuf); i++) { txbuf[i] = (uint8_t)i; } /* Starting driver for test, DSPI_0 I/O pins setup.*/ spi_lld_start(&SPID1, &spi_config_low_speed); /* Creating first task to blink LED0 */ xTaskCreate( vTaskOne, (const char * const)"task #1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); return 0; }