nuttx/include/nuttx
William Byatt a6b45dd471 video/rgbcolors: Fix RGBTO8 to use the high bits of each component.
RGBTO8 shifted each component up before masking:

    (((uint8_t)(r) << 5) & 0xe0)

The cast is promoted to int before the shift, so the mask keeps bits 5:7
of the shifted value, which are bits 0:2 of r.  The macro therefore
encoded the three least significant bits of red and green and the two
least significant bits of blue, rather than the most significant.

This disagrees with RGBTO16 in the same file, which correctly takes the
high bits, and with RGB8RED/RGB8GREEN/RGB8BLUE immediately below it,
which are documented as the inverse transformation but read the result
as high bits.

All in-tree callers pass full 8-bit components, so all were affected:
RGBTO8(39, 64, 139) in apps/examples/nxterm, intended as midnight blue,
evaluates to 0xe3 -- full red plus full blue, i.e. magenta.

Take the high bits instead, so that RGBTO8 matches RGBTO16 and the
RGB8xxx macros become its true inverse.

Tested on a RISC-V LiteX/VexRiscv target with an 8bpp RGB332 frame
buffer, and with a host round-trip check over all 256 representable
colours.

Assisted-by: Claude:claude-opus-5
Signed-off-by: William Byatt <william@byatt.io>
2026-08-10 22:43:20 +08:00
..
1wire
aie
analog !arm/stm32l4: standardize public API/type prefix to stm32_ 2026-06-23 09:45:36 +08:00
audio drivers/audio/i2s: Fix unsigned integers in function signatures 2026-07-06 19:57:13 +08:00
binfmt
can
clk drivers/clk: use uintptr_t for register addresses 2026-06-23 09:46:33 +08:00
contactless
coresight
crypto drivers/crypto: add Microchip RNG90 driver 2026-08-03 17:23:22 +08:00
dma
drivers
eeprom
efuse
fs libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes 2026-08-03 20:58:39 +08:00
himem
hwspinlock
i2c
i3c
input drivers/input: partial fix of indistinguishable ASCII and special keycodes 2026-08-04 09:33:53 +08:00
ioexpander
lcd
leds
lib lib/math32: Avoid __uint128_t casts for LDC ImportC 2026-08-03 22:20:43 +08:00
math
mbox
mm
modem
motor
mtd drivers/mtd/gd25: add QSPI support 2026-07-03 10:32:41 +08:00
net
note
nx
pci
pinctrl
power
rc
regmap
reset
rf
rpmsg
rptun
segger
sensors !sensors/bme680: allow sensor configuration during registration 2026-06-10 20:45:31 +02:00
serial drivers/serial: add job-control TTY ioctls and libc wrappers 2026-08-06 17:48:04 +08:00
spi stm32h5/qspi: add QSPIMEM_QUADDATA flag for 1-1-4 transfers 2026-07-03 10:32:41 +08:00
syslog
timers drivers/watchdog: fix capture automonitor notifier context 2026-08-03 17:22:37 +08:00
usb
usrsock
vhost
video video/rgbcolors: Fix RGBTO8 to use the high bits of each component. 2026-08-10 22:43:20 +08:00
virtio
wireless
.gitignore
addrenv.h
allsyms.h
arch.h
ascii.h
atexit.h
atomic.h
bits.h
board.h
cache.h
can.h
cancelpt.h
circbuf.h
clock.h
clock_notifier.h
compiler.h float.h: improve long double related definitions 2026-07-03 10:32:57 +08:00
coredump.h
crc8.h
crc16.h
crc32.h
crc64.h
debug.h
elf.h
environ.h
envpath.h
ethtool.h
event.h
fdcheck.h
fdt.h
gdbstub.h
hashtable.h
hrtimer.h
idr.h
init.h
instrument.h
ipcc.h
irq.h
kmalloc.h
kthread.h
lin.h
lirc.h
list.h
list_type.h
macro.h
memoryregion.h
mmcsd.h
module.h
mqueue.h
mutex.h
notifier.h
nuttx.h
page.h
panic_notifier.h
pgalloc.h
progmem.h
pthread.h
queue.h
random.h
reboot_notifier.h
rwsem.h
sched.h Documentation/sched: Add POSIX user identity transition docs 2026-06-17 17:13:57 +08:00
sched_note.h
scsi.h
sdio.h arch/arm/src/stm32{h7,f7,l4}: add 4-bit wide bus support for MMC/eMMC cards 2026-08-05 15:55:14 +08:00
sdio_slave.h
semaphore.h include/nuttx/semaphore.h: parenthesize NXSEM helper args 2026-06-10 22:39:46 +08:00
seqlock.h
signal.h
spawn.h
spinlock.h
spinlock_type.h
streams.h
symtab.h
tee.h
thermal.h
tls.h
trace.h
uorb.h
userspace.h
vt100.h
wdog.h drivers: Fix comment typos — 'Pubic' → 'Public' across drivers and headers. 2026-07-04 02:00:24 +08:00
wqueue.h
zoneinfo.h