@@ -29,7 +29,7 @@ In short, choose the size that fits your application.
2929
3030The library has a ** setGamma(float gamma)** function that allows an application
3131to change the gamma value runtime.
32- This allows adjustments that a fixed table does not have .
32+ This allows adjustments that are not possible with a fixed table .
3333
3434The class provides ** dump()** to create a table e.g. to place in PROGMEM.
3535Since 0.2.2 the library also has ** dumpArray()** to generate a C-style array.
@@ -46,18 +46,22 @@ array as parameter. The default for size = 32 as this is a good balance between
4646and size of the internal array.
4747The size parameter must be in {2, 4, 8, 16, 32, 64, 128, 256 }.
4848- ** ~ GAMMA()** destructor.
49- - ** void begin()** The internal array is allocated and initialized with a gamma == 2.8.
49+ - ** bool begin()** The internal array is allocated and initialized with a gamma == 2.8.
5050This is an often used value to adjust light to human eye responses.
5151Note that ** begin()** must be called before any other function.
52+ Returns false if allocation fails.
5253- ** void setGamma(float gamma)** calculates and fills the array with new values.
5354This can be done runtime so runtime adjustment of gamma mapping is possible.
5455This calculation are relative expensive and takes quite some time (depending on size).
5556If the array already is calculated for gamma, the calculation will be skipped.
5657The parameter ** gamma** must be > 0. The value 1 gives an 1:1 mapping.
58+ Returns false if gamma <= 0 or if no table is allocated.
5759- ** float getGamma()** returns the set gamma value.
58- - ** uint8_t operator \[\] ** allows the GAMMA object to be accessed as an array.
60+ - ** uint8_t operator \[ uint8_t index \] ** allows the GAMMA object to be accessed as an array.
5961like ``` x = G[40]; ``` Makes it easy to switch with a real array.
60- The value returned is in the range 0 .. 255, so the user may need to scale it e.g. to 0.0 - 1.0
62+ The value returned is in the range 0 .. 255, so the user may need to scale it e.g. to 0.0 - 1.0.
63+ Note: if internal table not allocated the function returns 0.
64+ As this is a legitimate value the user should take care.
6165
6266
6367### Development functions
@@ -66,9 +70,11 @@ The value returned is in the range 0 .. 255, so the user may need to scale it e.
6670This is always a power of 2.
6771- ** uint16_t distinct()** returns the number of distinct values in the table.
6872Especially with larger internal tables there will be duplicate numbers in the table.
69- - ** void dump(Stream \* str = &Serial)** dumps the internal table to a stream, default Serial.
73+ - ** bool dump(Stream \* str = &Serial)** dumps the internal table to a stream, default Serial.
7074Useful to create an array in RAM, PROGMEM, EEPROM, in a file or wherever.
75+ Returns false if no table is allocated.
7176- ** void dumpArray(Stream \* str = &Serial)** dumps the internal table to a stream, default Serial, as a C-style array. See example.
77+ Returns false if no table is allocated.
7278
7379
7480## Operation
@@ -83,10 +89,8 @@ See example.
8389- look for optimizations
8490 - getter \[\]
8591 - setGamma -> pow() is expensive
86- - improvements (0.3.0)
87- - return bool => begin() + setGamma() + dump()?
88- - check \_ table != NULL in functions
89- - add gamma<=0 check in setGamma()
9092- uint16 version?
93+ - GAMMA16, GAMMA32,
94+ - GAMMA_RGB ?
9195-
9296
0 commit comments