aboutsummaryrefslogtreecommitdiffstats
path: root/src/glutt-o-logique
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-11 11:29:01 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-11 11:29:01 +0200
commit02e9ebda4c14e1d6d2e383b7546009c393818782 (patch)
tree5b71ae83a261bdfd34da9218df2b41053ebdba6b /src/glutt-o-logique
parentd4d2ab6997afc703a6c299b47e9b3a11497cda6c (diff)
downloadglutte-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.c6
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)) {