aboutsummaryrefslogtreecommitdiffstats
path: root/src/lcd_hd44780.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-10-29 23:54:17 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-10-30 14:04:08 -0400
commit473828ca6aef18c574b8665ae484513e5592af03 (patch)
tree74d6b8f205ce92282475ad0f6575ea0c5af01fc2 /src/lcd_hd44780.c
parentaaf3dc6ac3e3a38b0dd3508d72594214ede27c5c (diff)
downloadkutter-473828ca6aef18c574b8665ae484513e5592af03.tar.gz
kutter-473828ca6aef18c574b8665ae484513e5592af03.tar.xz
kutter-473828ca6aef18c574b8665ae484513e5592af03.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'src/lcd_hd44780.c')
-rw-r--r--src/lcd_hd44780.c4
1 files changed, 2 insertions, 2 deletions
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");