vis.c
Go to the documentation of this file.
1 
6 /*
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.0 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS"
13  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
14  * License for the specific language governing rights and limitations
15  * under the License.
16  *
17  * The Original Code is legOS code, released October 17, 1999.
18  *
19  * The Initial Developer of the Original Code is Markus L. Noga.
20  * Portions created by Markus L. Noga are Copyright (C) 1999
21  * Markus L. Noga. All Rights Reserved.
22  *
23  * Contributor(s): Markus L. Noga <markus@noga.de>
24  */
25 
26 #include <sys/vis.h>
27 
28 #ifdef CONF_VIS
29 
30 #include <conio.h>
31 #include <sys/irq.h>
32 #include <dsensor.h>
33 #include <dmotor.h>
34 #include <sys/program.h>
35 #include <sys/tm.h>
36 
38 //
39 // Variables
40 //
42 
43 unsigned char vis_refresh_counter = 0;
44 unsigned char vis_refresh_period = 50;
45 
47 //
48 // Functions
49 //
51 
52 #ifdef CONF_RCX_COMPILER
53 void vis_handler(void) {
54 #else
55 HANDLER_WRAPPER("vis_handler","vis_core");
56 void vis_core(void) {
57 #endif
58 #ifdef CONF_DSENSOR
59  bit_iload(AD_C_H,0x7);
61 
62  bit_iload(AD_B_H,0x7);
64 
65  bit_iload(AD_A_H,0x7);
67 #endif
68 
69 #ifdef CONF_PROGRAM
70  if(nb_tasks <= nb_system_tasks) { // show only while program not running.
71  if(program_valid(cprog))
72  cputc_hex_0(cprog+1);
73  else
74  cputc_0('-');
75  }
76 #endif
77 }
78 
79 #endif // CONF_VIS
int program_valid(unsigned nr)
check if a given program is valid.
volatile unsigned char AD_C_H
A/D converter data register C high.
Interface: console input / output.
volatile unsigned int nb_tasks
number of tasks
#define bit_iload(mask, bit)
load the inverse of a single bit from a mask to the carry flag
Definition: bitops.h:77
#define LCD_S2_ACTIVE
Definition: dlcd.h:129
volatile unsigned cprog
the current program
volatile unsigned int nb_system_tasks
void cputc_0(unsigned c)
write ASCII char to position 0 of LCD
Definition: conio.h:174
#define dlcd_store(a)
store the carry flag to a segment directly in the LCD buffer
Definition: dlcd.h:187
Internal Interface: program data structures and functions.
Internal Interface: task management.
#define LCD_S3_ACTIVE
Definition: dlcd.h:132
HANDLER_WRAPPER("lcd_refresh_next_byte","lcd_refresh_next_byte_core")
lcd refresh handler, called from system timer interrupt
volatile unsigned char AD_B_H
A/D converter data register B high.
#define LCD_S1_ACTIVE
Definition: dlcd.h:126
void vis_handler(void)
visualize sensor/motor state and selected program.
Internal LNP Interface: RCX redirected IRQ vectors.
volatile unsigned char AD_A_H
A/D converter data register A high.
void cputc_hex_0(unsigned nibble)
write HEX digit to position 0 of LCD
Definition: conio.h:128
Internal Interface: visualization of BrickOS state.

brickOS is released under the Mozilla Public License.
Original code copyright 1998-2005 by the authors.

Generated for brickOS Kernel Developer by doxygen 1.8.11