For those also trying to use the on-board RGB led on the Arduino Giga Display Shield, here is some code that does that - I failed to find any direct documentation.
import machine, time
from machine import I2C
COLOR_WHITE = (255, 255, 255)
COLOR_OFF = ( 0, 0, 0)
COLOR_RED = (255, 0, 0)
COLOR_GREEN = ( 0, 255, 0)
COLOR_BLUE = ( 0, 0, 255)
class shield_leds:
'''
i2c communication to the rgb LED on the giga display shield
inspired from https://github.com/arduino-libraries/Arduino_GigaDisplay/blob/main/src/GigaDisplayRGB.cpp
documentation on https://www.lumissil.com/assets/pdf/core/IS31FL3197_DS.pdf
'''
def __init__(self):
# Initialize I2C bus to get to the rgb led on the display shield
self.i2c = I2C(4) # it's I2C4 on PB6 (SCL), PH12 (SDA)
devices = self.i2c.scan()
self.addr = 80
if self.addr not in devices:
print(f'- rgbLED i2c [{self.addr}] not found in {devices}')
else:
print('+ giga display shield on-board led found')
def writebyte(self, reg, data):
'''
writes a single message
'''
self.i2c.writeto(self.addr, bytes([0x50]))
self.i2c.writeto_mem(self.addr, reg, data) # Write 0xF1 to register 0x01
def set_rgb(self, color):
'''
writes a message to set intensity for each led
'''
# start of message
self.writebyte(0x1, bytes([0xf1]))
self.writebyte(0x2, bytes([0xff]))
# intensity codes for the colors from the input tuple
self.writebyte(0x10, bytes([color[0]])) # red
self.writebyte(0x11, bytes([color[1]])) # green
self.writebyte(0x12, bytes([color[2]])) # blue
# end of message
self.writebyte(0x2b, bytes([0xc5]))
rgb = shield_leds()
rgb.set_rgb(COLOR_OFF) # leds off
while True:
time.sleep(1)
rgb.set_rgb(COLOR_RED)
time.sleep(1)
rgb.set_rgb(COLOR_GREEN)
time.sleep(1)
rgb.set_rgb(COLOR_BLUE)