changeset 202:e283b09c8a17 main

Improved handling of the interrupts.
author Bob Cook <bob@bobcookdev.com>
date Sat, 22 Mar 2014 09:50:54 -0700
parents 63182715cf02
children 84746acd2e0e
files main/packages/avr/can/mcp2515.cpp
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/main/packages/avr/can/mcp2515.cpp	Sat Jan 11 18:00:27 2014 -0800
+++ b/main/packages/avr/can/mcp2515.cpp	Sat Mar 22 09:50:54 2014 -0700
@@ -435,6 +435,7 @@
 static void send_from_tx_buffer()
 {
     mcp2515_data_t  msg = g_tx_buffer.pop();
+return; // TODO remove this
 
     //--    Load the destination address.
 
@@ -767,6 +768,31 @@
             send_from_tx_buffer();
         }
     }
+    
+    if ( canintf & MCP_INTERRUPT_MERR )
+    {
+        modify_register( MCP_REGISTER_CANINTF, MCP_INTERRUPT_MERR, 0x00 );
+    }
+
+    if ( canintf & MCP_INTERRUPT_WAKI )
+    {
+        modify_register( MCP_REGISTER_CANINTF, MCP_INTERRUPT_WAKI, 0x00 );
+    }
+
+    if ( canintf & MCP_INTERRUPT_ERRI )
+    {
+        modify_register( MCP_REGISTER_CANINTF, MCP_INTERRUPT_ERRI, 0x00 );
+    }
+
+    if ( canintf & MCP_INTERRUPT_TX2I )
+    {
+        modify_register( MCP_REGISTER_CANINTF, MCP_INTERRUPT_TX2I, 0x00 );
+    }
+
+    if ( canintf & MCP_INTERRUPT_TX1I )
+    {
+        modify_register( MCP_REGISTER_CANINTF, MCP_INTERRUPT_TX1I, 0x00 );
+    }
 }
 
 #endif
@@ -880,7 +906,7 @@
         uint8_t         priority
     )
 {
-    
+
 #if defined( PRJ_MCP2515_USE_INTERRUPT_RXTX )
 
     //--    Got space in the buffer?