Skip to content

Commit

Permalink
Merge pull request #3 from eddelbuettel/master
Browse files Browse the repository at this point in the history
Change to enable build
  • Loading branch information
mnr authored Oct 20, 2023
2 parents 8aac7aa + 1b8cb70 commit 4d2c38a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 378 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
^doc$
^Meta$
^data-raw$
^src/spidev-lib-master/build
4 changes: 2 additions & 2 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

rpi_spi_open <- function(*device, config) {
.Call(`_rpigpior_rpi_spi_open`, *device, config)
rpi_spi_open <- function(dev) {
.Call(`_rpigpior_rpi_spi_open`, dev)
}

2 changes: 1 addition & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PKG_LIBS = -llibspidev-lib.a
PKG_LIBS = -L. -lspidev-lib++
11 changes: 5 additions & 6 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// rpi_spi_open
int rpi_spi_open(char *device, spi_config_t config);
RcppExport SEXP _rpigpior_rpi_spi_open(SEXP *deviceSEXP, SEXP configSEXP) {
int rpi_spi_open(std::string dev);
RcppExport SEXP _rpigpior_rpi_spi_open(SEXP devSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< char >::type *device(*deviceSEXP);
Rcpp::traits::input_parameter< spi_config_t >::type config(configSEXP);
rcpp_result_gen = Rcpp::wrap(rpi_spi_open(*device, config));
Rcpp::traits::input_parameter< std::string >::type dev(devSEXP);
rcpp_result_gen = Rcpp::wrap(rpi_spi_open(dev));
return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
{"_rpigpior_rpi_spi_open", (DL_FUNC) &_rpigpior_rpi_spi_open, 2},
{"_rpigpior_rpi_spi_open", (DL_FUNC) &_rpigpior_rpi_spi_open, 1},
{NULL, NULL, 0}
};

Expand Down
8 changes: 5 additions & 3 deletions src/rpi_spi_open.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://github.com/milekium/spidev-lib
// https://github.com/milekium/spidev-lib

#include <Rcpp.h>
#include <stdio.h>
Expand All @@ -15,9 +15,11 @@
#include "spidev_lib.h"

using namespace Rcpp;
// [[Rcpp::export]]

int rpi_spi_open(char *device, spi_config_t config) {
// [[Rcpp::export]]
int rpi_spi_open(std::string dev) {
const char *device = dev.c_str();
spi_config_t config;
int fd;

/* Open block device */
Expand Down
Loading

0 comments on commit 4d2c38a

Please sign in to comment.