diff options
author | nickshl <nicolai.shlapunov@gmail.com> | 2018-09-20 07:25:01 +0300 |
---|---|---|
committer | nickshl <nicolai.shlapunov@gmail.com> | 2018-09-20 07:25:01 +0300 |
commit | d5784223866b90221b6ccd52cb56f62164e344e1 (patch) | |
tree | fcc4d114002504901bb93b00663eab3932d3ad8c /STM32F415APP/DevCore/Display | |
parent | e06bf2d8e4df28f5fb6d97f187dfed0f594480f4 (diff) |
I2C interface, I2C driver and couple libraries. Also some other minor changes.
Diffstat (limited to 'STM32F415APP/DevCore/Display')
-rw-r--r-- | STM32F415APP/DevCore/Display/DisplayDrv.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/STM32F415APP/DevCore/Display/DisplayDrv.cpp b/STM32F415APP/DevCore/Display/DisplayDrv.cpp index 251c634..16c1eac 100644 --- a/STM32F415APP/DevCore/Display/DisplayDrv.cpp +++ b/STM32F415APP/DevCore/Display/DisplayDrv.cpp @@ -133,18 +133,22 @@ Result DisplayDrv::Loop() // Try to take mutex. 1 ms should be enough.
if(touchscreen_mutex.Lock(1U) == Result::RESULT_OK)
{
+ // Set prescaler for SPI it display share save SPI with touchscreen
if(tft_hspi == touch_hspi)
{
- // Set prescaler for SPI
MODIFY_REG(tft_hspi->Instance->CR1, (uint32_t)SPI_CR1_BR_Msk, SPI_BAUDRATEPRESCALER_64);
- // Get touch coordinates
- tmp_is_touch = touch.GetXY(tmp_tx, tmp_ty);
+ }
+ // Get touch coordinates
+ tmp_is_touch = touch.GetXY(tmp_tx, tmp_ty);
+ // Reset prescaler for SPI it display share save SPI with touchscreen
+ if(tft_hspi == touch_hspi)
+ {
// Restore prescaler for SPI
MODIFY_REG(tft_hspi->Instance->CR1, (uint32_t)SPI_CR1_BR_Msk, SPI_BAUDRATEPRESCALER_2);
- // Give semaphore for drawing frame - we can enter in this "if" statement
- // only if mutex taken
- touchscreen_mutex.Release();
}
+ // Give semaphore for drawing frame - we can enter in this "if" statement
+ // only if mutex taken
+ touchscreen_mutex.Release();
}
// If touch state changed (move)
if(is_touch && tmp_is_touch && ((tx != tmp_tx) || (ty != tmp_ty)) )
|