初始版本
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
#ifndef __HDL_SPI_H_
|
||||
#define __HDL_SPI_H_
|
||||
|
||||
#include "hc32_ll.h"
|
||||
#include "hdl_clk.h"
|
||||
|
||||
|
||||
//logic spi1
|
||||
#define SPI1_CLOCK FCG1_PERIPH_SPI1
|
||||
#define SPI1_INSTANCE CM_SPI1
|
||||
|
||||
#define SPI1_SCLK_FUNC GPIO_FUNC_43
|
||||
#define SPI1_SCLK_PORT GPIO_PORT_A
|
||||
#define SPI1_SCLK_PIN GPIO_PIN_00
|
||||
|
||||
|
||||
#define SPI1_MISO_FUNC GPIO_FUNC_41
|
||||
#define SPI1_MISO_PORT GPIO_PORT_A
|
||||
#define SPI1_MISO_PIN GPIO_PIN_02
|
||||
|
||||
|
||||
#define SPI1_MOSI_FUNC GPIO_FUNC_40
|
||||
#define SPI1_MOSI_PORT GPIO_PORT_A
|
||||
#define SPI1_MOSI_PIN GPIO_PIN_03
|
||||
|
||||
|
||||
|
||||
//logic spi2
|
||||
#define SPI2_CLOCK FCG1_PERIPH_SPI4
|
||||
#define SPI2_INSTANCE CM_SPI4
|
||||
|
||||
|
||||
#define SPI2_SCLK_FUNC GPIO_FUNC_47
|
||||
#define SPI2_SCLK_PORT GPIO_PORT_B
|
||||
#define SPI2_SCLK_PIN GPIO_PIN_13
|
||||
|
||||
#define SPI2_MISO_FUNC GPIO_FUNC_45
|
||||
#define SPI2_MISO_PORT GPIO_PORT_B
|
||||
#define SPI2_MISO_PIN GPIO_PIN_14
|
||||
|
||||
#define SPI2_MOSI_FUNC GPIO_FUNC_44
|
||||
#define SPI2_MOSI_PORT GPIO_PORT_B
|
||||
#define SPI2_MOSI_PIN GPIO_PIN_15
|
||||
|
||||
|
||||
|
||||
//logic spi3
|
||||
#define SPI3_CLOCK FCG1_PERIPH_SPI3
|
||||
#define SPI3_INSTANCE CM_SPI3
|
||||
|
||||
#define SPI3_SCLK_PORT GPIO_PORT_B
|
||||
#define SPI3_SCLK_PIN GPIO_PIN_06
|
||||
#define SPI3_SCLK_FUNC GPIO_FUNC_43
|
||||
|
||||
#define SPI3_MISO_PORT GPIO_PORT_B
|
||||
#define SPI3_MISO_PIN GPIO_PIN_07
|
||||
#define SPI3_MISO_FUNC GPIO_FUNC_41
|
||||
|
||||
#define SPI3_MOSI_PORT GPIO_PORT_B
|
||||
#define SPI3_MOSI_PIN GPIO_PIN_08
|
||||
#define SPI3_MOSI_FUNC GPIO_FUNC_40
|
||||
|
||||
|
||||
void hdl_spi1_init(void);
|
||||
|
||||
uint8_t hdl_spi1_txrx(uint8_t w_data);
|
||||
|
||||
void hdl_spi2_init(void);
|
||||
|
||||
uint8_t hdl_spi2_txrx(uint8_t w_data);
|
||||
|
||||
void hdl_spi3_init(void);
|
||||
|
||||
uint8_t hdl_spi3_txrx(uint8_t w_data);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user