forked from Archive/PX4-Autopilot
oreoled: support send_bytes ioctl
Also increase maximum command length to 24 bytes
This commit is contained in:
parent
690b29d271
commit
48bf84ff37
|
@ -58,6 +58,9 @@
|
||||||
/** run macro */
|
/** run macro */
|
||||||
#define OREOLED_RUN_MACRO _OREOLEDIOC(2)
|
#define OREOLED_RUN_MACRO _OREOLEDIOC(2)
|
||||||
|
|
||||||
|
/** send bytes */
|
||||||
|
#define OREOLED_SEND_BYTES _OREOLEDIOC(3)
|
||||||
|
|
||||||
/* Oreo LED driver supports up to 4 leds */
|
/* Oreo LED driver supports up to 4 leds */
|
||||||
#define OREOLED_NUM_LEDS 4
|
#define OREOLED_NUM_LEDS 4
|
||||||
|
|
||||||
|
@ -65,7 +68,7 @@
|
||||||
#define OREOLED_ALL_INSTANCES 0xff
|
#define OREOLED_ALL_INSTANCES 0xff
|
||||||
|
|
||||||
/* maximum command length that can be sent to LEDs */
|
/* maximum command length that can be sent to LEDs */
|
||||||
#define OREOLED_CMD_LENGTH_MAX 10
|
#define OREOLED_CMD_LENGTH_MAX 24
|
||||||
|
|
||||||
/* enum passed to OREOLED_SET_MODE ioctl()
|
/* enum passed to OREOLED_SET_MODE ioctl()
|
||||||
* defined by hardware */
|
* defined by hardware */
|
||||||
|
|
|
@ -368,6 +368,31 @@ OREOLED::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||||
|
|
||||||
return ret;
|
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:
|
default:
|
||||||
/* see if the parent class can make any use of it */
|
/* see if the parent class can make any use of it */
|
||||||
ret = CDev::ioctl(filp, cmd, arg);
|
ret = CDev::ioctl(filp, cmd, arg);
|
||||||
|
|
Loading…
Reference in New Issue