Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
954 B

/*
* TMRh20 2015
* SPI layer for RF24
*/
#ifndef _SPI_H_INCLUDED
#define _SPI_H_INCLUDED
/**
* @file spi.h
* \cond HIDDEN_SYMBOLS
* Class declaration for SPI helper files
*/
#include <stdio.h>
#include "mraa.hpp"
class SPI {
public:
SPI();
virtual ~SPI();
mraa::Spi* mspi;
inline uint8_t transfer(uint8_t _data);
inline void transfernb(char* tbuf, char* rbuf, uint32_t len);
inline void transfern(char* buf, uint32_t len);
void begin(int busNo);
void end();
void setBitOrder(uint8_t bit_order);
void setDataMode(uint8_t data_mode);
void setClockDivider(uint32_t spi_speed);
void chipSelect(int csn_pin);
};
uint8_t SPI::transfer(uint8_t _data)
{
return mspi->writeByte(_data);
}
void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len){
mspi->transfer((uint8_t*)tbuf, (uint8_t*)rbuf, len);
}
void SPI::transfern(char* buf, uint32_t len)
{
transfernb(buf, buf, len);
}
/**
* \endcond
*/
#endif