From 2c997f95cb167e9023c1a44abaeda4ea80bbc7d3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 8 Aug 2013 22:39:50 +0000 Subject: moved usb-i2c-sl018 to tuer-rfid git-svn-id: https://svn.spreadspace.org/avr/trunk@216 aa12f405-d877-488e-9caf-2d797e2a1cc7 --- usb-i2c-sl018/ledmatrix.c | 218 ---------------------------------------------- 1 file changed, 218 deletions(-) delete mode 100644 usb-i2c-sl018/ledmatrix.c (limited to 'usb-i2c-sl018/ledmatrix.c') diff --git a/usb-i2c-sl018/ledmatrix.c b/usb-i2c-sl018/ledmatrix.c deleted file mode 100644 index c319b6d..0000000 --- a/usb-i2c-sl018/ledmatrix.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * spreadspace avr utils - * - * - * Copyright (C) 2013 Christian Pointner - * Othmar Gsenger - * - * This file is part of spreadspace avr utils. - * - * spreadspace avr utils is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * spreadspace avr utils is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with spreadspace avr utils. If not, see . - */ - -#include -#include - -#include "ledmatrix.h" - -#define LEDMATRIX_PORT PORTB -#define LEDMATRIX_DDR DDRB -#define LEDMATRIX_RED 6 -#define LEDMATRIX_GREEN 7 -#define LEDMATRIX_NUM_LEDS 6 -#define LEDMATRIX_MASK 0x3F -#define BLINK_DELAY 3 - -ledmatrix_mode_t mode = off; -uint8_t moving_cnt = 0; -uint8_t wait_cnt = 0; - -void ledmatrix_start_timer(void) -{ - TCCR3A = 0; // prescaler 1:1024, WGM = 4 (CTC) - TCCR3B = 1< ~100 ms @ 16 MHz - TCNT3 = 0; - TIMSK3 = 1<= LEDMATRIX_NUM_LEDS) - moving_cnt = 0; - LEDMATRIX_PORT = (1<= BLINK_DELAY) { - LEDMATRIX_PORT ^= 1<= LEDMATRIX_NUM_LEDS) - moving_cnt = 0; - LEDMATRIX_PORT = (1<= BLINK_DELAY) { - LEDMATRIX_PORT ^= 1<= 2*LEDMATRIX_NUM_LEDS) - moving_cnt = 0; - - if(moving_cnt >= LEDMATRIX_NUM_LEDS) { - uint8_t offset = moving_cnt - LEDMATRIX_NUM_LEDS; - LEDMATRIX_PORT = (1<= BLINK_DELAY) { - LEDMATRIX_PORT ^= ~(LEDMATRIX_MASK); - wait_cnt = 0; - } -} - - -void ledmatrix_init(void) -{ - LEDMATRIX_DDR = 0xFF; - LEDMATRIX_PORT = 0xFF; -} - -void ledmatrix_set(ledmatrix_mode_t m) -{ - if(m == mode) - return; - - mode = m; - ledmatrix_stop_timer(); - switch(mode) - { - case off: ledmatrix_off_init(); break; - case red: ledmatrix_red_init(); break; - case red_moving: ledmatrix_red_moving_init(); break; - case red_blink: ledmatrix_red_blink_init(); break; - case green: ledmatrix_green_init(); break; - case green_moving: ledmatrix_green_moving_init(); break; - case green_blink: ledmatrix_green_blink_init(); break; - case rg_moving: ledmatrix_rg_moving_init(); break; - case rg_blink: ledmatrix_rg_blink_init(); break; - } -} - -ISR(TIMER3_COMPA_vect) -{ - switch(mode) - { - case red_moving: ledmatrix_red_moving_handle(); break; - case red_blink: ledmatrix_red_blink_handle(); break; - case green_moving: ledmatrix_green_moving_handle(); break; - case green_blink: ledmatrix_green_blink_handle(); break; - case rg_moving: ledmatrix_rg_moving_handle(); break; - case rg_blink: ledmatrix_rg_blink_handle(); break; - default: break; - } -} -- cgit v1.2.3