Skip to content

Commit

Permalink
Tweaks to freenect_flag commit
Browse files Browse the repository at this point in the history
Signed-off-by: Benn Snyder <[email protected]>
  • Loading branch information
piedar committed Nov 16, 2013
1 parent a9c31b3 commit e2446a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/libfreenect.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ typedef enum {
FREENECT_AUTO_EXPOSURE = 1 << 14,
FREENECT_AUTO_WHITE_BALANCE = 1 << 1,
FREENECT_RAW_COLOR = 1 << 4,
// registers to be written with 0 or 1
// arbitrary bitfields to support flag combination
FREENECT_MIRROR_DEPTH = 1 << 16,
FREENECT_MIRROR_VIDEO = 1 << 17,
} freenect_flag;
Expand Down
20 changes: 10 additions & 10 deletions src/flags.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@
// freenect_set_flag is the only function exposed in libfreenect.h
// The rest are available internally via #include flags.h

static int register_for_flag(int flag) {
FN_INTERNAL static int register_for_flag(int flag) {
switch(flag) {
case FREENECT_MIRROR_DEPTH:
return 0x17;
case FREENECT_MIRROR_VIDEO:
return 0x47;
default:
return -1;
case FREENECT_MIRROR_DEPTH:
return 0x17;
case FREENECT_MIRROR_VIDEO:
return 0x47;
default:
return -1;
}
}

int freenect_set_flag(freenect_device *dev, freenect_flag flag, freenect_flag_value value)
{
if (flag >= (1<<16)) {
if (flag >= (1 << 16)) {
int reg = register_for_flag(flag);
if(reg < 0)
return -1;
if (reg < 0)
return reg;
return write_register(dev, reg, value);
}

Expand Down

0 comments on commit e2446a2

Please sign in to comment.