Practical Robotics Modular Robot Library
Diff: led.h
- Revision:
- 0:8a2dd255c508
- Child:
- 1:a6728adaf7e7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.h Sat Nov 26 17:28:53 2016 +0000 @@ -0,0 +1,57 @@ +#ifndef LED_H +#define LED_H + +class Led +{ +public: + + /** + * Sends the reset command to the reserved i2c address for the TLC59116 LED driver + * + * As the led driver is powered independently from the MBED, and the MBED can be reset externally, this reset operation should + * be run as part of the initialisation routine to switch off the LEDs and restore them to the initial state. + * + * @return A zero if acknowledge recceived from LED driver chip, otherwise a non-zero + */ + int reset_led_driver(void); + + /** + * Turns on the oscillator and enables all the LED outputs on the TLC59116 LED driver + * + * + * @return A zero if acknowledge recceived from LED driver chip, otherwise a non-zero + */ + int init_led_driver(void); + + /** + * + * Set an individual green led to the brightness specified + * + * @param led - The index of the LED from 0 to 7 (corresponds the 1 to 8 on the PCB) + * @param brightness - The PWM duty cycle from 0 to 255 + */ + void set_green_led (char led, char brightness); + + /** + * + * Set an individual red led to the brightness specified + * + * @param led - The index of the LED from 0 to 7 (corresponds the 1 to 8 on the PCB) + * @param brightness - The PWM duty cycle from 0 to 255 + */ + void set_red_led (char led, char brightness); + + /** + * Start a ticker-based simple routine that cycles through the LEDs for testing + */ + void start_test(void); + + /** + * The ticker loop for a simple routine that cycles through the LEDs for testing + * + */ + void test_ticker_routine(void); + +}; + +#endif