46 #include "ReadWriteBits.h"
48 #include "Usb_faked.h"
51 typedef uint8_t
volatile *
const usb_reg;
52 typedef uint8_t
const usb_pin;
59 extern usb_reg FtCtrl_port;
60 extern usb_reg FtCtrl_pin;
62 extern usb_reg FtData_pin;
63 extern usb_reg FtData_ddr;
64 extern usb_reg FtData_port;
67 extern usb_pin FtMiso;
68 extern usb_pin FtChipSelect;
69 extern usb_pin FtClock;
71 extern usb_pin FtMiosio0;
78 enum ft_cmd {FtReadCmd=0xC6, FtWriteCmd=0x86};
79 enum ft_databus_pin_direction {FtIn=0x00, FtOut=0xFF};
80 enum ft_status {FtError=0, FtOk=1};
81 enum ft_clock_edge {FtSample=0, FtDrive=1};
91 SetBit(FtCtrl_port, FtClock) :
92 ClearBit(FtCtrl_port, FtClock);
114 *FtData_ddr = pin_direction;
123 ClearBit(FtCtrl_port, FtChipSelect);
130 SetBit(FtCtrl_port, FtChipSelect);
134 #define _FtClockDatabus _FtClockDatabus_fake
146 #undef _FtClockDatabus
188 return BitIsClear(FtCtrl_pin, FtMiso);
192 #define _FtClockDatabus _FtClockDatabus_fake
193 #define _FtReadDatabus _FtReadDatabus_fake
194 #define _FtDatabusPinDirection _FtDatabusPinDirection_fake
195 #define _FtWriteDatabus _FtWriteDatabus_fake
230 #undef _FtClockDatabus
231 #undef _FtReadDatabus
232 #undef _FtDatabusPinDirection
233 #undef _FtWriteDatabus
243 return BitIsSet(FtCtrl_pin, FtMiso);
251 return BitIsSet(FtData_pin, FtMiosio0);
255 #define FtSelectFT221X FtSelectFT221X_fake
256 #define FtBusTurnaround FtBusTurnaround_fake
257 #define FtIsOk FtIsOk_fake
258 #define FtRead FtRead_fake
259 #define FtWrite FtWrite_fake
260 #define FtUnselectFT221X FtUnselectFT221X_fake
269 uint8_t status = FtError;
281 inline uint8_t UsbWriteByte(uint8_t
byte)
283 uint8_t status = FtError;
296 #undef FtSelectFT221X
297 #undef FtBusTurnaround
301 #undef FtUnselectFT221X
void _FtClockDatabus(uint8_t direction)
bool UsbRxbufferIsEmpty(void)
bool UsbTxbufferIsFull(void)
void FtSelectFT221X(void)
uint8_t UsbReadByte(uint8_t *pbyte)
void _FtWriteDatabus(uint8_t byte)
void FtUnselectFT221X(void)
void _FtReadDatabus(uint8_t *pbyte)
void FtWrite(uint8_t byte)
void FtRead(uint8_t *pbyte)
void FtBusTurnaround(void)
void _FtDatabusPinDirection(uint8_t pin_direction)