The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.8KB

  1. /**
  2. @page controlling_led_grids Controlling LED grids
  3. @section basic_usage Basic usage
  4. An LED grid on a BLOCKS device can be controlled via an LEDGrid object, which can be obtained from the Block::getLEDGrid function of a Block---see the @ref discovering_blocks section for details of how to obtain a %Block object.
  5. Using an LED grid requires an LEDGrid::Program to operate the LEDs.
  6. This program specifies some code to run on the device, and can also provide methods to be called from your application which can comminucate with the code running on the device via a block of shared memory.
  7. The code which runs on the device must be specified using @ref the_littlefoot_language, which is described in the corresponding section.
  8. However, for a very wide range of applications, the BitmapLEDProgram provided with the BLOCKS SDK is sufficient and you will not need to create your own.
  9. Using a %BitmapLEDProgram to change the colour of LEDs is demonstated below.
  10. @code{.cpp}
  11. // This should be called when doing the initial configuration of your application.
  12. void setBitmapLEDProgram (Block& block)
  13. {
  14. if (auto grid = block->getLEDGrid())
  15. grid->setProgram (new BitmapLEDProgram (*grid));
  16. }
  17. // Once a BitmapLEDProgram is loaded we can use its setLED method to change the
  18. // colour of LEDs on the corresponding device.
  19. void setLED (Block& block, int x, int y, Colour c)
  20. {
  21. if (auto grid = block->getLEDGrid())
  22. if (auto program = dynamic_cast<BitmapLEDProgram*> (grid->getProgram()))
  23. program->setLED (x, y, c);
  24. }
  25. @endcode
  26. @section advanced_usage Advanced Usage
  27. Using a custom %LEDGrid::Program allows more precise control over the operation of the LEDs.
  28. The code which will actually execute on the device, returned by your overriden LEDGrid::Program::getLittleFootProgram() function, must be specified in the LittleFoot language.
  29. */