整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
41
hardware/SPI.h
Normal file
41
hardware/SPI.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef C9ED230E_05FF_4E41_87B9_664DF1FD835C
|
||||
#define C9ED230E_05FF_4E41_87B9_664DF1FD835C
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INCLUDE
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Hardware
|
||||
{
|
||||
/*
|
||||
*******************************************************************************
|
||||
* CLASS DECLARE
|
||||
*******************************************************************************
|
||||
*/
|
||||
class SPI
|
||||
{
|
||||
public:
|
||||
static const uint8_t MODE_0;
|
||||
static const uint8_t MODE_1;
|
||||
static const uint8_t MODE_2;
|
||||
static const uint8_t MODE_3;
|
||||
|
||||
public:
|
||||
SPI(int bus, int cs);
|
||||
~SPI();
|
||||
|
||||
public:
|
||||
int setSpeed(uint32_t speed);
|
||||
int setMode(uint8_t mode);
|
||||
int setBitsPerWord(uint8_t bits);
|
||||
int setLSBFirst(bool enable);
|
||||
|
||||
int writeThenRead(const uint8_t* tx, int txlen, uint8_t* rx, int rxlen);
|
||||
|
||||
private:
|
||||
int _fd;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue