File tree Expand file tree Collapse file tree 3 files changed +78
-1
lines changed
Expand file tree Collapse file tree 3 files changed +78
-1
lines changed Original file line number Diff line number Diff line change 1313 "maintainer" : true
1414 }
1515 ],
16- "version" : " 7.1.3 " ,
16+ "version" : " 7.2.0 " ,
1717 "frameworks" : " *" ,
1818 "platforms" : " *" ,
1919 "export" : {
Original file line number Diff line number Diff line change 1+ /* !
2+ * @file
3+ * @brief
4+ */
5+
6+ #ifndef tiny_i2c_double_hpp
7+ #define tiny_i2c_double_hpp
8+
9+ extern " C" {
10+ #include " hal/i_tiny_i2c.h"
11+ }
12+
13+ typedef struct {
14+ i_tiny_i2c_t interface;
15+ } tiny_i2c_double_t ;
16+
17+ /* !
18+ * Initializes an I2C double.
19+ */
20+ void tiny_i2c_double_init (tiny_i2c_double_t * self);
21+
22+ #endif
Original file line number Diff line number Diff line change 1+ /* !
2+ * @file
3+ * @brief
4+ */
5+
6+ #include " CppUTestExt/MockSupport.h"
7+ #include " double/tiny_i2c_double.hpp"
8+
9+ static bool write (
10+ i_tiny_i2c_t * self,
11+ uint8_t address,
12+ bool prepare_for_restart,
13+ const void * buffer,
14+ uint16_t buffer_size)
15+ {
16+ return mock ()
17+ .actualCall (" write" )
18+ .onObject (self)
19+ .withParameter (" address" , address)
20+ .withParameter (" prepare_for_restart" , prepare_for_restart)
21+ .withMemoryBufferParameter (" buffer" , reinterpret_cast <const uint8_t *>(buffer), buffer_size)
22+ .returnBoolValue ();
23+ }
24+
25+ static bool read (
26+ i_tiny_i2c_t * self,
27+ uint8_t address,
28+ bool prepare_for_restart,
29+ void * buffer,
30+ uint16_t buffer_size)
31+ {
32+ (void )buffer_size;
33+
34+ return mock ()
35+ .actualCall (" read" )
36+ .onObject (self)
37+ .withParameter (" address" , address)
38+ .withParameter (" prepare_for_restart" , prepare_for_restart)
39+ .withOutputParameter (" buffer" , buffer)
40+ .returnBoolValue ();
41+ }
42+
43+ static void reset (i_tiny_i2c_t * self)
44+ {
45+ mock ()
46+ .actualCall (" reset" )
47+ .onObject (self);
48+ }
49+
50+ static const i_tiny_i2c_api_t api = { write, read, reset };
51+
52+ void tiny_i2c_double_init (tiny_i2c_double_t * self)
53+ {
54+ self->interface .api = &api;
55+ }
You can’t perform that action at this time.
0 commit comments