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

sys/auto_init: add auto_init for stmpe811

This commit is contained in:
Alexandre Abadie 2020-06-21 18:26:46 +02:00
parent 7c26cf8e76
commit f45d2c7b2a
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2020 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup sys_auto_init
* @{
* @file
* @brief initializes stmpe811 display device
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
* @}
*/
#include <stddef.h>
#include "log.h"
#include "touch_dev.h"
#include "stmpe811.h"
#include "stmpe811_params.h"
#include "stmpe811_touch_dev.h"
#define STMPE811_NUMOF ARRAY_SIZE(stmpe811_params)
stmpe811_t stmpe811_devs[STMPE811_NUMOF];
static touch_dev_reg_t touch_dev_entries[STMPE811_NUMOF];
void auto_init_stmpe811(void)
{
assert(STMPE811_NUMOF == ARRAY_SIZE(stmpe811_screen_ids));
for (size_t i = 0; i < STMPE811_NUMOF; i++) {
LOG_DEBUG("[auto_init_screen] initializing stmpe811 #%u\n", i);
if (stmpe811_init(&stmpe811_devs[i], &stmpe811_params[i], NULL, NULL) < 0) {
LOG_ERROR("[auto_init_screen] error initializing stmpe811 #%u\n", i);
continue;
}
touch_dev_entries[i].dev = (touch_dev_t *)&stmpe811_devs[i];
touch_dev_entries[i].screen_id = stmpe811_screen_ids[i];
touch_dev_entries[i].dev->driver = &stmpe811_touch_dev_driver;
/* add to touch_dev registry */
touch_dev_reg_add(&(touch_dev_entries[i]));
}
}