From 473828ca6aef18c574b8665ae484513e5592af03 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 29 Oct 2020 23:54:17 -0400 Subject: command: Add command_decode_ptr() helper Add a helper function to convert from a string buffer passed in the args[] parameter to an actual pointer. This avoids all the callers needing to perfrom pointer manipulation. Signed-off-by: Kevin O'Connor --- src/lcd_hd44780.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lcd_hd44780.c') diff --git a/src/lcd_hd44780.c b/src/lcd_hd44780.c index 9137cc71..fdba70c9 100644 --- a/src/lcd_hd44780.c +++ b/src/lcd_hd44780.c @@ -124,7 +124,7 @@ command_hd44780_send_cmds(uint32_t *args) { struct hd44780 *h = oid_lookup(args[0], command_config_hd44780); gpio_out_write(h->rs, 0); - uint8_t len = args[1], *cmds = (void*)(size_t)args[2]; + uint8_t len = args[1], *cmds = command_decode_ptr(args[2]); hd44780_xmit(h, len, cmds); } DECL_COMMAND(command_hd44780_send_cmds, "hd44780_send_cmds oid=%c cmds=%*s"); @@ -134,7 +134,7 @@ command_hd44780_send_data(uint32_t *args) { struct hd44780 *h = oid_lookup(args[0], command_config_hd44780); gpio_out_write(h->rs, 1); - uint8_t len = args[1], *data = (void*)(size_t)args[2]; + uint8_t len = args[1], *data = command_decode_ptr(args[2]); hd44780_xmit(h, len, data); } DECL_COMMAND(command_hd44780_send_data, "hd44780_send_data oid=%c data=%*s"); -- cgit v1.2.3-70-g09d2