• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

blues / note-arduino / 13307521056

13 Feb 2025 12:19PM UTC coverage: 94.831%. Remained the same
13307521056

Pull #131

github

web-flow
Merge 707de2580 into d8e8fbdc4
Pull Request #131: chore: Update Arduino CLI

104 of 127 branches covered (81.89%)

Branch coverage included in aggregate %.

318 of 318 relevant lines covered (100.0%)

16.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/NoteI2c.hpp
1
#ifndef NOTE_I2C_HPP
2
#define NOTE_I2C_HPP
3

4
#include <stddef.h>
5
#include <stdint.h>
6

7
class NoteI2c
8
{
9
public:
10
    /**************************************************************************/
11
    /*!
12
        @brief  Type used to abstract specific hardware implementation types.
13
    */
14
    /**************************************************************************/
15
    typedef void * param_t;
16

17
    virtual ~NoteI2c(void) {}
38✔
18

19
    /**************************************************************************/
20
    /*!
21
        @brief  Receives an amount of data from the Notecard in blocking mode.
22
        @param[in]  device_address
23
                The I2C address.
24
        @param[out] buffer
25
                A buffer to hold the data read from the I2C controller.
26
        @param[in]  requested_byte_count
27
                The number of bytes requested.
28
        @param[out] available
29
                The number of bytes available for subsequent calls to receive().
30
        @returns A string with an error, or `nullptr` if the receive was
31
        successful.
32
    */
33
    /**************************************************************************/
34
    virtual const char * receive(uint16_t device_address, uint8_t * buffer, uint16_t size, uint32_t * available) = 0;
35

36
    /**************************************************************************/
37
    /*!
38
        @brief  Resets the I2C port. Required by note-c.
39
        @return `true`.
40
    */
41
    /**************************************************************************/
42
    virtual bool reset(uint16_t device_address) = 0;
43

44
    /**************************************************************************/
45
    /*!
46
        @brief  Transmits an amount of data from the host in blocking mode.
47
        @param[in] device_address
48
                The I2C address.
49
        @param[in] buffer
50
                The data to transmit over I2C. The caller should have shifted
51
                it right so that the low bit is NOT the read/write bit.
52
        @param[in] size
53
                The number of bytes to transmit.
54
        @returns A string with an error, or `nullptr` if the transmission was
55
                successful.
56
    */
57
    /**************************************************************************/
58
    virtual const char * transmit(uint16_t device_address, uint8_t * buffer, uint16_t size) = 0;
59

60
    /**************************************************************************/
61
    /*!
62
        @brief  Size of the header for Serial-Over-I2C requests.
63

64
        @details The request made to the low-level I2C controller should be
65
                 for REQUEST_HEADER_SIZE + the `size` parameter supplied to the
66
                 `receive` method.
67

68
        @see NoteI2c::receive
69
    */
70
    /**************************************************************************/
71
    static const size_t REQUEST_HEADER_SIZE = 2;
72

73
    /**************************************************************************/
74
    /*!
75
        @brief  Maximum size of a Serial-Over-I2C request.
76

77
        @details The requests made to and responses received from the low-level
78
                 I2C controller can be no larger than (REQUEST_MAX_SIZE
79
                 - REQUEST_HEADER_SIZE).
80

81
        @see NoteI2c::receive
82
    */
83
    /**************************************************************************/
84
    static const size_t REQUEST_MAX_SIZE = 255;
85
};
86

87
/******************************************************************************/
88
/*!
89
    @brief  Helper function to abstract, create and maintain a single instance
90
    of the NoteI2c interface implementation, as required by the underlying
91
    `note-c` library.
92
    @param[in] i2c_parameters
93
               Pointer to the parameters required to instantiate
94
               the platform specific I2C implementation.
95
*/
96
/******************************************************************************/
97
NoteI2c * make_note_i2c (
98
    NoteI2c::param_t i2c_parameters
99
);
100

101
#endif // NOTE_I2C_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc