1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/cst816s: migrate to ztimer

This commit is contained in:
Alexandre Abadie 2022-01-02 07:59:38 +01:00
parent 32790eb8f2
commit d3330e1813
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 7 additions and 6 deletions

View File

@ -1,3 +1,4 @@
FEATURES_REQUIRED += periph_gpio_irq
FEATURES_REQUIRED += periph_i2c
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_msec

View File

@ -21,7 +21,7 @@
#include "log.h"
#include "periph/gpio.h"
#include "periph/i2c.h"
#include "xtimer.h"
#include "ztimer.h"
#include "cst816s.h"
#include "cst816s_internal.h"
@ -55,9 +55,9 @@ static void _cst816s_reset(const cst816s_t *dev)
/* Reset, sleep durations based on
* https://github.com/lupyuen/hynitron_i2c_cst0xxse/blob/master/cst0xx_core.c#L1078-L1085 */
gpio_clear(dev->params->reset);
xtimer_usleep(CST816S_RESET_DURATION_LOW);
ztimer_sleep(ZTIMER_MSEC, CST816S_RESET_DURATION_LOW_MS);
gpio_set(dev->params->reset);
xtimer_usleep(CST816S_RESET_DURATION_HIGH);
ztimer_sleep(ZTIMER_MSEC, CST816S_RESET_DURATION_HIGH_MS);
}
int cst816s_read(const cst816s_t *dev, cst816s_touch_data_t *data)

View File

@ -25,8 +25,8 @@ extern "C" {
* @name cst816s timing constants
* @{
*/
#define CST816S_RESET_DURATION_LOW (20 * US_PER_MS)
#define CST816S_RESET_DURATION_HIGH (400 * US_PER_MS)
#define CST816S_RESET_DURATION_LOW_MS (20) /**< Duration of reset pin low (in ms) */
#define CST816S_RESET_DURATION_HIGH_MS (400) /**< Duration of reset pin high (in ms) */
/** @} */
#ifdef __cplusplus