Beamlib  3.0.1
This is the Beam C++ class library.
BSpi.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BSpi.h BSpi class
3  * T.Barnaby, Beam Ltd, 2012-11-12
4  * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5  * For license see LICENSE.txt at the root of the beamlib source tree.
6  *******************************************************************************
7  */
8 #ifndef BSpi_h
9 #define BSpi_h
10 
11 #include <BTypes.h>
12 #include <BError.h>
13 
15 class BSpi {
16 public:
17  enum Mode { Mode0 = 0, Mode1 = 1, Mode2 = 2, Mode3 = 3 };
18 
19  BSpi();
20  BError init(BString devName, BUInt speed = 1000000, Mode mode = Mode1, Bool csActive = 0);
21 
22  BError transact(BUInt8 dev, void* txBuf, int txLen, int pad, void* rxBuf, int rxLen);
23 
24 private:
25  BString odevName;
26  int odev;
27 };
28 
29 #endif
BUInt32 BUInt
Definition: BTypes.h:33
bool Bool
Definition: BTypes.h:18
uint8_t BUInt8
Definition: BTypes.h:20
Error return class. This class is used to return the error status from a function....
Definition: BError.h:31
BSpi class for accessing SPI hardware devices.
Definition: BSpi.h:15
BSpi()
Definition: BSpi.cpp:14
Mode
Definition: BSpi.h:17
@ Mode1
Definition: BSpi.h:17
@ Mode3
Definition: BSpi.h:17
@ Mode0
Definition: BSpi.h:17
@ Mode2
Definition: BSpi.h:17
BError transact(BUInt8 dev, void *txBuf, int txLen, int pad, void *rxBuf, int rxLen)
Definition: BSpi.cpp:49
BError init(BString devName, BUInt speed=1000000, Mode mode=Mode1, Bool csActive=0)
Definition: BSpi.cpp:18
This class stores and manipulates ASCII strings.
Definition: BString.h:20