Practical Robotics Modular Robot Library

Dependents:   ModularRobot

Committer:
jah128
Date:
Mon Nov 28 22:41:14 2016 +0000
Revision:
3:8762f6b2ea8d
Parent:
1:a6728adaf7e7
Child:
4:c2e933d53bea
Added first RPi input

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 3:8762f6b2ea8d 30 * Set the brightness of all case LEDs to zero
jah128 3:8762f6b2ea8d 31 */
jah128 3:8762f6b2ea8d 32 void all_off(void);
jah128 3:8762f6b2ea8d 33
jah128 3:8762f6b2ea8d 34 /**
jah128 0:8a2dd255c508 35 *
jah128 0:8a2dd255c508 36 * Set an individual green led to the brightness specified
jah128 0:8a2dd255c508 37 *
jah128 0:8a2dd255c508 38 * @param led - The index of the LED from 0 to 7 (corresponds the 1 to 8 on the PCB)
jah128 0:8a2dd255c508 39 * @param brightness - The PWM duty cycle from 0 to 255
jah128 0:8a2dd255c508 40 */
jah128 0:8a2dd255c508 41 void set_green_led (char led, char brightness);
jah128 0:8a2dd255c508 42
jah128 0:8a2dd255c508 43 /**
jah128 0:8a2dd255c508 44 *
jah128 0:8a2dd255c508 45 * Set an individual red led to the brightness specified
jah128 0:8a2dd255c508 46 *
jah128 0:8a2dd255c508 47 * @param led - The index of the LED from 0 to 7 (corresponds the 1 to 8 on the PCB)
jah128 0:8a2dd255c508 48 * @param brightness - The PWM duty cycle from 0 to 255
jah128 0:8a2dd255c508 49 */
jah128 0:8a2dd255c508 50 void set_red_led (char led, char brightness);
jah128 0:8a2dd255c508 51
jah128 0:8a2dd255c508 52 /**
jah128 0:8a2dd255c508 53 * Start a ticker-based simple routine that cycles through the LEDs for testing
jah128 0:8a2dd255c508 54 */
jah128 0:8a2dd255c508 55 void start_test(void);
jah128 3:8762f6b2ea8d 56
jah128 3:8762f6b2ea8d 57 /**
jah128 3:8762f6b2ea8d 58 * Stops the ticker-based routine
jah128 3:8762f6b2ea8d 59 */
jah128 3:8762f6b2ea8d 60 void stop_test(void);
jah128 0:8a2dd255c508 61
jah128 0:8a2dd255c508 62 /**
jah128 0:8a2dd255c508 63 * The ticker loop for a simple routine that cycles through the LEDs for testing
jah128 0:8a2dd255c508 64 *
jah128 0:8a2dd255c508 65 */
jah128 0:8a2dd255c508 66 void test_ticker_routine(void);
jah128 0:8a2dd255c508 67
jah128 0:8a2dd255c508 68 };
jah128 0:8a2dd255c508 69
jah128 0:8a2dd255c508 70 #endif