我想找...

搜尋

分享

目錄

EthercatDevice_DmpLCD.lcdPushColors()

[EthercatDevice_DmpLCD_Generic]

描述

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

衍生類別:

Class NameVendor IDProduct Code
EthercatDevice_QECR11UN010x00000bc30x0086d103
EthercatDevice_QECR00UN010x00000bc30x0086d100

語法

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

參數

  • [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.

回傳值

返回一個 錯誤代碼。如果傳回值為零,則表示該函式執行成功。

備註

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

範例

#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 類別 for more QEC Stepper Drivers instructions and API usage.

返回頂端