Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LED drivers: extract documentation from LED/RGB Matrix pages #23630

Merged
merged 6 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix anchors
  • Loading branch information
fauxpark committed Jun 2, 2024
commit 415dfd4b4eb7b081295248193a8d00869a7cfe30
34 changes: 17 additions & 17 deletions docs/drivers/aw20216s.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# AW20216S Driver :id=aw20216s-driver
# AW20216S Driver {#aw20216s-driver}

SPI 18x12 LED matrix driver by Awinic. Supports a maximum of four drivers, each controlling up to 216 single-color LEDs, or 72 RGB LEDs.

[AW20216S Datasheet](https://doc.awinic.com/doc/20230609wm/b6a9c70b-e1bd-495b-925f-bcbed3fc2620.pdf)

## Usage :id=usage
## Usage {#usage}

The AW20216S driver code is automatically included if you are using the [RGB Matrix](../features/rgb_matrix) feature with the `aw20216s` driver set, and you would use those APIs instead.

Expand All @@ -16,7 +16,7 @@ SRC += aw20216s.c
SPI_DRIVER_REQUIRED = yes
```

## Basic Configuration :id=basic-configuration
## Basic Configuration {#basic-configuration}

Add the following to your `config.h`:

Expand All @@ -30,19 +30,19 @@ Add the following to your `config.h`:
|`AW20216S_SCALING_MAX` |`150` |The scaling value |
|`AW20216S_GLOBAL_CURRENT_MAX`|`150` |The global current control value |

### Global Current Control :id=global-current-control
### Global Current Control {#global-current-control}

This setting controls the current sunk by the `CSx` pins, from 0 to 255. To adjust it, add the following to your `config.h`:

```c
#define AW20216S_GLOBAL_CURRENT_MAX 150
```

## ARM/ChibiOS Configuration :id=arm-configuration
## ARM/ChibiOS Configuration {#arm-configuration}

Depending on the ChibiOS board configuration, you may need to [enable and configure SPI](spi#arm-configuration) at the keyboard level.

## LED Mapping :id=led-mapping
## LED Mapping {#led-mapping}

In order to use this driver, each output must be mapped to an LED index, by adding the following to your `<keyboardname>.c`:

Expand All @@ -59,13 +59,13 @@ In this example, the first LED index on driver 0 has its red channel on `SW1_CS1

These values correspond to the matrix locations as shown in the datasheet on page 16, figure 16.

## API :id=api
## API {#api}

### `struct aw20216s_led_t` :id=api-aw20216s-led-t
### `struct aw20216s_led_t` {#api-aw20216s-led-t}

Contains the PWM register addresses for a single RGB LED.

#### Members :id=api-aw20216s-led-t-members
#### Members {#api-aw20216s-led-t-members}

- `uint8_t driver`
The driver index of the LED, from 0 to 3.
Expand All @@ -78,22 +78,22 @@ Contains the PWM register addresses for a single RGB LED.

---

### `void aw20216s_init(pin_t cs_pin)` :id=api-aw20216s-init
### `void aw20216s_init(pin_t cs_pin)` {#api-aw20216s-init}

Initialize the LED driver. This function should be called first.

#### Arguments :id=api-aw20216s-init-arguments
#### Arguments {#api-aw20216s-init-arguments}

- `pin_t cs_pin`
The GPIO connected to the Chip Select pin of the LED driver to initialize.

---

### `void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue)` :id=api-aw20216s-set-color
### `void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue)` {#api-aw20216s-set-color}

Set the color of a single LED. This function does not immediately update the LEDs; call `aw20216s_update_pwm_buffers()` after you are finished.

#### Arguments :id=api-aw20216s-set-color-arguments
#### Arguments {#api-aw20216s-set-color-arguments}

- `int index`
The LED index (ie. the index into the `g_aw20216s_leds` array).
Expand All @@ -106,11 +106,11 @@ Set the color of a single LED. This function does not immediately update the LED

---

### `void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` :id=api-aw20216s-set-color-all
### `void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` {#api-aw20216s-set-color-all}

Set the color of all LEDs.

#### Arguments :id=api-aw20216s-set-color-all-arguments
#### Arguments {#api-aw20216s-set-color-all-arguments}

- `uint8_t red`
The red value to set.
Expand All @@ -121,11 +121,11 @@ Set the color of all LEDs.

---

### `void aw20216s_update_pwm_buffers(pin_t cs_pin, uint8_t index)` :id=api-aw20216s-update-pwm-buffers
### `void aw20216s_update_pwm_buffers(pin_t cs_pin, uint8_t index)` {#api-aw20216s-update-pwm-buffers}

Flush the PWM values to the LED driver.

#### Arguments :id=api-aw20216s-update-pwm-buffers-arguments
#### Arguments {#api-aw20216s-update-pwm-buffers-arguments}

- `pin_t cs_pin`
The GPIO connected to the Chip Select pin of the driver.
Expand Down
52 changes: 26 additions & 26 deletions docs/drivers/is31fl3218.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# IS31FL3218 Driver :id=is31fl3218-driver
# IS31FL3218 Driver {#is31fl3218-driver}

I²C LED driver by Lumissil. Supports up to 18 single-color LEDs, or 6 RGB LEDs.

[IS31FL3218 Datasheet](https://www.lumissil.com/assets/pdf/core/IS31FL3218_DS.pdf)

## Usage :id=usage
## Usage {#usage}

The IS31FL3218 driver code is automatically included if you are using the [LED Matrix](../features/led_matrix) or [RGB Matrix](../features/rgb_matrix) feature with the `is31fl3218` driver set, and you would use those APIs instead.

Expand All @@ -17,7 +17,7 @@ SRC += is31fl3218.c # For RGB
I2C_DRIVER_REQUIRED = yes
```

## Basic Configuration :id=basic-configuration
## Basic Configuration {#basic-configuration}

Add the following to your `config.h`:

Expand All @@ -27,15 +27,15 @@ Add the following to your `config.h`:
|`IS31FL3218_I2C_TIMEOUT` |`100` |The I²C timeout in milliseconds |
|`IS31FL3218_I2C_PERSISTENCE`|`0` |The number of times to retry I²C transmissions |

### I²C Addressing :id=i2c-addressing
### I²C Addressing {#i2c-addressing}

The IS31FL3218's 7-bit I²C address is `0x54`, available as `IS31FL3218_I2C_ADDRESS`.

## ARM/ChibiOS Configuration :id=arm-configuration
## ARM/ChibiOS Configuration {#arm-configuration}

Depending on the ChibiOS board configuration, you may need to [enable and configure I²C](i2c#arm-configuration) at the keyboard level.

## LED Mapping :id=led-mapping
## LED Mapping {#led-mapping}

In order to use this driver, each output must be mapped to an LED index, by adding the following to your `<keyboardname>.c`:

Expand All @@ -59,13 +59,13 @@ const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT] = {
};
```

## API :id=api
## API {#api}

### `struct is31fl3218_led_t` :id=api-is31fl3218-led-t
### `struct is31fl3218_led_t` {#api-is31fl3218-led-t}

Contains the PWM register addresses for a single RGB LED.

#### Members :id=api-is31fl3218-led-t-members
#### Members {#api-is31fl3218-led-t-members}

- `uint8_t r`
The output PWM register address for the LED's red channel (RGB driver only).
Expand All @@ -78,17 +78,17 @@ Contains the PWM register addresses for a single RGB LED.

---

### `void is31fl3218_init(void)` :id=api-is31fl3218-init
### `void is31fl3218_init(void)` {#api-is31fl3218-init}

Initialize the LED driver. This function should be called first.

---

### `void is31fl3218_write_register(uint8_t reg, uint8_t data)` :id=api-is31fl3218-write-register
### `void is31fl3218_write_register(uint8_t reg, uint8_t data)` {#api-is31fl3218-write-register}

Set the value of the given register.

#### Arguments :id=api-is31fl3218-write-register-arguments
#### Arguments {#api-is31fl3218-write-register-arguments}

- `uint8_t reg`
The register address.
Expand All @@ -97,11 +97,11 @@ Set the value of the given register.

---

### `void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue)` :id=api-is31fl3218-set-color
### `void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue)` {#api-is31fl3218-set-color}

Set the color of a single LED (RGB driver only). This function does not immediately update the LEDs; call `is31fl3218_update_pwm_buffers()` after you are finished.

#### Arguments :id=api-is31fl3218-set-color-arguments
#### Arguments {#api-is31fl3218-set-color-arguments}

- `int index`
The LED index (ie. the index into the `g_is31fl3218_leds` array).
Expand All @@ -114,11 +114,11 @@ Set the color of a single LED (RGB driver only). This function does not immediat

---

### `void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` :id=api-is31fl3218-set-color-all
### `void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` {#api-is31fl3218-set-color-all}

Set the color of all LEDs (RGB driver only).

#### Arguments :id=api-is31fl3218-set-color-all-arguments
#### Arguments {#api-is31fl3218-set-color-all-arguments}

- `uint8_t red`
The red value to set.
Expand All @@ -129,11 +129,11 @@ Set the color of all LEDs (RGB driver only).

---

### `void is31fl3218_set_value(int index, uint8_t value)` :id=api-is31fl3218-set-value
### `void is31fl3218_set_value(int index, uint8_t value)` {#api-is31fl3218-set-value}

Set the brightness of a single LED (single-color driver only). This function does not immediately update the LEDs; call `is31fl3218_update_pwm_buffers()` after you are finished.

#### Arguments :id=api-is31fl3218-set-value-arguments
#### Arguments {#api-is31fl3218-set-value-arguments}

- `int index`
The LED index (ie. the index into the `g_is31fl3218_leds` array).
Expand All @@ -142,22 +142,22 @@ Set the brightness of a single LED (single-color driver only). This function doe

---

### `void is31fl3218_set_value_all(uint8_t value)` :id=api-is31fl3218-set-value-all
### `void is31fl3218_set_value_all(uint8_t value)` {#api-is31fl3218-set-value-all}

Set the brightness of all LEDs (single-color driver only).

#### Arguments :id=api-is31fl3218-set-value-all-arguments
#### Arguments {#api-is31fl3218-set-value-all-arguments}

- `uint8_t value`
The brightness value to set.

---

### `void is31fl3218_set_led_control_register(uint8_t index, bool red, bool green, bool blue)` :id=api-is31fl3218-set-led-control-register-rgb
### `void is31fl3218_set_led_control_register(uint8_t index, bool red, bool green, bool blue)` {#api-is31fl3218-set-led-control-register-rgb}

Configure the LED control registers for a single LED (RGB driver only). This function does not immediately update the LEDs; call `is31fl3218_update_led_control_registers()` after you are finished.

#### Arguments :id=api-is31fl3218-set-led-control-register-rgb-arguments
#### Arguments {#api-is31fl3218-set-led-control-register-rgb-arguments}

- `uint8_t index`
The LED index (ie. the index into the `g_is31fl3218_leds` array).
Expand All @@ -170,11 +170,11 @@ Configure the LED control registers for a single LED (RGB driver only). This fun

---

### `void is31fl3218_set_led_control_register(uint8_t index, bool value)` :id=api-is31fl3218-set-led-control-register-mono
### `void is31fl3218_set_led_control_register(uint8_t index, bool value)` {#api-is31fl3218-set-led-control-register-mono}

Configure the LED control registers for a single LED (single-color driver only). This function does not immediately update the LEDs; call `is31fl3218_update_led_control_registers()` after you are finished.

#### Arguments :id=api-is31fl3218-set-led-control-register-mono-arguments
#### Arguments {#api-is31fl3218-set-led-control-register-mono-arguments}

- `uint8_t index`
The LED index (ie. the index into the `g_is31fl3218_leds` array).
Expand All @@ -183,12 +183,12 @@ Configure the LED control registers for a single LED (single-color driver only).

---

### `void is31fl3218_update_pwm_buffers(void)` :id=api-is31fl3218-update-pwm-buffers
### `void is31fl3218_update_pwm_buffers(void)` {#api-is31fl3218-update-pwm-buffers}

Flush the PWM values to the LED driver.

---

### `void is31fl3218_update_led_control_registers(void)` :id=api-is31fl3218-update-led-control-registers
### `void is31fl3218_update_led_control_registers(void)` {#api-is31fl3218-update-led-control-registers}

Flush the LED control register values to the LED driver.
Loading
Loading