File tree Expand file tree Collapse file tree 7 files changed +16
-258
lines changed Expand file tree Collapse file tree 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 1919
2020#include  < tuple> 
2121
22- #include  " HardwareCAN.h" 
22+ #include  " api/ HardwareCAN.h" 
2323
2424/* *************************************************************************************
2525 * NAMESPACE 
  Load Diff This file was deleted. 
Original file line number Diff line number Diff line change 1919
2020#ifdef  ARDUINO_SANTIAGO
2121
22- #include  " HardwareCAN.h" 
22+ #include  " api/ HardwareCAN.h" 
2323
2424#include  " bsp_api.h" 
2525
2626#include  " r_can.h" 
2727
28- #include  " CanMsgRingbuffer .h" 
28+ #include  " SyncCanMsgRingbuffer .h" 
2929
3030/* *************************************************************************************
3131 * TYPEDEF 
@@ -78,7 +78,7 @@ class R7FA4M1_CAN final : public HardwareCAN
7878  int  const  _can_rx_pin;
7979  bool  _is_error;
8080  int  _err_code;
81-   CanMsgRingbuffer  _can_rx_buf;
81+   SyncCanMsgRingbuffer  _can_rx_buf;
8282
8383  can_instance_ctrl_t  _can_ctrl;
8484  can_bit_timing_cfg_t  _can_bit_timing_cfg;
Original file line number Diff line number Diff line change 1919
2020#ifdef  ARDUINO_PORTENTA_H33
2121
22- #include  " HardwareCAN.h" 
22+ #include  " api/ HardwareCAN.h" 
2323
2424#include   < tuple> 
2525
2626#include  " bsp_api.h" 
2727
2828#include  " r_canfd.h" 
2929
30- #include  " CanMsgRingbuffer .h" 
30+ #include  " SyncCanMsgRingbuffer .h" 
3131
3232/* *************************************************************************************
3333 * TYPEDEF 
@@ -78,7 +78,7 @@ class R7FA6M5_CAN final : public HardwareCAN
7878  int  const  _can_rx_pin;
7979  bool  _is_error;
8080  int  _err_code;
81-   CanMsgRingbuffer  _can_rx_buf;
81+   SyncCanMsgRingbuffer  _can_rx_buf;
8282
8383  canfd_instance_ctrl_t  _canfd_ctrl;
8484  can_bit_timing_cfg_t  _canfd_bit_timing_cfg;
Original file line number Diff line number Diff line change 1515 * INCLUDE 
1616 **************************************************************************************/  
1717
18- #include  < cstdint > 
18+ #include  " api/HardwareCAN.h " 
1919
20- #include  " CanMsg.h" 
2120#include  " sync.h" 
2221
2322/* *************************************************************************************
@@ -31,28 +30,22 @@ namespace arduino
3130 * CLASS DECLARATION 
3231 **************************************************************************************/  
3332
34- class  CanMsgRingbuffer 
33+ class  SyncCanMsgRingbuffer 
3534{
3635public: 
37-   static   size_t   constexpr  RING_BUFFER_SIZE =  32U ; 
36+   SyncCanMsgRingbuffer () : _can_msg_buf{} { } 
3837
39-   CanMsgRingbuffer ();
4038
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); } } 
4341
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 (); } } 
4644
47-   inline   size_t  available () const  { synchronized { return  _num_elems ; } }
45+   size_t  available () const  { synchronized { return  _can_msg_buf. available () ; } }
4846
4947private: 
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;
5649};
5750
5851/* *************************************************************************************
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments