ftdispi, ecpq: use enum for endianness and cs mode
This commit is contained in:
parent
1a952f466a
commit
221e814509
|
|
@ -45,14 +45,14 @@ void EPCQ::wait_wel()
|
|||
{
|
||||
uint8_t cmd = RD_STATUS_REG, recv;
|
||||
|
||||
_spi.setCSmode(SPI_CS_MANUAL);
|
||||
_spi.setCSmode(FtdiSpi::SPI_CS_MANUAL);
|
||||
_spi.clearCs();
|
||||
_spi.ft2232_spi_wr_and_rd(1, &cmd, NULL);
|
||||
do {
|
||||
_spi.ft2232_spi_wr_and_rd(1, NULL, &recv);
|
||||
} while(!(recv & STATUS_REG_WEL));
|
||||
_spi.setCs();
|
||||
_spi.setCSmode(SPI_CS_AUTO);
|
||||
_spi.setCSmode(FtdiSpi::SPI_CS_AUTO);
|
||||
}
|
||||
|
||||
/* wait for WIP goes low by reading
|
||||
|
|
@ -62,14 +62,14 @@ void EPCQ::wait_wip()
|
|||
{
|
||||
uint8_t cmd = RD_STATUS_REG, recv;
|
||||
|
||||
_spi.setCSmode( SPI_CS_MANUAL);
|
||||
_spi.setCSmode( FtdiSpi::SPI_CS_MANUAL);
|
||||
_spi.clearCs();
|
||||
_spi.ft2232_spi_wr_and_rd(1, &cmd, NULL);
|
||||
do {
|
||||
_spi.ft2232_spi_wr_and_rd(1, NULL, &recv);
|
||||
} while(0x00 != (recv & STATUS_REG_WIP));
|
||||
_spi.setCs();
|
||||
_spi.setCSmode( SPI_CS_AUTO);
|
||||
_spi.setCSmode( FtdiSpi::SPI_CS_AUTO);
|
||||
}
|
||||
|
||||
/* enable write enable */
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@
|
|||
|
||||
class FtdiSpi : public FTDIpp_MPSSE, SPIInterface {
|
||||
public:
|
||||
#define SPI_MSB_FIRST 0
|
||||
#define SPI_LSB_FIRST 1
|
||||
|
||||
#define SPI_CS_AUTO 0
|
||||
#define SPI_CS_MANUAL 1
|
||||
enum SPI_endianness {
|
||||
SPI_MSB_FIRST = 0,
|
||||
SPI_LSB_FIRST = 1
|
||||
};
|
||||
|
||||
enum SPI_CS_mode {
|
||||
SPI_CS_AUTO = 0,
|
||||
SPI_CS_MANUAL = 1
|
||||
};
|
||||
|
||||
FtdiSpi(int vid, int pid, unsigned char interface, uint32_t clkHZ,
|
||||
bool verbose);
|
||||
|
|
|
|||
Loading…
Reference in New Issue