Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Ctr-led-brary 3DS: Difference between revisions

From GameBrew
(Created page with "{{Infobox 3DS homebrew | title = ctr-led-brary | image = https://dlhb.gamebrew.org/3dshomebrew/ctr-led-brary.jpeg|250px | type = Utilities | version = alpha | licence = Mixed...")
 
m (Text replacement - "Category:Homebrew utility applications on 3DS" to "")
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Infobox 3DS homebrew
{{Infobox 3DS Homebrews
| title = ctr-led-brary
|title=ctr-led-brary
| image = https://dlhb.gamebrew.org/3dshomebrew/ctr-led-brary.jpeg|250px
|image=Ctrledbrary2.png
| type = Utilities
|description=Small 3DS library to play patterns with the RGB notification LED.
| version = alpha
|author=mariohackandglitch
| licence = Mixed
|lastupdated=2017/10/14
| author = mariohackandglitch
|type=Utilities
| website = https://github.com/mariohackandglitch/ctr-led-brary
|version=alpha
| download = https://dlhb.gamebrew.org/3dshomebrew/ctr-led-brary.rar
|license=Mixed
| source = https://dlhb.gamebrew.org/3dshomebrew/ctr-led-brary.rar
|download=https://dlhb.gamebrew.org/3dshomebrews/ctrledbrary.7z
|website=https://gbatemp.net/threads/release-ctr-led-brary-c-library-to-control-the-leds.486620/
|source=https://github.com/mariohackandglitch/ctr-led-brary
}}
}}
ctr-led-brary is a small c++ library to play patterns with the 3DS RGB notification LED. This is only meant for developers, not an standalone homebrew application.
The 3DS notification led is a RGB256 led which can (theorically) display 2^24 different colors (including black). This library allows to play patterns using the ptm sysmodule.
==Features==
* Generate different types of color patterns, including constant, linear and sinusoidal.
* Set the pattern and loop delay and smoothing values.
* Play and Stop the generated color patterns with the Notification LED.
==Installation==
Download contains an example shown in the [https://www.gamebrew.org/wiki/Ctr-led-brary_3DS#Media demo video] in 3DSX format and source.
==User guide==
You can find all the documentation on how to use the library and the example from the [https://github.com/mariohackandglitch/ctr-led-brary GitHub page].
==Media==
'''Example homebrew''' ([https://www.youtube.com/watch?v=tsDg8ySHB3k PabloMK7]) <br>
<youtube>tsDg8ySHB3k</youtube>
<youtube>tsDg8ySHB3k</youtube>


[https://gbatemp.net/threads/release-ctr-led-brary-c-library-to-control-the-leds.486620/ https://gbatemp.net/threads/release-ctr-led-brary-c-library-to-control-the-leds.486620/]
'''Practical implementation''' ([https://www.youtube.com/watch?v=Ff9EDcb8aEs PabloMK7]) <br>
= ctr-led-brary =
<youtube>Ff9EDcb8aEs</youtube>
Small c++ library to play patterns with the 3DS RGB notification LED. This is only meant for developers, not an standalone homebrew app.
 
== Description ==
==Credits==
The 3DS notification led is a RGB256 led which can (theorically) display 2^24 different colors (including black). This library allows to play patterns using the ptm sysmodule. Read below for an explanation of how the library works.
MarcusD - Notification LED research.
== Installation ==
 
Clone the repository, cd to inside your local copy (with the Makefile), then run <code>make</code> and <code>make install</code>. THe library should be installed after that. When writing applications, make sure to check that -lctr-led-brary is mentioned in your Makefile like so: <code>LIBS := -lctr-led-brary -lctru -lm</code>
PabloMK7 - Creation of the library.
== LED Patterns ==
 
The way the ptm sysmodule plays LED patterns is with the RGBLedPattern struct. This struct contains 32 RGB256 samples (three bytes each for red, green and blue) which are played sequentially and can be optionally looped. Additionally, it holds the amount of time the whole pattern takes to be played, a smooth value, the amount of time between loops and an unknown value (?) all of them stored in one byte each ([https://3dbrew.org/wiki/MCURTC:SetInfoLEDPattern https://3dbrew.org/wiki/MCURTC:SetInfoLEDPattern]). While all the RGB samples can be introduced manually by editing the struct, this library provides a generator to create multiple pattern types. This is done using the pattern generation method: <code>LED::GeneratePattern(LED_Color color, LED_PatType type, float delay_time, float loop_delay, u8 smooth = 0, float r_shift = 0, float g_shift = 0, float b_shift = 0);</code>
All the people involved in ctrulib.
* <code>LED_Color color</code>: The RGB color to be played by the LED. It can be passed using the LED_Color struct, for example the color red would be: <code>LED_Color(0xFF, 0x00, 0x00)</code>. You can get color codes here: [http://www.rapidtables.com/web/color/RGB_Color.htm http://www.rapidtables.com/web/color/RGB_Color.htm]
 
* <code>LED_PatType type</code>: Used to generate color patterns. Read below for a complete description.
==External links==
* <code>float delay_time</code>: The amount of seconds the pattern takes to play (this can range from 1/16th of a second to 16 seconds). Setting the value to zero equals setting the value to 16.
* GitHub - https://github.com/mariohackandglitch/ctr-led-brary
* <code>float loop_delay</code>: The amount of seconds the pattern waits between each loop (this can range from 0 to 16 seconds). When the pattern is waiting, the latest RGB sample is displayed until it loops again. Set this to a value bigger than 16 to make the pattern loop only once.
* GBAtemp - https://gbatemp.net/threads/release-ctr-led-brary-c-library-to-control-the-leds.486620
* <code>u8 smooth</code>: Smoothing applied to the resulting pattern. See here for a visual representation: [https://imgur.com/ZxdPbIw https://imgur.com/ZxdPbIw]
* <code>float r/g/b_shift</code>: Used to generate color patterns. Read below for a complete description.
== Pattern Generation ==
The pattern generation method allows to create different kinds of patterns:
* <code>LED_PatType::CONSTANT</code>: Generates a color pattern with the same intensity over time.
* <code>LED_PatType::ASCENDENT</code>: Generates a linear color pattern increasing in intensity over time. When looped, it generates a sawtooth wave.
* <code>LED_PatType::DESCENDENT</code>: Generates a linear color pattern decreasing in intensity over time. When looped, it generates an inverted sawtooth wave.
* <code>LED_PatType::WAVE_ASC</code>: Generates a sinusoidal oscillation starting from intensity zero. When looped, it generates a sinus wave.
* <code>LED_PatType::WAVE_DESC</code>: Generates a sinusoidal oscillation starting from max intensity. When looped, it generates a sinus wave. The method also has three optional parameters, <code>r_shift</code>,<code>g_shift</code>,<code>b_shift</code>. Those parameters are used to shift the individual RGB channels a certain amount (this means more or less that the value in each channel sample is moved to the next sample a certain amount, shifting the whole pattern. Internally, this process is made in another way to increase the precision). The shift value has to between 0 and 1, being 1 a whole shift (in the case the value is bigger than 1, only the decimal part will be used). The shift value can be applied to any pattern type (however, applying a shift to <code>LED_PatType::CONSTANT</code> has no effect). The shifting operation is useful for generating patterns with more than one color (see patterns 6 and 7 in the example).
== Pattern Playing ==
After a pattern has been generated, it can be played using: <code>LED::PlayLEDPattern(RGBLedPattern pattern);</code>. To stop the current playing pattern use: <code>LED::StopLEDPattern();</code>. It's up to the user to handle the amount of time the pattern is played and when to stop it as it will loop infinitely until Stop is called (or will be played once keeping the last color sample if <code>loop_delay</code> is bigger than 16). To inmediately switch between patterns use <code>LED::SwitchLEDPattern(RGBLedPattern pattern);</code> this method needs a pattern to be already playing.
== Credits ==
* MarcusD: Notification LED research.
* PabloMK7: Creation of the library.
* All the people involved in ctrulib.
== License ==
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
# The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
# Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
# This notice may not be removed or altered from any source distribution.

Latest revision as of 05:53, 6 Mayıs 2024

ctr-led-brary
Ctrledbrary2.png
General
Authormariohackandglitch
TypeUtilities
Versionalpha
LicenseMixed
Last Updated2017/10/14
Links
Download
Website
Source

ctr-led-brary is a small c++ library to play patterns with the 3DS RGB notification LED. This is only meant for developers, not an standalone homebrew application.

The 3DS notification led is a RGB256 led which can (theorically) display 2^24 different colors (including black). This library allows to play patterns using the ptm sysmodule.

Features

  • Generate different types of color patterns, including constant, linear and sinusoidal.
  • Set the pattern and loop delay and smoothing values.
  • Play and Stop the generated color patterns with the Notification LED.

Installation

Download contains an example shown in the demo video in 3DSX format and source.

User guide

You can find all the documentation on how to use the library and the example from the GitHub page.

Media

Example homebrew (PabloMK7)

Practical implementation (PabloMK7)

Credits

MarcusD - Notification LED research.

PabloMK7 - Creation of the library.

All the people involved in ctrulib.

External links

Advertising: