SPI slave program to enable communication between the FPGA and the STM32L432 board.

Dependencies:   mbed

Committer:
Zbyszek
Date:
Tue Feb 05 21:43:08 2019 +0000
Revision:
0:8e367d6d8f03
Child:
1:6766e7f4f12f
Finished modifying the SPI slave for the STM32L432 board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Zbyszek 0:8e367d6d8f03 1 #ifndef _SPI_H_
Zbyszek 0:8e367d6d8f03 2 #define _SPI_H_
Zbyszek 0:8e367d6d8f03 3 #define SPI_PORT GPIOA
Zbyszek 0:8e367d6d8f03 4 #define SCK_slave 5
Zbyszek 0:8e367d6d8f03 5 #define MISO_slave 6
Zbyszek 0:8e367d6d8f03 6 #define MOSI_slave 7
Zbyszek 0:8e367d6d8f03 7 #define CS_slave 8
Zbyszek 0:8e367d6d8f03 8
Zbyszek 0:8e367d6d8f03 9 #define clr_CS() GPIOA->BSRR=(1u<<(CS_slave+16))
Zbyszek 0:8e367d6d8f03 10 #define set_CS() GPIOA->BSRR=(1u<<CS_slave)
Zbyszek 0:8e367d6d8f03 11
Zbyszek 0:8e367d6d8f03 12 //#include <stm32f4xx.h>
Zbyszek 0:8e367d6d8f03 13 #include <stm32l4xx.h> //Uncomment this to use the nano board and comment the one above
Zbyszek 0:8e367d6d8f03 14
Zbyszek 0:8e367d6d8f03 15 int transfer_spi_slave(unsigned short send_val);
Zbyszek 0:8e367d6d8f03 16 int transfer_spi_master(unsigned short send_val);
Zbyszek 0:8e367d6d8f03 17 void init_spi1(void);
Zbyszek 0:8e367d6d8f03 18
Zbyszek 0:8e367d6d8f03 19 #endif