source: flair-src/trunk/lib/FlairCore/src/SpiPort.h

Last change on this file was 415, checked in by Sanahuja Guillaume, 6 months ago

spi port support

File size: 1.5 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file SpiPort.h
7 * \brief Base class for spi port
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2021/04/13
10 * \version 4.0
11 */
12
13#ifndef SPIPORT_H
14#define SPIPORT_H
15
16#include <Object.h>
17#include <stdint.h>
18
19namespace flair {
20namespace core {
21/*! \class SpiPort
22*
23* \brief Base class for spi port
24*/
25class SpiPort : public Object {
26public:
27  /*!
28  * \brief Constructor
29  *
30  * Construct a spi port.
31  *
32  * \param parent parent
33  * \param name name
34  */
35  SpiPort(const Object *parent, std::string name) : Object(parent, name) {}
36
37  /*!
38  * \brief Destructor
39  *
40  */
41  ~SpiPort(){};
42
43
44  /*!
45  * \brief Write datas
46  *
47  * \param buf pointer to datas
48  * \param nbyte length of datas
49  *
50  * \return amount of written datas
51  */
52  virtual ssize_t Write(const void *buf, size_t nbyte) = 0;
53
54  /*!
55  * \brief Read datas
56  *
57  * \param buf pointer to datas
58  * \param nbyte length of datas
59  *
60  * \return amount of read datas
61  */
62  virtual ssize_t Read(void *buf, size_t nbyte) = 0;
63
64  /*!
65  * \brief Write datas
66  *
67  * \param tx_buf pointer to write datas
68  * \param rx_buf pointer to read datas
69  * \param nbyte length of datas
70  *
71  * \return amount of written datas
72  */
73  virtual ssize_t WriteRead(const void *tx_buf, void *rx_buf,size_t nbyte) = 0;
74
75};
76} // end namespace core
77} // end namespace flair
78
79#endif // SPIPORT_H
Note: See TracBrowser for help on using the repository browser.