add main documentation

This commit is contained in:
King Kévin 2016-04-04 18:08:13 +02:00
parent 2c0177c24b
commit 56c2a8ce92
1 changed files with 40 additions and 2 deletions

42
main.c
View File

@ -17,8 +17,46 @@
* @date 2016
* @brief show the time on a LED strip
*
* The LED strip consists of 60 WS2812b LEDs.
* The time is read from a DS1307 RTC module.
* @mainpage LED clock
* The LED clock is an add-on for round wall clocks.
* LEDs need to be attached to the border of the clock.
* The micro-controller will then show how much time of the day passed using light.
*
* The time will be shown as arc progress bars, instead of hands pointing at the current time.
* The hours passed since the beginning of the midday are shown using blue LEDs.
* The minutes passed sine the beginning of the hour are shown using green LEDs.
* The (gamma corrected) brightness of the last LED shows how much of the hours or minutes has passed.
* Whichever progress is higher will be shown on top of the other.
* For example if it's 6:45, the first half of the circle will be blue, and an additional quarter will be green.
* The seconds passed since the beginning of the minute are shown using a running red LED, similar to the seconds hand.
* The red color might be added on top of the blue, or green color, then showing as violet or yellow.
*
* The LEDs are controlled using a STM32F1XX micro-controller (based on an ARM Cortex-M3 32-bit processor).
* The board needs to include a 32.678 kHz oscillator for the Real-Time-Clock (RTC).
* Preferably use a <a href="https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#blue_pill">blue pill</a> board.
* The board needs to be powered by an external 5 V power supply (e.g. using the USB port).
* To set the time connect using serial over the USB port (providing the CDC ACM profile) or USART1 port (TX and RX are on pin PA9 and PA10) and enter "time HH:MM:SS".
* Optionally connect a 3 V coin battery on the VBAT pin for the RTC to keep the correct time in case the main power supply gets disconnected.
* To know the charge of the coin cell connect its positive terminal to ADC channel 1 on pin PA1 through a 10 kOhm resistor.
* The voltage of the battery will be shown over serial while the board is booting.
*
* For the LEDs use a 1 meter LED strip with 60 red-green-blue WS2812b LEDs.
* Tape the LED strip along the border/edge of the clock.
* Ideally the wall clock has a diameter of 32 cm for the 1 m LED strip to completely fit.
* Connect the 5 V power rail of the LED strip to the 5 V pin of the board.
* Connect the DIN signal line of the LED strip to the MISO pin of the micro-controller on PA6.
* SPI is used to efficiently shift out the LED color values to the WS2812b LEDs.
* A custom clock is provided for this operation using channel 3 of timer 3 on pin PB0.
* Simply connect this clock to the SPI CLK input on pin PA5.
*
* The brightness of LEDs is dependant on the ambient luminosity.
* To measure the ambient luminosity a 5528 photo-resistor is used.
* Connect one leg of the photo-resistor to ADC channel 0 on pin PA0 and the other to ground.
* Connect one leg of a 1 kOhm resistor to ADC channel 0 on pin PA0 and the other to a 3.3 V pin.
*
* If the board does not provide a 32.678 kHz oscillator for the internal RTC it is also possible to use an external RTC such as the Maxim DS1307.
* The time is then read over I2C and incremented using the square wave output.
* Working example code is under the DS1307_4096Hz_timer tag.
*/
/* standard libraries */