/*
 * spi.h
 *
 *  Created on: Jun 19, 2023
 *      Author: true
 */

#ifndef CODE_INC_SPI_H_
#define CODE_INC_SPI_H_



#include <stdint.h>



#define SPI					SPI1

#define SPI_MOSI_NONE		0

#define SPI_MOSI_SPI		1
#define SPI_MOSI_SPI_PORT	GPIOD
#define SPI_MOSI_SPI_PIN	2
#define SPI_MOSI_SPI_PINSRC	GPIO_PinSource_2

#define SPI_CLK_PORT		GPIOD
#define SPI_CLK_PIN			3

#define SPI_MOSI_LED		2
#define SPI_MOSI_LED_PORT	GPIOD
#define SPI_MOSI_LED_PIN	4
#define SPI_MOSI_LED_PINSRC	GPIO_PinSource_4

#define SPI_NO_CALLBACK		(void (*)(void))(0x0)



void spi_init();
void spi_xfer(uint8_t *tx, uint8_t *rx, uint16_t len, void (*cb)(void));

void spi_mosi_sel(uint8_t which);



#endif /* CODE_INC_SPI_H_ */
