ok
hi,
I am using SPI to Send data to MAX7219
LED MATRIX
I am not understanding whats going wrong...kindly help
Code: Select all
void app_main()
{
esp_err_t ret;
spi_bus_config_t busconfig={
.miso_io_num=PIN_NUM_MISO,
.mosi_io_num=PIN_NUM_MOSI,
.sclk_io_num=PIN_NUM_CLK,
.quadwp_io_num=-1,
.quadhd_io_num=-1,
.max_transfer_sz=PARALLEL_LINES*320*1+8
};
spi_device_interface_config_t dev_config={
.address_bits = 0,
.command_bits = 0,
.dummy_bits = 0,
.mode = 0,
.duty_cycle_pos = 0,
.cs_ena_posttrans = 0,
.cs_ena_pretrans = 0,
.clock_speed_hz = 10000,
.spics_io_num = PIN_NUM_CS,
.flags = 0,
.queue_size = 1,
.pre_cb = NULL,
.post_cb = NULL
};
ESP_ERROR_CHECK(spi_bus_initialize(HSPI_HOST, &busconfig, 1));
ESP_ERROR_CHECK(spi_bus_add_device(HSPI_HOST, &dev_config, &handle));
uint8_t cmd[] = {0x05, 0x0A};
spi_transaction_t t;
memset(&t, 0, sizeof(t));
t.flags =SPI_TRANS_USE_TXDATA;
t.length=2 * 8;
t.tx_buffer=cmd;
t.user=(void*)0;
ret = spi_device_transmit(spi, &t);
assert( ret == ESP_OK);
ESP_ERROR_CHECK(spi_bus_remove_device(handle));
ESP_ERROR_CHECK(spi_bus_free(HSPI_HOST));
}