Browse Source

driver, mag3110: add saul

master
smlng 6 years ago
parent
commit
36526f8a3b
  1. 1
      boards/pba-d-01-kw2x/Makefile.dep
  2. 10
      boards/pba-d-01-kw2x/include/mag3110_params.h
  3. 10
      drivers/mag3110/include/mag3110_params.h
  4. 41
      drivers/mag3110/mag3110_saul.c

1
boards/pba-d-01-kw2x/Makefile.dep

@ -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

10
boards/pba-d-01-kw2x/include/mag3110_params.h

@ -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

10
drivers/mag3110/include/mag3110_params.h

@ -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

@ -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…
Cancel
Save