Krolyxon
Commit 3120783

Branches

Tags

Refs →

orion-rf.piolibdepsesp32-s3-n16r8RF24utilityTemplatespi.h

74 lines · 1.4 KB · Objective-C

1/**
2 * @file spi.h
3 * Class declaration for SPI helper files
4 */
5
6/**
7 * Example of spi.h class declaration for SPI portability
8 *
9 * @defgroup Porting_SPI Porting: SPI
10 * @{
11 */
12#ifndef RF24_UTILITY_TEMPLATE_SPI_H_
13#define RF24_UTILITY_TEMPLATE_SPI_H_
14
15#include <stdint.h>
16
17#ifndef DOXYGEN_FORCED
18// exclude this line from the docs to prevent displaying in the list of classes
19class SPI
20#endif
21{
22
23public:
24 /**
25 * SPI constructor
26 */
27 SPI();
28
29 /**
30 * Start SPI
31 */
32 void begin(int busNo);
33
34 /**
35 * Transfer a single byte
36 * @param tx_ Byte to send
37 * @return Data returned via spi
38 */
39 uint8_t transfer(uint8_t tx_);
40
41 /**
42 * Transfer a buffer of data
43 * @param txBuf Transmit buffer
44 * @param rxBuf Receive buffer
45 * @param len Length of the data
46 */
47 void transfernb(char* txBuf, char* rxBuf, uint32_t len);
48
49 /**
50 * Transfer a buffer of data without an rx buffer
51 * @param buf Pointer to a buffer of data
52 * @param len Length of the data
53 */
54 void transfern(char* buf, uint32_t len);
55
56#ifndef DOXYGEN_FORCED
57 // exclude this line from the docs to prevent warnings docs generators
58 virtual ~SPI();
59#endif
60
61private:
62 /** SPI bus */
63 int bus;
64 /** SPI Mode set */
65 uint8_t mode;
66 /** SPI word size */
67 uint8_t bits;
68 /** SPI speed */
69 uint32_t speed;
70};
71
72/**@}*/
73
74#endif // RF24_UTILITY_TEMPLATE_SPI_H_