Skip to content

Commit 4b41f0e

Browse files
committed
Merge pull request #367 from grissiom/ymodem-fix
ymodem: fix examples due to new API
2 parents 7cb6463 + fe603dd commit 4b41f0e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/ymodem/echo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ rt_err_t rym_cat_to_dev(rt_device_t idev, rt_device_t odev)
2525
rt_kprintf("open output device error: 0x%x", -res);
2626
return res;
2727
}
28-
res = rym_recv_on_device(&rctx, idev,
29-
RT_NULL, _rym_echo_data, RT_NULL, 1000);
28+
res = rym_recv_on_device(&rctx, idev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
29+
RT_NULL, _rym_echo_data, RT_NULL, 1000);
3030
rt_device_close(_odev);
3131
rt_kprintf("leaving RYM mode with code %X\n", res);
3232
return res;

examples/ymodem/null.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ rt_err_t rym_null(char *devname)
2020
return -1;
2121
}
2222

23-
return rym_recv_on_device(&rctx, dev,
24-
RT_NULL, _rym_dummy_write, RT_NULL, 1000);
23+
return rym_recv_on_device(&rctx, dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
24+
RT_NULL, _rym_dummy_write, RT_NULL, 1000);
2525
}
2626
FINSH_FUNCTION_EXPORT(rym_null, dump data to null);
2727
#endif

examples/ymodem/tofile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static enum rym_code _rym_bg(
2121
struct custom_ctx *cctx = (struct custom_ctx*)ctx;
2222
cctx->fpath[0] = '/';
2323
/* the buf should be the file name */
24-
strcpy(&(cctx->fpath[1]), buf);
24+
strcpy(&(cctx->fpath[1]), (const char*)buf);
2525
cctx->fd = open(cctx->fpath, O_CREAT | O_WRONLY | O_TRUNC, 0);
2626
if (cctx->fd < 0)
2727
{
@@ -31,7 +31,7 @@ static enum rym_code _rym_bg(
3131
return RYM_CODE_CAN;
3232
}
3333

34-
cctx->flen = atoi(buf+strlen(buf)+1);
34+
cctx->flen = atoi((const char*)buf+strlen((const char*)buf)+1);
3535
if (cctx->flen == 0)
3636
cctx->flen = -1;
3737
return RYM_CODE_ACK;
@@ -80,8 +80,8 @@ rt_err_t rym_write_to_file(rt_device_t idev)
8080

8181
rt_kprintf("entering RYM mode\n");
8282

83-
res = rym_recv_on_device(&ctx->parent, idev,
84-
_rym_bg, _rym_tof, _rym_end, 1000);
83+
res = rym_recv_on_device(&ctx->parent, idev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
84+
_rym_bg, _rym_tof, _rym_end, 1000);
8585

8686
/* there is no Ymodem traffic on the line so print out info. */
8787
rt_kprintf("leaving RYM mode with code %d\n", res);

0 commit comments

Comments
 (0)