MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rtlink_dinit

Function rtlink_dinit

examples/rt-link/rtlink_dev_example.c:359–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357MSH_CMD_EXPORT(rtlink_dwrite, rtlink device interface example);
358
359static void rtlink_dinit(void)
360{
361 /* step1: register rtlink to to the device framework */
362 rt_link_dev_register(&rtlink_dev, RTLINK01,
363 RT_DEVICE_FLAG_RDWR |
364 RT_DEVICE_FLAG_REMOVABLE |
365 RT_DEVICE_FLAG_STANDALONE,
366 RT_NULL);
367
368 /* step2: Initialize the rlink device as the default configuration, */
369 rt_device_t device = rt_device_find(RTLINK01);
370 if (device == RT_NULL)
371 {
372 LOG_E("device not find!");
373 return ;
374 }
375 rt_device_init(device);
376
377 /* step3: config rtlink device rx/tx callback, channel, send timeout */
378 rt_device_set_rx_indicate(device, rtlink_dev_rx_ind);
379 rt_device_set_tx_complete(device, rtlink_dev_tx_done);
380 struct rt_link_service service;
381 service.service = RT_LINK_SERVICE_SOCKET;
382 service.timeout_tx = RT_WAITING_FOREVER;
383 service.flag = RT_LINK_FLAG_ACK | RT_LINK_FLAG_CRC;
384 rt_device_control(device, RT_DEVICE_CTRL_CONFIG, &service);
385}
386MSH_CMD_EXPORT(rtlink_dinit, rtlink device interface example);
387
388static void rtlink_dopen()

Callers

nothing calls this directly

Calls 6

rt_link_dev_registerFunction · 0.85
rt_device_findFunction · 0.85
rt_device_initFunction · 0.85
rt_device_controlFunction · 0.85

Tested by

no test coverage detected