File tree 7 files changed +16
-258
lines changed
7 files changed +16
-258
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 19
19
20
20
#include < tuple>
21
21
22
- #include " HardwareCAN.h"
22
+ #include " api/ HardwareCAN.h"
23
23
24
24
/* *************************************************************************************
25
25
* NAMESPACE
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 19
19
20
20
#ifdef ARDUINO_SANTIAGO
21
21
22
- #include " HardwareCAN.h"
22
+ #include " api/ HardwareCAN.h"
23
23
24
24
#include " bsp_api.h"
25
25
26
26
#include " r_can.h"
27
27
28
- #include " CanMsgRingbuffer .h"
28
+ #include " SyncCanMsgRingbuffer .h"
29
29
30
30
/* *************************************************************************************
31
31
* TYPEDEF
@@ -78,7 +78,7 @@ class R7FA4M1_CAN final : public HardwareCAN
78
78
int const _can_rx_pin;
79
79
bool _is_error;
80
80
int _err_code;
81
- CanMsgRingbuffer _can_rx_buf;
81
+ SyncCanMsgRingbuffer _can_rx_buf;
82
82
83
83
can_instance_ctrl_t _can_ctrl;
84
84
can_bit_timing_cfg_t _can_bit_timing_cfg;
Original file line number Diff line number Diff line change 19
19
20
20
#ifdef ARDUINO_PORTENTA_H33
21
21
22
- #include " HardwareCAN.h"
22
+ #include " api/ HardwareCAN.h"
23
23
24
24
#include < tuple>
25
25
26
26
#include " bsp_api.h"
27
27
28
28
#include " r_canfd.h"
29
29
30
- #include " CanMsgRingbuffer .h"
30
+ #include " SyncCanMsgRingbuffer .h"
31
31
32
32
/* *************************************************************************************
33
33
* TYPEDEF
@@ -78,7 +78,7 @@ class R7FA6M5_CAN final : public HardwareCAN
78
78
int const _can_rx_pin;
79
79
bool _is_error;
80
80
int _err_code;
81
- CanMsgRingbuffer _can_rx_buf;
81
+ SyncCanMsgRingbuffer _can_rx_buf;
82
82
83
83
canfd_instance_ctrl_t _canfd_ctrl;
84
84
can_bit_timing_cfg_t _canfd_bit_timing_cfg;
Original file line number Diff line number Diff line change 15
15
* INCLUDE
16
16
**************************************************************************************/
17
17
18
- #include < cstdint >
18
+ #include " api/HardwareCAN.h "
19
19
20
- #include " CanMsg.h"
21
20
#include " sync.h"
22
21
23
22
/* *************************************************************************************
@@ -31,28 +30,22 @@ namespace arduino
31
30
* CLASS DECLARATION
32
31
**************************************************************************************/
33
32
34
- class CanMsgRingbuffer
33
+ class SyncCanMsgRingbuffer
35
34
{
36
35
public:
37
- static size_t constexpr RING_BUFFER_SIZE = 32U ;
36
+ SyncCanMsgRingbuffer () : _can_msg_buf{} { }
38
37
39
- CanMsgRingbuffer ();
40
38
41
- inline bool isFull () const { synchronized { return (_num_elems == RING_BUFFER_SIZE ); } }
42
- void enqueue (CanMsg const & msg);
39
+ bool isFull () const { synchronized { _can_msg_buf. isFull ( ); } }
40
+ void enqueue (CanMsg const & msg) { synchronized { _can_msg_buf. enqueue (msg); } }
43
41
44
- inline bool isEmpty () const { synchronized { return (_num_elems == 0 ); } }
45
- CanMsg dequeue ();
42
+ bool isEmpty () const { synchronized { return _can_msg_buf. isEmpty ( ); } }
43
+ CanMsg dequeue () { synchronized { return _can_msg_buf. dequeue (); } }
46
44
47
- inline size_t available () const { synchronized { return _num_elems ; } }
45
+ size_t available () const { synchronized { return _can_msg_buf. available () ; } }
48
46
49
47
private:
50
- CanMsg _buf[RING_BUFFER_SIZE];
51
- volatile size_t _head;
52
- volatile size_t _tail;
53
- volatile size_t _num_elems;
54
-
55
- inline size_t next (size_t const idx) const { return ((idx + 1 ) % RING_BUFFER_SIZE); }
48
+ CanMsgRingbuffer _can_msg_buf;
56
49
};
57
50
58
51
/* *************************************************************************************
You can’t perform that action at this time.
0 commit comments