I want to find...

Search

Shares

Table of Content

EthercatDevice_DmpLCD.lcdPushColors()

[EthercatDevice_DmpLCD_Generic]

Description

Send an array of 16-bit color values to the LCD display on the EtherCAT slave device for pixel-drawing. This function assumes that the lcdSetAddrWindow() function has been previously called to define the address window for the drawing operation.

EthercatDevice_DmpLCD.lcdPushColors-1

Derived Class:

Class NameVendor IDProduct Code
EthercatDevice_QECR11UN010x00000bc30x0086d103
EthercatDevice_QECR00UN010x00000bc30x0086d100

Syntax

int lcdPushColors(uint16_t *data, uint8_t len, bool first);

Parameters

  • [in] uint16_t *data
    Pointer to an array of 16-bit color values. Each element in the array represents the color of a pixel to be displayed.
  • [in] uint8_t len
    The length of 16-bit color values in the data array. This indicates the total number of pixels to be drawn. If the length of the data array exceeds the number of pixels in the LCD address window, the excess portion will be drawn starting from the top-left corner of the LCD address window.
  • [in] bool first
    Setting this parameter to true moves the current drawing position back to the top-left corner of the LCD address window. Setting it to false keeps the current drawing position unchanged.

Return Value

Return an error code. If the returned value is zero, it indicates a successful execution of this function.

Comment

This function must be called after a successful execution of EthercatMaster::begin(). This function is blocking and cannot be called within the Cyclic Callback.

Example

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR00UN01 slave;

uint16_t buffer[256];

void CyclicCallback() {
  slave.update();
}

void setup() {
  master.begin();
  slave.attach(0, master);
  slave.lcdInit(ECAT_LCD_ILI9341_1);
  master.attachCyclicCallback(CyclicCallback);
  master.start();

  for (int i = 0; i < 128; i++)
    buffer[i] = 0xFFE0;
  for (int i = 0; i < 128; i++)
    buffer[i + 128] = 0xF800;
  
  slave.lcdSetAddrWindow(100, 100, 115, 115);
  slave.lcdPushColors(&buffer[0], 128, true);
  slave.lcdPushColors(&buffer[128], 128, false);
}

void loop() {
  // ...
}

Please see EthercatDevice_DmpLCD_Generic Class for more QEC Stepper Drivers instructions and API usage.

Scroll to Top