CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
SonataRgbLedController Struct Reference

A driver for the Sonata's RGB LED Controller. More...

#include <platform-rgbctrl.hh>

Inheritance diagram for SonataRgbLedController:
Collaboration diagram for SonataRgbLedController:

Public Types

enum  ControlFields : uint32_t { ControlSet = 1 << 0 , ControlOff = 1 << 1 }
 Control Register Fields. More...
enum  StatusFields : uint32_t { StatusIdle = 1 << 0 }
 Status Register Fields. More...

Public Member Functions

void wait_for_idle () volatile
 Blocks until the controller is not busy.
void rgb (SonataRgbLed led, uint8_t red, uint8_t green, uint8_t blue) volatile
 Set the desired Red, Green, and Blue value of an LED.
void update () volatile
 Update the colours of the LEDs.
void off () volatile
 Switch all of the RGB LEDs off.

Public Attributes

uint32_t ledColors [2]
 Registers for setting the 8-bit red, green, and blue values for the two RGB Leds.
uint32_t control
 Control Register.
uint32_t status
 Status Register See SonataRgbLedController::StatusFields for the fields.

Detailed Description

A driver for the Sonata's RGB LED Controller.

Definition at line 18 of file platform-rgbctrl.hh.

Member Enumeration Documentation

◆ ControlFields

Control Register Fields.

Enumerator
ControlSet 

Write 1 to set RGB LEDs to specified colours.

ControlOff 

Write 1 to turn off RGB LEDs.

Write to ControlSet to turn on again.

Definition at line 37 of file platform-rgbctrl.hh.

◆ StatusFields

Status Register Fields.

Enumerator
StatusIdle 

When asserted controller is idle and new colours can be set, otherwise writes to regLed0, regLed1, and control are ignored.

Definition at line 49 of file platform-rgbctrl.hh.

Member Function Documentation

◆ off()

void SonataRgbLedController::off ( ) volatile
inline

Switch all of the RGB LEDs off.

Definition at line 92 of file platform-rgbctrl.hh.

References control, ControlOff, and wait_for_idle().

◆ rgb()

void SonataRgbLedController::rgb ( SonataRgbLed led,
uint8_t red,
uint8_t green,
uint8_t blue ) volatile
inline

Set the desired Red, Green, and Blue value of an LED.

To apply these changes, one needs to run SonataRgbLedController::update().

Definition at line 76 of file platform-rgbctrl.hh.

References ledColors, and wait_for_idle().

◆ update()

void SonataRgbLedController::update ( ) volatile
inline

Update the colours of the LEDs.

Definition at line 85 of file platform-rgbctrl.hh.

References control, ControlSet, and wait_for_idle().

◆ wait_for_idle()

void SonataRgbLedController::wait_for_idle ( ) volatile
inline

Blocks until the controller is not busy.

The controller can be busy when it is in the process of updating the LEDs. While busy, register writes will be ignored.

Definition at line 64 of file platform-rgbctrl.hh.

References status, and StatusIdle.

Referenced by off(), rgb(), and update().

Member Data Documentation

◆ control

uint32_t SonataRgbLedController::control

Control Register.

See SonataRgbLedController::ControlFields for the fields.

Definition at line 29 of file platform-rgbctrl.hh.

Referenced by off(), and update().

◆ ledColors

uint32_t SonataRgbLedController::ledColors[2]

Registers for setting the 8-bit red, green, and blue values for the two RGB Leds.

Definition at line 24 of file platform-rgbctrl.hh.

Referenced by rgb().

◆ status

uint32_t SonataRgbLedController::status

Status Register See SonataRgbLedController::StatusFields for the fields.

Definition at line 34 of file platform-rgbctrl.hh.

Referenced by wait_for_idle().


The documentation for this struct was generated from the following file: