/*
 * led.h
 *
 * $Id$
*/

#ifndef __LED_LED_H_
#define __LED_LED_H_


#include <Arduino.h>
#include <SPI.h>


#define LED_COUNT           10

#define LED_LEDC_BASE		0

#define LED_STATE_MIN		1			// '595 "low" pin
#define LED_STATE_MAX		4			// '595 "high" pin

#define LED_PWM_FREQ		32000       // must be (80MHz > (LED_PWM_FREQ << LED_PWM_BITS))
#define LED_PWM_BITS		11          // real max = 2048
#define LED_PWM_MAX         1000        // max level to be used in programs, must be <= 2^LED_PWM_BITS

#define LED_SR_CLK_PIN		18
#define LED_SR_DAT_PIN		23
#define LED_SR_LAT_PIN		26
#define LED_SR_OE_PIN		5

#define LED_PWM1_PIN		16
#define LED_PWM2_PIN		17
#define LED_PWM3_PIN		19



extern uint16_t led_spaceforce[10];
extern uint16_t led_scaled[10];



void led_init();
void led_set(uint8_t led, uint16_t level);
uint16_t * led_getptr();
void led_tick();

void led_scale();


#endif // __LED_LED_H_
