aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/i2c.c
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-25 21:58:55 -0800
committerpx4dev <px4@purgatory.org>2013-01-25 21:58:55 -0800
commit6c75c5909e7f72897ddb737c6459ea6bbfab3900 (patch)
treed8fc2dae3d6a947c7fbf5bcb910b29a5e32c85d0 /apps/px4io/i2c.c
parent818e898a7e084d6529da549ca3ea7c7d53fe5c46 (diff)
downloadpx4-firmware-6c75c5909e7f72897ddb737c6459ea6bbfab3900.tar.gz
px4-firmware-6c75c5909e7f72897ddb737c6459ea6bbfab3900.tar.bz2
px4-firmware-6c75c5909e7f72897ddb737c6459ea6bbfab3900.zip
Move the DMA start to immediately after setting it up; less latency at interrupt time, and no chance of getting start/stop calls out of sync.
Diffstat (limited to 'apps/px4io/i2c.c')
-rw-r--r--apps/px4io/i2c.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/px4io/i2c.c b/apps/px4io/i2c.c
index bbb72360b..dca5ceb1d 100644
--- a/apps/px4io/i2c.c
+++ b/apps/px4io/i2c.c
@@ -158,9 +158,6 @@ i2c_interrupt(int irq, FAR void *context)
if (sr1 & I2C_SR1_ADDR) {
- stm32_dmastart(tx_dma, NULL, NULL, false);
- stm32_dmastart(rx_dma, NULL, NULL, false);
-
/* clear ADDR to ack our selection and get direction */
(void)rSR1; /* as recommended, re-read SR1 */
uint16_t sr2 = rSR2;
@@ -222,6 +219,8 @@ i2c_rx_setup(void)
DMA_CCR_PSIZE_32BITS |
DMA_CCR_MSIZE_8BITS |
DMA_CCR_PRIMED);
+
+ stm32_dmastart(rx_dma, NULL, NULL, false);
}
static void
@@ -283,6 +282,8 @@ i2c_tx_setup(void)
DMA_CCR_PSIZE_8BITS |
DMA_CCR_MSIZE_8BITS |
DMA_CCR_PRIMED);
+
+ stm32_dmastart(tx_dma, NULL, NULL, false);
}
static void