Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mpsse.o: support.o
$(CC) $(CFLAGS) $(LDFLAGS) -DLIBFTDI1=$(LIBFTDI1) -c mpsse.c

fast.o: support.o
$(CC) $(CFLAGS) $(LDFLAGS) -c fast.c
$(CC) $(CFLAGS) $(LDFLAGS) -DLIBFTDI1=$(LIBFTDI1) -c fast.c

support.o:
$(CC) $(CFLAGS) $(LDFLAGS) -DLIBFTDI1=$(LIBFTDI1) -c support.c
Expand Down
15 changes: 8 additions & 7 deletions src/examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
LDFLAGS=-lmpsse
LDFLAGS=-lmpsse -lftdi1
LIBFTDI1=1

all: spiflash spiflashfast i2ceeprom ds1305 gpio bitbang

spiflash:
$(CC) $(CFLAGS) spiflash.c -o spiflash $(LDFLAGS)
$(CC) $(CFLAGS) -DLIBFTDI1=$(LIBFTDI1) spiflash.c -o spiflash $(LDFLAGS)

spiflashfast:
$(CC) $(CFLAGS) spiflashfast.c -o spiflashfast $(LDFLAGS)
$(CC) $(CFLAGS) -DLIBFTDI1=$(LIBFTDI1) spiflashfast.c -o spiflashfast $(LDFLAGS)

i2ceeprom:
$(CC) $(CFLAGS) i2ceeprom.c -o i2ceeprom $(LDFLAGS)
$(CC) $(CFLAGS) -DLIBFTDI1=$(LIBFTDI1) i2ceeprom.c -o i2ceeprom $(LDFLAGS)

ds1305:
$(CC) $(CFLAGS) ds1305.c -o ds1305 $(LDFLAGS)
$(CC) $(CFLAGS) -DLIBFTDI1=$(LIBFTDI1) ds1305.c -o ds1305 $(LDFLAGS)

gpio:
$(CC) $(CFLAGS) gpio.c -o gpio $(LDFLAGS)
$(CC) $(CFLAGS) -DLIBFTDI1=$(LIBFTDI1) gpio.c -o gpio $(LDFLAGS)

bitbang:
$(CC) $(CFLAGS) bitbang.c -o bitbang $(LDFLAGS)
$(CC) $(CFLAGS) -DLIBFTDI1=$(LIBFTDI1) bitbang.c -o bitbang $(LDFLAGS)

clean:
rm -f *.dSYM
Expand Down
21 changes: 14 additions & 7 deletions src/examples/gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@
from time import sleep

# Open mpsse in GPIO mode
io = MPSSE(GPIO)

io = MPSSE()
io.Open(0x403,0x6010, GPIO, interface=IFACE_B)

pin = GPIOH7
# Toggle the first GPIO pin on/off 10 times
for i in range(0, 10):
print "set direction BCBUS7,6 output, other input", io.SetDirectionHigh(0xC0)
print "set direction BDBUS7,6 output, other input", io.SetDirection(0xC0)
io.PinHigh(pin)
print "GPIO State:", io.PinState(pin)
sleep(0.2)

io.PinHigh(GPIOL0)
print "GPIOL0 State:", io.PinState(GPIOL0)
sleep(1)
io.PinLow(pin)
print "GPIO State:", io.PinState(pin)
sleep(0.2)

io.PinLow(GPIOL0)
print "GPIOL0 State:", io.PinState(GPIOL0)
sleep(1)
print bin(io.ReadPins())
print bin(io.ReadPinsHigh())

io.Close()
10 changes: 5 additions & 5 deletions src/fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ int FastWrite(struct mpsse_context *mpsse, char *data, int size)
{
txsize = mpsse->xsize;
}

if(fast_build_block_buffer(mpsse, mpsse->tx, (unsigned char *) (data + n), txsize, &buf_size) == MPSSE_OK)
{
{
if(raw_write(mpsse, fast_rw_buf, buf_size) == MPSSE_OK)
{
n += txsize;
Expand All @@ -90,7 +90,7 @@ int FastWrite(struct mpsse_context *mpsse, char *data, int size)
}
}
}

return MPSSE_FAIL;
}

Expand Down Expand Up @@ -144,11 +144,11 @@ int FastRead(struct mpsse_context *mpsse, char *data, int size)
}
}
}

return MPSSE_FAIL;
}

/*
/*
* Function to perform fast transfers in MPSSE.
*
* @mpsse - libmpsse context pointer.
Expand Down
Loading