EsmacatShield - Library for EtherCAT Arduino Shield by Esmacat (EASE)

Dependents:   EASE_Example HelloWorld_EASE_Proximity_Sensor HelloWorld_EASE_Motor_Example Example_EtherCAT_System_Using_EASE ... more

Information about Esmacat and EASE is provided in the link below. https://os.mbed.com/users/pratima_hb/code/EASE_Example/wiki/Homepage

Files at this revision

API Documentation at this revision

Comitter:
pratima_hb
Date:
Thu Feb 06 17:35:14 2020 +0000
Parent:
1:b66c3e4ce9f5
Commit message:
Updated the data types(to int16_t) of the read and write function to be able to send and receive negative numbers

Changed in this revision

EsmacatShield.cpp Show annotated file Show diff for this revision Revisions of this file
EsmacatShield.h Show annotated file Show diff for this revision Revisions of this file
diff -r b66c3e4ce9f5 -r 77c2a6061e77 EsmacatShield.cpp
--- a/EsmacatShield.cpp	Wed Jan 29 20:11:47 2020 +0000
+++ b/EsmacatShield.cpp	Thu Feb 06 17:35:14 2020 +0000
@@ -44,7 +44,7 @@
 }
 
 
-void EsmacatShield::write_reg_value(int write_addr,int value, bool led_on)
+void EsmacatShield::write_reg_value(int write_addr, int16_t value, bool led_on)
 {
   uint8_t v1,v2;
   // Chip must be selected
@@ -68,7 +68,7 @@
   wait_us(2000);                       //sleep for 2 ms;
 }
 
-int* EsmacatShield::get_ecat_registers(int regs[8]) {
+int16_t* EsmacatShield::get_ecat_registers(int16_t regs[8]) {
   regs[0] = read_reg_value(1);
   regs[1] = read_reg_value(2);
   regs[2] = read_reg_value(3);
@@ -80,7 +80,7 @@
   return(regs);
 }
 
-int EsmacatShield::read_reg_value(int read_addr)
+int16_t EsmacatShield::read_reg_value(int16_t read_addr)
 {
   uint16_t v2,v3;
   // Chip must be selected
diff -r b66c3e4ce9f5 -r 77c2a6061e77 EsmacatShield.h
--- a/EsmacatShield.h	Wed Jan 29 20:11:47 2020 +0000
+++ b/EsmacatShield.h	Thu Feb 06 17:35:14 2020 +0000
@@ -138,7 +138,7 @@
     *
     * @return None
     **************************************************************/ 
-  void write_reg_value(int write_addr,int value, bool led_on=1);
+  void write_reg_value(int write_addr,int16_t value, bool led_on=1);
   
      /**********************************************************//**
     * @brief Read EASE Register.  
@@ -157,7 +157,7 @@
     *
     * @return None
     **************************************************************/
-  int* get_ecat_registers(int regs[8]); 
+  int16_t* get_ecat_registers(int16_t regs[8]); 
 
     /************************************************************
     * @brief Default destructor for EsmacatShield Class.  
@@ -176,7 +176,7 @@
   
   SPI &ecat_spi;
   DigitalOut &ecat_cs;
-  int read_reg_value(int read_addr);
+  int16_t read_reg_value(int16_t read_addr);
 };