changeset 176:12681b419e60 main

Need init() for all four possible encoder chips.
author Bob Cook <bob@bobcookdev.com>
date Sun, 31 Mar 2013 15:36:26 -0700
parents f7a234e8e089
children 317c0d923c51
files main/packages/avr/sensors/ls7366/ls7366.cpp
diffstat 1 files changed, 69 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main/packages/avr/sensors/ls7366/ls7366.cpp	Sun Mar 31 15:35:32 2013 -0700
+++ b/main/packages/avr/sensors/ls7366/ls7366.cpp	Sun Mar 31 15:36:26 2013 -0700
@@ -289,6 +289,75 @@
 
 #endif // #if defined( PRJ_LS7366_ENABLE_CHIP_1 )
 
+#if defined( PRJ_LS7366_ENABLE_CHIP_2 )
+
+void ls7366_reset_2()
+{
+    select_chip_2();
+    spi_write( LS7366_CMD_CLEAR_STR );
+    deselect_chip_2();
+    
+    select_chip_2();
+    spi_write( LS7366_CMD_CLEAR_MDR0 );
+    deselect_chip_2();
+
+    select_chip_2();
+    spi_write( LS7366_CMD_CLEAR_MDR1 );
+    deselect_chip_2();
+
+    select_chip_2();
+    spi_write( LS7366_CMD_CLEAR_CNTR );
+    deselect_chip_2();
+}
+
+#endif // #if defined( PRJ_LS7366_ENABLE_CHIP_2 )
+
+#if defined( PRJ_LS7366_ENABLE_CHIP_3 )
+
+void ls7366_reset_3()
+{
+    select_chip_3();
+    spi_write( LS7366_CMD_CLEAR_STR );
+    deselect_chip_3();
+    
+    select_chip_3();
+    spi_write( LS7366_CMD_CLEAR_MDR0 );
+    deselect_chip_3();
+
+    select_chip_3();
+    spi_write( LS7366_CMD_CLEAR_MDR1 );
+    deselect_chip_3();
+
+    select_chip_3();
+    spi_write( LS7366_CMD_CLEAR_CNTR );
+    deselect_chip_3();
+}
+
+#endif // #if defined( PRJ_LS7366_ENABLE_CHIP_3 )
+
+#if defined( PRJ_LS7366_ENABLE_CHIP_4 )
+
+void ls7366_reset_4()
+{
+    select_chip_4();
+    spi_write( LS7366_CMD_CLEAR_STR );
+    deselect_chip_4();
+    
+    select_chip_4();
+    spi_write( LS7366_CMD_CLEAR_MDR0 );
+    deselect_chip_4();
+
+    select_chip_4();
+    spi_write( LS7366_CMD_CLEAR_MDR1 );
+    deselect_chip_4();
+
+    select_chip_4();
+    spi_write( LS7366_CMD_CLEAR_CNTR );
+    deselect_chip_4();
+}
+
+#endif // #if defined( PRJ_LS7366_ENABLE_CHIP_4 )
+
 // ----------------------------------------------------------------------------------------
 
 #if defined( PRJ_LS7366_ENABLE_CHIP_1 )