diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-10-29 23:54:17 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-10-30 14:04:08 -0400 |
commit | 473828ca6aef18c574b8665ae484513e5592af03 (patch) | |
tree | 74d6b8f205ce92282475ad0f6575ea0c5af01fc2 /src/lcd_st7920.c | |
parent | aaf3dc6ac3e3a38b0dd3508d72594214ede27c5c (diff) | |
download | kutter-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_st7920.c')
-rw-r--r-- | src/lcd_st7920.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lcd_st7920.c b/src/lcd_st7920.c index e4728e74..095870c5 100644 --- a/src/lcd_st7920.c +++ b/src/lcd_st7920.c @@ -137,7 +137,7 @@ command_st7920_send_cmds(uint32_t *args) { struct st7920 *s = oid_lookup(args[0], command_config_st7920); st7920_xmit_byte(s, SYNC_CMD); - uint8_t len = args[1], *cmds = (void*)(size_t)args[2]; + uint8_t len = args[1], *cmds = command_decode_ptr(args[2]); st7920_xmit(s, len, cmds); } DECL_COMMAND(command_st7920_send_cmds, "st7920_send_cmds oid=%c cmds=%*s"); @@ -147,7 +147,7 @@ command_st7920_send_data(uint32_t *args) { struct st7920 *s = oid_lookup(args[0], command_config_st7920); st7920_xmit_byte(s, SYNC_DATA); - uint8_t len = args[1], *data = (void*)(size_t)args[2]; + uint8_t len = args[1], *data = command_decode_ptr(args[2]); st7920_xmit(s, len, data); } DECL_COMMAND(command_st7920_send_data, "st7920_send_data oid=%c data=%*s"); |