]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/lights.h
PWMLED: proof-of-concept brightness setting
[bike-lights.git] / firmware / lights.h
index a3dbb636c61ac88c8d5be2c161963f4825091b6d..25e2233141a152175b8038cde3f4e4879749b58d 100644 (file)
@@ -61,6 +61,14 @@ void susp_tmr();
 void init_pwmled();
 void pwmled_adc(unsigned char n, uint16_t adcval);
 void pwmled_set_mode(unsigned char n, unsigned char mode);
+void pwmled_set_brightness(uint16_t brightness);
+#define PWMLED_BRIGHTNESS(l0_lo, l0_hi, l1, l2_lo, l2_hi) ( \
+          (uint16_t)(l0_lo) \
+       | ((uint16_t)(l0_hi) << 3) \
+       | ((uint16_t)(l1)    << 6) \
+       | ((uint16_t)(l2_lo) << 9) \
+       | ((uint16_t)(l2_hi) << 12) \
+       )
 
 /* gpio.c */
 void init_gpio();