Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
Add get_px4_vx4x1 method to the viper core interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePBone committed Jan 4, 2020
1 parent e0a615e commit 858f9fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/viperfx_so.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
Expand Down Expand Up @@ -101,3 +102,24 @@ int viperfx_command_set_ir_path (viperfx_interface * intf,
}
return TRUE;
}

int32_t viperfx_command_get_px4_vx4x1 (viperfx_interface * intf,
int32_t param)
{
int32_t cmd_data[1];
cmd_data[0] = param;
int32_t *ret = malloc(sizeof(int32_t));
uint32_t *retsize = malloc(sizeof(uint32_t));

if (intf->command (intf, COMMAND_CODE_GET,
sizeof(cmd_data), cmd_data, retsize, ret) != 0) {
return -1;
}

if(*retsize != 4) {
printf("[E] Size of reply != 4 bytes, actual size: %u bytes\n",*retsize);
return -1;
}

return ret[0];
}
2 changes: 2 additions & 0 deletions src/viperfx_so.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ int viperfx_command_set_px4_vx4x3 (viperfx_interface * intf,
int32_t param, int32_t value_l, int32_t value_h, int32_t value_e);
int viperfx_command_set_ir_path (viperfx_interface * intf,
const char * pathname);
int32_t viperfx_command_get_px4_vx4x1 (viperfx_interface * intf,
int32_t param);

#ifdef __cplusplus
}
Expand Down

0 comments on commit 858f9fd

Please sign in to comment.