blackbox/lowlevel.c

Mon, 14 Nov 2011 20:32:30 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Mon, 14 Nov 2011 20:32:30 +0100
changeset 1
91246416e201
parent 0
9b7de464f0ea
child 2
6c59b4293fa9
permissions
-rw-r--r--

added hg ignorefile

#include "stdint.h"
#include "main.h"

void LED(uint8_t num, uint8_t state) {
    switch (num) {
        case 1: switch (state) {
            case 0: LED1_PORT &= ~_BV(LED1); break;
            case 1: LED1_PORT |= _BV(LED1); break;
            case 2: LED1_PORT ^= _BV(LED1); break;
            } break;

        case 2: switch (state) {
            case 0: LED2_PORT &= ~_BV(LED2); break;
            case 1: LED2_PORT |= _BV(LED2); break;
            case 2: LED2_PORT ^= _BV(LED2); break;
            } break;

        case 3: switch (state) {
            case 0: LED3_PORT &= ~_BV(LED3); break;
            case 1: LED3_PORT |= _BV(LED3); break;
            case 2: LED3_PORT ^= _BV(LED3); break;
            } break;

        case 4: switch (state) {
            case 0: LED4_PORT &= ~_BV(LED4); break;
            case 1: LED4_PORT |= _BV(LED4); break;
            case 2: LED4_PORT ^= _BV(LED4); break;
            } break;

        case 5: switch (state) {
            case 0: LED5_PORT &= ~_BV(LED5); break;
            case 1: LED5_PORT |= _BV(LED5); break;
            case 2: LED5_PORT ^= _BV(LED5); break;
            } break;
    }
}

mercurial