Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
EsmacatShield Class Reference
This is a driver code for EASE with form factor of Arduino UNO shields. More...
#include <EsmacatShield.h>
Public Member Functions | |
| EsmacatShield (SPI &spi, DigitalOut &pin) | |
| Constructor for EsmacatShield Class. | |
| void | setup_spi () |
| Set up spi communication. | |
| void | write_reg_value (int write_addr, int16_t value, bool led_on=1) |
| Write given Register with the given value. | |
| int16_t * | get_ecat_registers (int16_t regs[8]) |
| Read EASE Register. | |
Detailed Description
This is a driver code for EASE with form factor of Arduino UNO shields.
This shield communicates with the base board via SPI.
- Version:
- 1.0
EASE stacks onto Arduino-like boards (a.k.a Base board). The Base board can read and write registers on EASE via SPI. The same registers can also be written and read by an EtherCAT master via a standard EtherCAT protocol. Multiple EASE boards can be connected with Ethernet cables with a daisy-chain topology and powered via Ethernet cables with Power-over-EtherCAT (POE) technology. EASE, thus bridges the data packets between an EtherCAT master and multiple Base boards.
*#include "mbed.h" *#include <EsmacatShield.h> //Include Esmacat Arduino Library *int counter; *int v[8]; //EASE 8 registers *Serial pc(USBTX, USBRX); *DigitalOut selectPin(D10); // D10 is used to drive chip enable low *SPI spi(D11, D12, D13); // mosi, miso, sclk *int main() *{ EsmacatShield slave(spi, selectPin); //Define Chip Selector Pin slave.setup_spi(); //Setup SPI for EASE, 8 bit Data, Mode 1, 3MHz freq while(1) { slave.get_ecat_registers(v); //read all registers slave.write_reg_value(0,counter++, true); //Write register data (register,value, led_on) wait_us(1000000); //sleep for 1000 ms slave.write_reg_value(0,counter++, false); //Write register data (register,value, led_on) wait_us(1000000); //sleep for 1000 ms pc.printf("Next Iteration \n"); for (int i=0;i<8;i++) //print the registers read on pc { pc.printf("%d",i); pc.printf("\t"); pc.printf("%d",v[i]); pc.printf("\n"); } } *}
Definition at line 92 of file EsmacatShield.h.
Constructor & Destructor Documentation
| EsmacatShield | ( | SPI & | spi, |
| DigitalOut & | pin | ||
| ) |
Constructor for EsmacatShield Class.
Requires an existing SPI object as well as a DigitalOut object. The DigitalOut object is used for a chip enable signal
On Entry:
- Parameters:
-
[in] spi - pointer to existing SPI object [in] pin - pointer to a DigitalOut pin object
On Exit:
- Returns:
- None
Definition at line 26 of file EsmacatShield.cpp.
Member Function Documentation
| int16_t * get_ecat_registers | ( | int16_t | regs[8] ) |
Read EASE Register.
Using this function 8 different 16 bit integers on EASE can be read.
On Entry:
- Parameters:
-
[in] Pointer to integer - Eight consecutive memory locations from this pointer will be stored with the integer values read from EASE.
On Exit:
- Parameters:
-
[out] pointer to the integer where the data is stored.
- Returns:
- None
Definition at line 71 of file EsmacatShield.cpp.
| void setup_spi | ( | ) |
Set up spi communication.
Sets up SPI communication by using the member. functions format and frequency. 8 bit data, Mode 1, frequency of communication set to 3000000Hz
On Entry:
On Exit:
- Returns:
- None
Definition at line 31 of file EsmacatShield.cpp.
| void write_reg_value | ( | int | write_addr, |
| int16_t | value, | ||
| bool | led_on = 1 |
||
| ) |
Write given Register with the given value.
Using this function 8 different 16 bit integers can be written into EASE.
On Entry:
- Parameters:
-
[in] write_addr - The Register number to be written into. Can take values from 0 to 7 [in] value - The value to be written into the register [in] led_on - True to turn LED ON - False to turn LED OFF
On Exit:
- Returns:
- None
Definition at line 47 of file EsmacatShield.cpp.
Generated on Mon Aug 1 2022 01:37:20 by
1.7.2