Last change
on this file since 548 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.6 KB
|
Rev | Line | |
---|
[444] | 1 | /* op50nled.c -- fucntions that manipulate the LEDs. |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 1995 Cygnus Support |
---|
| 4 | * |
---|
| 5 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 6 | * and license this software and its documentation for any purpose, provided |
---|
| 7 | * that existing copyright notices are retained in all copies and that this |
---|
| 8 | * notice is included verbatim in any distributions. No written agreement, |
---|
| 9 | * license, or royalty fee is required for any of the authorized uses. |
---|
| 10 | * Modifications to this software may be copyrighted by their authors |
---|
| 11 | * and need not follow the licensing terms described here, provided that |
---|
| 12 | * the new terms are clearly indicated on the first page of each file where |
---|
| 13 | * they apply. |
---|
| 14 | */ |
---|
| 15 | #include "op50n.h" |
---|
| 16 | |
---|
| 17 | void zylons(); |
---|
| 18 | void strobe(); |
---|
| 19 | void led_putnum(); |
---|
| 20 | void delay(); |
---|
| 21 | |
---|
| 22 | /* |
---|
| 23 | * led_putnum -- print a hex number on the LED. the value of num must be a byte. |
---|
| 24 | * The max number 15, since the front panel only has 4 LEDs. |
---|
| 25 | */ |
---|
| 26 | void |
---|
| 27 | led_putnum ( num ) |
---|
| 28 | char num; |
---|
| 29 | { |
---|
| 30 | static unsigned char *leds = (unsigned char *)LED_ADDR; |
---|
| 31 | |
---|
| 32 | /** *leds = (num << 4); **/ |
---|
| 33 | *leds = num; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | /* |
---|
| 37 | * strobe -- do a zylons thing, toggling each led in sequence forever... |
---|
| 38 | */ |
---|
| 39 | void |
---|
| 40 | zylons() |
---|
| 41 | { |
---|
| 42 | while (1) { |
---|
| 43 | strobe(); |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | /* |
---|
| 48 | * strobe -- toggle each led in sequence up and back once. |
---|
| 49 | */ |
---|
| 50 | void |
---|
| 51 | strobe() |
---|
| 52 | { |
---|
| 53 | static unsigned char curled; |
---|
| 54 | static unsigned char dir; |
---|
| 55 | |
---|
| 56 | curled = 1; |
---|
| 57 | dir = 0; |
---|
| 58 | while (curled != 0) { |
---|
| 59 | led_putnum (curled); |
---|
| 60 | delay (70000); |
---|
| 61 | if (dir) |
---|
| 62 | curled >>= 1; |
---|
| 63 | else |
---|
| 64 | curled <<= 1; |
---|
| 65 | |
---|
| 66 | if (curled == 0x100) { |
---|
| 67 | dir = ~dir; |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | curled = 1; |
---|
| 71 | dir = 0; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | void |
---|
| 75 | delay (x) |
---|
| 76 | int x; |
---|
| 77 | { |
---|
| 78 | int y = 17; |
---|
| 79 | while (x-- !=0) |
---|
| 80 | y = y^2; |
---|
| 81 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.