57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/*
|
|
* spi.h
|
|
*
|
|
* Created on: May 27, 2022
|
|
* Author: Keith.Lloyd
|
|
*/
|
|
|
|
#ifndef SPI_H_
|
|
#define SPI_H_
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
|
|
#define SPI_XFER_BUFFER_SIZE (128)
|
|
|
|
|
|
|
|
#define PORT0 0
|
|
#define PORT1 1
|
|
#define SIGNAL_PORT PORT1
|
|
|
|
#define SIG_CS_GPIO_PIN 9
|
|
#define SIG_RST_GPIO_PIN 12
|
|
#define SD_CS_GPIO_PIN 10
|
|
#define SD_RST_GPIO_PIN 13
|
|
#define RAMP_CS_GPIO_PIN 11
|
|
#define RAMP_RST_GPIO_PIN 14
|
|
#define POT_CS_GPIO_PIN 7
|
|
//#define PORT_LE_CS_GPIO_PIN 5 // 208002
|
|
#define PORT_LE_CS_GPIO_PIN 19 // 208004
|
|
|
|
#define EEP_CS_GPIO_PIN 10
|
|
#define POT_CS2_GPIO_PIN 21
|
|
#define CS_LOW 0
|
|
#define CS_HIGH 1
|
|
|
|
|
|
typedef enum {
|
|
SIGNAL,
|
|
SDSIGNAL,
|
|
RAMP,
|
|
AMPLITUDE,
|
|
EXPANDER,
|
|
E2PROM,
|
|
PSU_VCTRL,
|
|
BOTH_SIGNAL
|
|
} SPI_MODE_t;
|
|
|
|
void SPI_Init(void);
|
|
void SPI3_Test(void);
|
|
void SPI0_SendBytes(uint8_t *sendData, uint16_t numBytes, SPI_MODE_t destination);
|
|
void SPI0_SendPotData(uint16_t *sendData, uint16_t numWords, SPI_MODE_t destination);
|
|
void SPI3_SendBytes(uint8_t *sendData, uint16_t numBytes);
|
|
void SPI0_Chip_Select(uint8_t state, SPI_MODE_t destination);
|
|
void SPI0_SetupForDDS(uint32_t onOff, SPI_MODE_t destination);
|
|
#endif /* SPI_H_ */
|