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

43 lines
890 B
C
Raw Normal View History

2016-02-10 22:28:25 +01:00
/*
* Copyright (C) 2016 Freie Universität Berlin
*
* 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.
*/
/**
2018-06-01 12:09:01 +02:00
* @ingroup drivers_mma8x5x
2016-02-10 22:28:25 +01:00
* @{
*
* @file
* @brief MMA8x5x adaption to the RIOT actuator/sensor interface
2016-02-10 22:28:25 +01:00
*
* @author Cenk Gündoğan <mail@cgundogan.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
2016-02-10 22:28:25 +01:00
*
* @}
*/
#include <string.h>
#include <stdio.h>
#include "saul.h"
#include "mma8x5x.h"
2016-02-10 22:28:25 +01:00
2017-06-26 16:00:34 +02:00
static int read_acc(const void *dev, phydat_t *res)
2016-02-10 22:28:25 +01:00
{
mma8x5x_read((const mma8x5x_t *)dev, (mma8x5x_data_t *)res->val);
2016-02-10 22:28:25 +01:00
res->unit = UNIT_G_FORCE;
2016-02-10 22:28:25 +01:00
res->scale = -3;
return 3;
}
const saul_driver_t mma8x5x_saul_driver = {
2016-02-10 22:28:25 +01:00
.read = read_acc,
.write = saul_write_notsup,
2016-02-10 22:28:25 +01:00
.type = SAUL_SENSE_ACCEL,
};