mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 10:00:57 +02:00
fix(driver_twai): test app fix cpp build error
This commit is contained in:
@@ -483,21 +483,20 @@ TEST_CASE("twai driver cache safe (loopback)", "[twai]")
|
|||||||
TEST_CASE("twai bus off recovery (loopback)", "[twai]")
|
TEST_CASE("twai bus off recovery (loopback)", "[twai]")
|
||||||
{
|
{
|
||||||
twai_node_handle_t node_hdl;
|
twai_node_handle_t node_hdl;
|
||||||
twai_onchip_node_config_t node_config = {
|
twai_onchip_node_config_t node_config = {};
|
||||||
.io_cfg.tx = TEST_TX_GPIO,
|
node_config.io_cfg.tx = TEST_TX_GPIO;
|
||||||
.io_cfg.rx = TEST_TX_GPIO, // Using same pin for test without transceiver
|
node_config.io_cfg.rx = TEST_TX_GPIO; // Using same pin for test without transceiver
|
||||||
.bit_timing.bitrate = 50000, //slow bitrate to ensure soft error trigger
|
node_config.bit_timing.bitrate = 50000; //slow bitrate to ensure soft error trigger
|
||||||
.tx_queue_depth = 1,
|
node_config.tx_queue_depth = 1;
|
||||||
.flags.enable_self_test = true,
|
node_config.flags.enable_self_test = true;
|
||||||
};
|
|
||||||
TEST_ESP_OK(twai_new_node_onchip(&node_config, &node_hdl));
|
TEST_ESP_OK(twai_new_node_onchip(&node_config, &node_hdl));
|
||||||
TEST_ESP_OK(twai_node_enable(node_hdl));
|
TEST_ESP_OK(twai_node_enable(node_hdl));
|
||||||
|
|
||||||
twai_node_status_t node_status;
|
twai_node_status_t node_status;
|
||||||
twai_frame_t tx_frame = {
|
twai_frame_t tx_frame = {};
|
||||||
.buffer = (uint8_t *)"hello\n",
|
tx_frame.buffer = (uint8_t *)"hello\n";
|
||||||
.buffer_len = 6,
|
tx_frame.buffer_len = 6;
|
||||||
};
|
|
||||||
|
|
||||||
// send frames and trigger error, must become bus off before 50 frames
|
// send frames and trigger error, must become bus off before 50 frames
|
||||||
while ((node_status.state != TWAI_ERROR_BUS_OFF) && (tx_frame.header.id < 50)) {
|
while ((node_status.state != TWAI_ERROR_BUS_OFF) && (tx_frame.header.id < 50)) {
|
||||||
|
Reference in New Issue
Block a user