37 lines
909 B
C
37 lines
909 B
C
//
|
|
// Created by cfif on 28.09.22.
|
|
//
|
|
|
|
#ifndef SPIPORT_ARTERY_H
|
|
#define SPIPORT_ARTERY_H
|
|
|
|
#include "SpiPort.h"
|
|
#include CMSIS_device_header
|
|
#include "cmsis_os2.h"
|
|
#include "GpioPinInterface.h"
|
|
|
|
typedef struct {
|
|
spi_type *spi;
|
|
//решение на случай одного чипа на шине
|
|
tGpioPin *chipSelect;
|
|
} tSpiPortArtery;
|
|
|
|
tSpiPortArtery vSpiPortInit(
|
|
spi_type *spi,
|
|
spi_frame_bit_num_type spiFrameBit,
|
|
spi_mclk_freq_div_type mclkDIV,
|
|
spi_clock_polarity_type clockPolarity,
|
|
spi_clock_phase_type clockPhase,
|
|
crm_periph_clock_type spiClock,
|
|
tGpioPin *chipSelect
|
|
);
|
|
|
|
|
|
#define vSpiPortInitName(NAME, spiFrameBit, mclkDIV, clockPolarity, clockPhase, CS) \
|
|
vSpiPortInit(NAME, spiFrameBit, mclkDIV, clockPolarity, clockPhase, CRM_##NAME##_PERIPH_CLOCK, CS)
|
|
|
|
|
|
tSpiPortIO vSpiPortGetIo(tSpiPortArtery *env);
|
|
|
|
#endif //SPIPORT_ARTERY_H
|