Practical Robotics Modular Robot Library

Dependents:   ModularRobot

Committer:
jah128
Date:
Sat Nov 26 21:43:52 2016 +0000
Revision:
1:a6728adaf7e7
Parent:
0:8a2dd255c508
Child:
3:8762f6b2ea8d
Added docs, debug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jah128 0:8a2dd255c508 1 #ifndef LED_H
jah128 0:8a2dd255c508 2 #define LED_H
jah128 0:8a2dd255c508 3
jah128 1:a6728adaf7e7 4 /**
jah128 1:a6728adaf7e7 5 * The Led class contains the functions to control the robots LEDs
jah128 1:a6728adaf7e7 6 */
jah128 0:8a2dd255c508 7 class Led
jah128 0:8a2dd255c508 8 {
jah128 0:8a2dd255c508 9 public:
jah128 0:8a2dd255c508 10
jah128 0:8a2dd255c508 11 /**
jah128 0:8a2dd255c508 12 * Sends the reset command to the reserved i2c address for the TLC59116 LED driver
jah128 0:8a2dd255c508 13 *
jah128 0:8a2dd255c508 14 * As the led driver is powered independently from the MBED, and the MBED can be reset externally, this reset operation should
jah128 0:8a2dd255c508 15 * be run as part of the initialisation routine to switch off the LEDs and restore them to the initial state.
jah128 0:8a2dd255c508 16 *
jah128 0:8a2dd255c508 17 * @return A zero if acknowledge recceived from LED driver chip, otherwise a non-zero
jah128 0:8a2dd255c508 18 */
jah128 0:8a2dd255c508 19 int reset_led_driver(void);
jah128 0:8a2dd255c508 20
jah128 0:8a2dd255c508 21 /**
jah128 0:8a2dd255c508 22 * Turns on the oscillator and enables all the LED outputs on the TLC59116 LED driver
jah128 0:8a2dd255c508 23 *
jah128 0:8a2dd255c508 24 *
jah128 0:8a2dd255c508 25 * @return A zero if acknowledge recceived from LED driver chip, otherwise a non-zero
jah128 0:8a2dd255c508 26 */
jah128 0:8a2dd255c508 27 int init_led_driver(void);
jah128 0:8a2dd255c508 28
jah128 0:8a2dd255c508 29 /**
jah128 0:8a2dd255c508 30 *
jah128 0:8a2dd255c508 31 * Set an individual green led to the brightness specified
jah128 0:8a2dd255c508 32 *
jah128 0:8a2dd255c508 33 * @param led - The index of the LED from 0 to 7 (corresponds the 1 to 8 on the PCB)
jah128 0:8a2dd255c508 34 * @param brightness - The PWM duty cycle from 0 to 255
jah128 0:8a2dd255c508 35 */
jah128 0:8a2dd255c508 36 void set_green_led (char led, char brightness);
jah128 0:8a2dd255c508 37
jah128 0:8a2dd255c508 38 /**
jah128 0:8a2dd255c508 39 *
jah128 0:8a2dd255c508 40 * Set an individual red led to the brightness specified
jah128 0:8a2dd255c508 41 *
jah128 0:8a2dd255c508 42 * @param led - The index of the LED from 0 to 7 (corresponds the 1 to 8 on the PCB)
jah128 0:8a2dd255c508 43 * @param brightness - The PWM duty cycle from 0 to 255
jah128 0:8a2dd255c508 44 */
jah128 0:8a2dd255c508 45 void set_red_led (char led, char brightness);
jah128 0:8a2dd255c508 46
jah128 0:8a2dd255c508 47 /**
jah128 0:8a2dd255c508 48 * Start a ticker-based simple routine that cycles through the LEDs for testing
jah128 0:8a2dd255c508 49 */
jah128 0:8a2dd255c508 50 void start_test(void);
jah128 0:8a2dd255c508 51
jah128 0:8a2dd255c508 52 /**
jah128 0:8a2dd255c508 53 * The ticker loop for a simple routine that cycles through the LEDs for testing
jah128 0:8a2dd255c508 54 *
jah128 0:8a2dd255c508 55 */
jah128 0:8a2dd255c508 56 void test_ticker_routine(void);
jah128 0:8a2dd255c508 57
jah128 0:8a2dd255c508 58 };
jah128 0:8a2dd255c508 59
jah128 0:8a2dd255c508 60 #endif