From 4465ddb88d40770b61c74cc4378b727b027b4c4c Mon Sep 17 00:00:00 2001
From: Irene Garcia <igarcia@iri.upc.edu>
Date: Wed, 22 Feb 2017 11:23:38 +0100
Subject: [PATCH] Added smart charger module to the Dynamixel Slave

Added to the darwin_on_write() function the smart charger's module for write commands.
Possible commands of this module: Enable or disable module, set smart charger period or write data to smart charger.
---
 src/darwin_dyn_slave.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/darwin_dyn_slave.c b/src/darwin_dyn_slave.c
index 0750b09..dd7f12f 100755
--- a/src/darwin_dyn_slave.c
+++ b/src/darwin_dyn_slave.c
@@ -12,6 +12,7 @@
 #include "joint_motion.h"
 #include "head_tracking.h"
 #include "grippers.h"
+#include "smart_charger.h"
 
 /* timer for the execution of the dynamixel slave loop */
 #define     DYN_SLAVE_TIMER                   TIM7
@@ -92,6 +93,9 @@ unsigned char darwin_on_write(unsigned short int address,unsigned short int leng
   // gripper commands
   if(grippers_in_range(address,length))
     grippers_process_write_cmd(address,length,data);
+  // smart charger commands
+  if(smart_charger_in_range(address,length))
+    smart_charger_process_write_cmd(address,length,data);
   // write eeprom
   for(i=address,j=0;i<LAST_EEPROM_OFFSET && i<(address+length);i++,j++)
     EE_WriteVariable(i,data[j]);
-- 
GitLab