35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
#ifndef __USER_SPI_H__
|
|
#define __USER_SPI_H__
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "main.h"
|
|
#include "spi.h"
|
|
|
|
typedef enum
|
|
{
|
|
AD7124_1 = 0, // 第一个AD7124设备
|
|
AD7124_2 = 1, // 第二个AD7124设备
|
|
DAC161S997 = 2,
|
|
DAC8568 = 3,
|
|
} chip_type_e; // 芯片类型
|
|
|
|
extern int32_t spi_transmit_receive(SPI_HandleTypeDef *hspi, uint8_t *data_write, uint8_t *data_read, uint8_t bytes_number);
|
|
extern int32_t AD7124_OUT_spi_transmit_receive(uint8_t *data_write, uint8_t bytes_number);
|
|
extern SPI_HandleTypeDef hspi1;
|
|
extern SPI_HandleTypeDef hspi2;
|
|
extern SPI_HandleTypeDef hspi3;
|
|
extern void board_spi_init(chip_type_e chip_type);
|
|
extern void board_spi_cs_on(chip_type_e chip_type);
|
|
extern void board_spi_cs_off(chip_type_e chip_type);
|
|
|
|
void dac161s997_cs_on(uint8_t dac_num);
|
|
void dac161s997_cs_off(uint8_t dac_num);
|
|
void dac161s997_spi_init(void);
|
|
void dac8568_spi_init(void);
|
|
|
|
void ad7124_cs_off(uint8_t device_num); // 更新为支持设备号
|
|
void ad7124_cs_on(uint8_t device_num); // 更新为支持设备号
|
|
void ad7124_spi_init(void);
|
|
|
|
#endif
|