From f8311855d11df25274290c8245c8b2c0ecd4826d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Wed, 21 Mar 2018 07:04:59 +0100 Subject: [PATCH] revert os_delay_us() usage to uint32 (#2310) --- app/modules/tmr.c | 6 +++--- app/tsl2561/tsl2561.c | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/modules/tmr.c b/app/modules/tmr.c index c81c5365..d8ec2ccd 100755 --- a/app/modules/tmr.c +++ b/app/modules/tmr.c @@ -128,9 +128,9 @@ static int tmr_delay( lua_State* L ){ sint32_t us = luaL_checkinteger(L, 1); if(us <= 0) return luaL_error(L, "wrong arg range"); - while(us >= 10000){ - us -= 10000; - os_delay_us(10000); + while(us >= 1000000){ + us -= 1000000; + os_delay_us(1000000); system_soft_wdt_feed (); } if(us>0){ diff --git a/app/tsl2561/tsl2561.c b/app/tsl2561/tsl2561.c index b67defef..cd825de0 100644 --- a/app/tsl2561/tsl2561.c +++ b/app/tsl2561/tsl2561.c @@ -76,12 +76,6 @@ static tsl2561Gain_t _tsl2561Gain = TSL2561_GAIN_1X; static tsl2561Address_t tsl2561Address = TSL2561_ADDRESS_FLOAT; static tsl2561Package_t tsl2561Package = TSL2561_PACKAGE_T_FN_CL; -static void delay_ms(uint16_t ms) -{ - while (ms--) - os_delay_us(1000); -} - /**************************************************************************/ /*! @brief Writes an 8 bit values over I2C @@ -236,13 +230,13 @@ tsl2561Error_t tsl2561GetLuminosity(uint16_t *broadband, uint16_t *ir) { // Wait x ms for ADC to complete switch (_tsl2561IntegrationTime) { case TSL2561_INTEGRATIONTIME_13MS: - delay_ms(14); //systickDelay(14); + os_delay_us(14000); //systickDelay(14); break; case TSL2561_INTEGRATIONTIME_101MS: - delay_ms(102); //systickDelay(102); + os_delay_us(102000); //systickDelay(102); break; default: - delay_ms(404); //systickDelay(404); + os_delay_us(404000); //systickDelay(404); break; }