Commit 63832036 authored by Alexander Detsch's avatar Alexander Detsch

added mapping for shiftregister output

parent 318aeaab
Partlist
Exported from Binaeruhr.sch at 11.12.2017 10:14:58
EAGLE Version 6.5.0 Copyright (c) 1988-2013 CadSoft
Assembly variant:
Part Value Device Package Library Sheet
C1 100 CPOL-EUE2-5 E2-5 rcl 1
C2 100 CPOL-EUE2-5 E2-5 rcl 1
C3 100n C-EUC0805 C0805 rcl 1
C4 100n C-EUC0805 C0805 rcl 1
C5 100n C-EUC0805 C0805 rcl 1
C6 100n C-EUC0805 C0805 rcl 1
C7 100n C-EUC0805 C0805 rcl 1
C8 100n C-EUC0805 C0805 rcl 1
IC1 MEGA328-AU MEGA48/88/168-AU TQFP32-08 avr-7 1
IC2 74HC595D 74HC595D SO16 74xx-eu 1
IC3 74HC595D 74HC595D SO16 74xx-eu 1
IC4 74HC595D 74HC595D SO16 74xx-eu 1
IC5 DS1307 DS1307 SOIC-8 dallas 1
JP1 Serial PINHD-1X6/90 1X06/90 pinhead 1
LED1 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED2 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED3 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED4 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED5 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED6 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED7 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED8 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED9 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED10 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED11 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED12 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED13 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED14 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED15 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED16 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED17 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED18 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED19 LEDCHIP-LED0805 CHIP-LED0805 led 1
LED20 LEDCHIP-LED0805 CHIP-LED0805 led 1
Q2 32.768kHz CRYSTALTC38H TC38H crystal 1
R1 220R R-EU_R0805 R0805 rcl 1
R2 220R R-EU_R0805 R0805 rcl 1
R3 220R R-EU_R0805 R0805 rcl 1
R4 220R R-EU_R0805 R0805 rcl 1
R5 220R R-EU_R0805 R0805 rcl 1
R6 220R R-EU_R0805 R0805 rcl 1
R7 10k R-EU_R0805 R0805 rcl 1
R8 220R R-EU_R0805 R0805 rcl 1
R9 220R R-EU_R0805 R0805 rcl 1
R10 220R R-EU_R0805 R0805 rcl 1
R11 220R R-EU_R0805 R0805 rcl 1
R12 220R R-EU_R0805 R0805 rcl 1
R13 220R R-EU_R0805 R0805 rcl 1
R14 220R R-EU_R0805 R0805 rcl 1
R15 220R R-EU_R0805 R0805 rcl 1
R17 220R R-EU_R0805 R0805 rcl 1
R18 220R R-EU_R0805 R0805 rcl 1
R19 220R R-EU_R0805 R0805 rcl 1
R20 220R R-EU_R0805 R0805 rcl 1
R21 220R R-EU_R0805 R0805 rcl 1
R22 220R R-EU_R0805 R0805 rcl 1
R24 10k R-EU_R0805 R0805 rcl 1
R25 10k R-EU_R0805 R0805 rcl 1
R26 10k R-EU_R0805 R0805 rcl 1
SV1 ISP ML6 ML6 con-harting-ml 1
U$1 MICRO-USB MICRO-USB MICRO-USB Micro-USB-Buchse 1
U$4 3V Knopfzelle KNOPF-SMD KNOPF-SMD knopfzellenhalter 1
......@@ -19,9 +19,47 @@ void Clock::update() {
}
void Clock::shiftTime(uint8_t hour, uint8_t minute, uint8_t second) {
shiftr.shift(hour);
shiftr.shift(minute);
shiftr.shift(second, true);
shiftr.shift(getBitmapFromNumber(hour));
shiftr.shift(getBitmapFromNumber(minute));
shiftr.shift(getBitmapFromNumber(second), true);
}
uint8_t Clock::getUnitBitmap(uint8_t number) {
uint8_t numberTemp = number % 10; // get the last digit of the number
switch (numberTemp) {
case 0: return 0x00;
case 1: return 0x08;
case 2: return 0x04;
case 3: return 0x0C;
case 4: return 0x02;
case 5: return 0x0A;
case 6: return 0x06;
case 7: return 0x0E;
case 8: return 0x01;
case 9: return 0x09;
default: return 0x00; // we failed. Turn all lights off.
}
}
uint8_t Clock::getTensBitmap(uint8_t number) {
uint8_t numberTemp = (number / 10) % 10; // get the second digit of the number
switch (numberTemp) {
case 0: return 0x00;
case 1: return 0x10;
case 2: return 0x20;
case 3: return 0x30;
case 4: return 0x40;
case 5: return 0x50;
default: return 0x00; // we failed. Turn all lights off.
}
}
uint8_t Clock::getBitmapFromNumber(uint8_t number) {
return getTensBitmap(number) | getUnitBitmap(number);
}
void Clock::setTime(uint8_t day, uint8_t month, uint8_t year, uint8_t hour, uint8_t minute, uint8_t second) {
......
......@@ -32,6 +32,9 @@ private:
Clock( const Clock &c );
Clock& operator=( const Clock &c );
void shiftTime(uint8_t hour, uint8_t minute, uint8_t second);
uint8_t getUnitBitmap(uint8_t number);
uint8_t getTensBitmap(uint8_t number);
uint8_t getBitmapFromNumber(uint8_t number);
}; //Clock
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment