Skip to content

Commit

Permalink
src/cameras.c: add read_register() function
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Ospite <[email protected]>
  • Loading branch information
Antonio Ospite authored and zarvox committed Apr 13, 2011
1 parent 66b30b1 commit 8589b14
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/cameras.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,25 @@ static int write_register(freenect_device *dev, uint16_t reg, uint16_t data)
return 0;
}

static uint16_t read_register(freenect_device *dev, uint16_t reg)
{
freenect_context *ctx = dev->parent;
uint16_t reply[2];
uint16_t cmd;
int res;

cmd = fn_le16(reg);

FN_DEBUG("Read Reg 0x%04x =>\n", reg);
res = send_cmd(dev, 0x02, &cmd, 2, reply, 4);
if (res < 0)
FN_ERROR("read_register: send_cmd() failed: %d\n", res);
if (res != 4)
FN_WARNING("send_cmd returned %d [%04x %04x], 0000 expected\n", res, reply[0], reply[1]);

return reply[1];
}

int freenect_start_depth(freenect_device *dev)
{
freenect_context *ctx = dev->parent;
Expand Down

0 comments on commit 8589b14

Please sign in to comment.