HAL_DSI_Read() - how to use it??
For a test I try to read current LCD brightness - 0x5E register using STM32F769-DISCO board with MB1166 OTM8009A LCD.
DSI has been properly configured for the command mode - writing works OK. I know because display gets properly initialized.
I looked everywhere and I found no example of how to use HAL_DSI_Read().
One post I came across suggests that HAL_DSI_ConfigFlowControl(hdsi, DSI_FLOW_CONTROL_BTA) needs to be called first. It seems to help, there are no timeout errors but nothing gets read.
Please advice. This seems to be reoccurring question with no answer or even a sign someone succeeded. Below is what I have tried.
void test() {
uint8_t buffer[2];
memset(buffer, 0, 2);
MyDsiRead1Param(&hdsi_discovery, 0x5E, buffer, 2);
}
void MyDsiReadCmd(DSI_HandleTypeDef *hdsi, uint8_t cmd, uint8_t *buffer, uint32_t size) {
HAL_StatusTypeDef status = HAL_DSI_ConfigFlowControl(hdsi, DSI_FLOW_CONTROL_BTA);
if (status != HAL_OK) MBED_ERROR(status, "Error calling HAL_DSI_ConfigFlowControl().");
status = HAL_DSI_Read(hdsi, LCD_CHANEL_ID, buffer, size, DSI_DCS_SHORT_PKT_READ, cmd, (uint8_t[]){0, 0});
if (status != HAL_OK) MBED_ERROR(status, "Error calling HAL_DSI_Read().");
}
void MyDsiRead1Param(DSI_HandleTypeDef *hdsi, uint8_t param, uint8_t *buffer, uint32_t size) {
HAL_StatusTypeDef status = HAL_DSI_ConfigFlowControl(hdsi, DSI_FLOW_CONTROL_BTA);
if (status != HAL_OK) MBED_ERROR(status, "Error calling HAL_DSI_ConfigFlowControl().");
status = HAL_DSI_Read(hdsi, LCD_CHANEL_ID, buffer, size, DSI_GEN_SHORT_PKT_READ_P1, 0, (uint8_t[]){param, 0});
if (status != HAL_OK) MBED_ERROR(status, "Error calling HAL_DSI_Read().");
}