Skip to content

Commit

Permalink
Stop DMA when GPIF is done
Browse files Browse the repository at this point in the history
  • Loading branch information
zeldin committed Apr 22, 2018
1 parent 6a6a653 commit e606fce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions acquisition.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,11 @@ void setup_acquisition(void)
for(i=0; i<NUM_DMA_BUFFERS; i++)
dma_buffer_descriptor[i] = Fx3DmaAllocateDescriptor();
}

void poll_acquisition(void)
{
if (Fx3GpifGetStat(NULL) == FX3_GPIF_DONE) {
Fx3UartTxString("GPIF done, stopping DMA\n");
stop_acquisition();
}
}
1 change: 1 addition & 0 deletions acquisition.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
extern void start_acquisition(uint8_t bits, uint32_t delay, uint16_t clock_divisor_x2);
extern void setup_acquisition(void);
extern void poll_acquisition(void);
2 changes: 2 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ int main(void)
Fx3UsbConnect();

for(;;) {
poll_acquisition();

Fx3GpioSetOutputValueSimple(54, 1);
Fx3UtilDelayUs(500000);
if (!Fx3GpioGetInputValueSimple(45)) {
Expand Down

0 comments on commit e606fce

Please sign in to comment.