mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-27 07:21:18 +01:00
driver, mag3110: add saul
This commit is contained in:
parent
fddecfcaec
commit
36526f8a3b
@ -3,6 +3,7 @@ ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += mag3110
|
||||
USEMODULE += mma8x5x
|
||||
USEMODULE += hdc1000
|
||||
USEMODULE += tcs37727
|
||||
|
||||
@ -42,6 +42,16 @@ static const mag3110_params_t mag3110_params[] =
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Additional meta information to keep in the SAUL registry
|
||||
*/
|
||||
static const saul_reg_info_t mag3110_saul_info[] =
|
||||
{
|
||||
{
|
||||
.name = "mag3110"
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -58,6 +58,16 @@ static const mag3110_params_t mag3110_params[] =
|
||||
MAG3110_PARAMS
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Additional meta information to keep in the SAUL registry
|
||||
*/
|
||||
static const saul_reg_info_t mag3110_saul_info[] =
|
||||
{
|
||||
{
|
||||
.name = "mag3110"
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
41
drivers/mag3110/mag3110_saul.c
Normal file
41
drivers/mag3110/mag3110_saul.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2017 HAW Hamburg
|
||||
*
|
||||
* 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 driver_mag3110
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief MAG3110 adaption to the RIOT actuator/sensor interface
|
||||
*
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "saul.h"
|
||||
#include "mag3110.h"
|
||||
|
||||
static int read_acc(void *dev, phydat_t *res)
|
||||
{
|
||||
mag3110_read((mag3110_t *)dev, (mag3110_data_t *)res);
|
||||
|
||||
res->unit = UNIT_GS;
|
||||
res->scale = 2;
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
const saul_driver_t mag3110_saul_driver = {
|
||||
.read = read_acc,
|
||||
.write = saul_notsup,
|
||||
.type = SAUL_SENSE_MAG,
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user