1
0
Fork 0
mirror of https://codeberg.org/SiB64/blinkenlights.git synced 2026-06-30 16:29:50 +02:00

Compare commits

..

No commits in common. "51915670ebfc96b6c881076640de032af71aa8eb" and "52c70b7304aca3df3ad0c47fb61324e2e4ec327e" have entirely different histories.

3 changed files with 6 additions and 44 deletions

View file

@ -74,7 +74,7 @@ lfuse_blink = 0x7a
# [6]: EESAVE = 0 ! (EEPROM not preserved @ chip erase) # [6]: EESAVE = 0 ! (EEPROM not preserved @ chip erase)
# [5]: WDTON = 0 ! (watchdog disabled) # [5]: WDTON = 0 ! (watchdog disabled)
lfuse_kennung = 0x3a lfuse_kennung = 0x1a
lfuse_bate = 0x1a lfuse_bate = 0x1a
pMCU-attiny13a = t13 pMCU-attiny13a = t13

View file

@ -124,11 +124,13 @@ static struct kennung EEMEM eeprom;
static uint8_t phase; static uint8_t phase;
static inline ISR(PCINT0_vect)
void shift_phase()
{ {
static uint8_t position, index; static uint8_t position, index;
if (!GetPORT(OUT_PORT))
return;
if (++position >= kennung.length) { if (++position >= kennung.length) {
position = 0; position = 0;
index = 0; index = 0;
@ -140,21 +142,6 @@ void shift_phase()
phase >>= 1; phase >>= 1;
} }
ISR(PCINT0_vect)
{
if (!GetPORT(OUT_PORT))
return;
shift_phase();
}
#ifdef WDT_TRIGGERED
ISR(WDT_vect)
{
wdt_reset();
shift_phase();
}
#endif
static inline static inline
void init_trig() void init_trig()
{ {
@ -270,20 +257,6 @@ void uart()
c |= 0x80; c |= 0x80;
} }
static inline
void init_wdt(uint8_t wdt_period)
{
#ifdef WDT_TRIGGERED
uint8_t cr = Bit(WDTIE) | (wdt_period&7) << WDP0 | (wdt_period&8) << (WDP3-3);
__asm__("STS %[CSR], %[CE]" "\n\t"
"STS %[CSR], %[WE]" "\n"
::[CSR] "n" (&WDTCR),
[CE] "r" (Bit(WDCE) | Bit(WDTIE)),
[WE] "r" (cr)
);
#endif
}
int main() int main()
{ {
eeprom_read_block(&kennung, &eeprom, sizeof(kennung)); eeprom_read_block(&kennung, &eeprom, sizeof(kennung));
@ -292,16 +265,14 @@ int main()
init_timer(); init_timer();
init_trig(); init_trig();
init_wdt(5);
send('x'); send('x');
set_sleep_mode(SLEEP_MODE_IDLE); set_sleep_mode(SLEEP_MODE_IDLE);
while (1) { while (1) {
sei(); sei();
sleep_mode(); sleep_mode();
#ifndef WDT_TRIGGERED
wdt_reset(); wdt_reset();
#endif
if (!tick) if (!tick)
continue; continue;
tick = 0; tick = 0;

View file

@ -1,9 +0,0 @@
#! /bin/bash -v
echo 17 > /sys/class/gpio/export || exit 1
sleep 1
echo out > /sys/class/gpio/gpio17/direction || exit 2
echo 0 > /sys/class/gpio/gpio17/value
sleep 1
echo 1 > /sys/class/gpio/gpio17/value
echo 17 > /sys/class/gpio/unexport