diff options
author | Randy Mackay <rmackay9@yahoo.com> | 2015-03-02 14:30:01 +0900 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-03-02 08:29:12 +0100 |
commit | 48bf84ff3754109fe6cf8e0e161eb70ae0987bfe (patch) | |
tree | 4253c203a78c4cddf7d7d5cafc8279ec817fdece /src/drivers/oreoled | |
parent | 690b29d271576fdf02104c637ee2a0b15554e648 (diff) | |
download | px4-firmware-48bf84ff3754109fe6cf8e0e161eb70ae0987bfe.tar.gz px4-firmware-48bf84ff3754109fe6cf8e0e161eb70ae0987bfe.tar.bz2 px4-firmware-48bf84ff3754109fe6cf8e0e161eb70ae0987bfe.zip |
oreoled: support send_bytes ioctl
Also increase maximum command length to 24 bytes
Diffstat (limited to 'src/drivers/oreoled')
-rw-r--r-- | src/drivers/oreoled/oreoled.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/drivers/oreoled/oreoled.cpp b/src/drivers/oreoled/oreoled.cpp index 2f5bf75bc..b44c4b720 100644 --- a/src/drivers/oreoled/oreoled.cpp +++ b/src/drivers/oreoled/oreoled.cpp @@ -368,6 +368,31 @@ OREOLED::ioctl(struct file *filp, int cmd, unsigned long arg) return ret; + case OREOLED_SEND_BYTES: + /* send bytes */ + new_cmd = *((oreoled_cmd_t *) arg); + + /* special handling for request to set all instances */ + if (new_cmd.led_num == OREOLED_ALL_INSTANCES) { + for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) { + /* add command to queue for all healthy leds */ + if (_healthy[i]) { + new_cmd.led_num = i; + _cmd_queue->force(&new_cmd); + ret = OK; + } + } + + } else if (new_cmd.led_num < OREOLED_NUM_LEDS) { + /* request to set individual instance's rgb value */ + if (_healthy[new_cmd.led_num]) { + _cmd_queue->force(&new_cmd); + ret = OK; + } + } + + return ret; + default: /* see if the parent class can make any use of it */ ret = CDev::ioctl(filp, cmd, arg); |