2 * leds.c -- control the led's on a Motorola mc68ec0x0 board.
4 * Copyright (c) 1995 Cygnus Support
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
19 * led_putnum -- print a hex number on the LED. the value of num must be a char with
20 * the ascii value. ie... number 0 is '0', a is 'a', ' ' (null) clears
22 * Setting the bit to 0 turns it on, 1 turns it off.
23 * the LED's are controlled by setting the right bit mask in the base
26 * [d.p | g | f | e | d | c | b | a ] is the byte.
38 * d . d.p (decimal point)
44 static unsigned char *leds
= (unsigned char *)LED_ADDR
;
45 static unsigned char num_bits
[18] = {
47 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, /* numbers 0-9 */
48 0x98, 0x20, 0x3, 0x27, 0x21, 0x4, 0xe /* letters a-f */
51 if (num
>= '0' && num
<= '9')
52 num
= (num
- '0') + 1;
54 if (num
>= 'a' && num
<= 'f')
55 num
= (num
- 'a') + 12;
60 *leds
= num_bits
[num
];
64 * zylons -- draw a rotating pattern. NOTE: this function never returns.
69 unsigned char *leds
= (unsigned char *)LED_ADDR
;
70 unsigned char curled
= 0xfe;
75 curled
= (curled
>> 1) | (curled
<< 7);