diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-11 11:29:01 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-11 11:29:01 +0200 |
commit | 02e9ebda4c14e1d6d2e383b7546009c393818782 (patch) | |
tree | 5b71ae83a261bdfd34da9218df2b41053ebdba6b /src/glutt-o-logique | |
parent | d4d2ab6997afc703a6c299b47e9b3a11497cda6c (diff) | |
download | glutte-o-matic-02e9ebda4c14e1d6d2e383b7546009c393818782.tar.gz glutte-o-matic-02e9ebda4c14e1d6d2e383b7546009c393818782.tar.bz2 glutte-o-matic-02e9ebda4c14e1d6d2e383b7546009c393818782.zip |
i2c: prefer pdMS_TO_TICKS macro
Diffstat (limited to 'src/glutt-o-logique')
-rw-r--r-- | src/glutt-o-logique/i2c.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/glutt-o-logique/i2c.c b/src/glutt-o-logique/i2c.c index 750f5de..cc784f4 100644 --- a/src/glutt-o-logique/i2c.c +++ b/src/glutt-o-logique/i2c.c @@ -77,7 +77,7 @@ static void i2c_recover_from_lockup(void) GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); - const TickType_t delay = 5 / portTICK_PERIOD_MS; + const TickType_t delay = pdMS_TO_TICKS(5); GPIO_SetBits(GPIOB, GPIOB_PIN_SDA | GPIOB_PIN_SCL); vTaskDelay(delay); @@ -153,7 +153,7 @@ void i2c_init() static int i2c_check_busy_flag(void) { - const TickType_t i2c_timeout = 1000ul / portTICK_PERIOD_MS; + const TickType_t i2c_timeout = pdMS_TO_TICKS(1000); const TickType_t time_start = xTaskGetTickCount(); while (I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY)) { @@ -170,7 +170,7 @@ static int i2c_check_busy_flag(void) static int i2c_check_event(uint32_t event) { - const TickType_t i2c_timeout = 1000ul / portTICK_PERIOD_MS; + const TickType_t i2c_timeout = pdMS_TO_TICKS(1000); const TickType_t time_start = xTaskGetTickCount(); while (!I2C_CheckEvent(I2Cx, event)) { |