Beispiel #1
0
int main (void) {

  PINSEL10 = 0;                             /* Disable ETM interface */
  FIO2DIR = LEDMSK;                         /* LEDs, port 2, bit 0~7 output only */

  lcd_init();
  lcd_clear();
  lcd_print ("MCB2300 HID Demo");
  set_cursor (0, 1);
  lcd_print ("  www.keil.com  ");

  	Nr = 128;
	Nk = Nr / 32;
	Nr = Nk + 6;
	KeyExpansion(Key, Nk, Nr);

  USB_Init();                               /* USB Initialization */
  USB_Connect(TRUE);                        /* USB Connect */

  while (1);                                /* Loop forever */
}
Beispiel #2
0
void
line_drawing_selected(void)
{
    canvas_kbd_proc = (FCallBack)null_proc;
    canvas_locmove_proc = null_proc;
    canvas_leftbut_proc = (FCallBack)init_line_drawing;
    canvas_middlebut_proc = (FCallBack)init_line_freehand_drawing;
    set_cursor(crosshair_cursor);
    reset_action_on();
    if (cur_mode == F_POLYGON) {
	set_mousefun("first point", "freehand", "", "", "", "");
	min_num_points = 3;
	canvas_rightbut_proc = (FCallBack)null_proc;
    } else {
	set_mousefun("first point", "freehand", "single point", "dimension line", "", "");
	min_num_points = 1;
	num_point = 0;
	fix_x = fix_y = -1;
	canvas_rightbut_proc = (FCallBack)create_lineobject;
    }
}
Beispiel #3
0
// 2 bytes are written: <color> then <character>
void display_character(uint8_t c) {
	uint16_t attr = color << 8; // first byte is color
	uint16_t *loc = video_memory + (80*cursor_y + cursor_x);

	// backspace
	if (c == 0x08 && !(cursor_x==0 && cursor_y==8)) {
		if (cursor_x == 0) {
			cursor_x = 79;
			cursor_y --;
		}
		else
			cursor_x--;
		*(loc-1) = ' ' | attr;
	}
	// tab
	else if (c == 0x09) cursor_x = 8 * ((cursor_x+8)/8);
	// carriage return
	else if (c == '\r') cursor_x = 0;
	// new line
	else if (c == '\n') {
		cursor_x = 0;
		cursor_y++;
	}	
	// other characters
	else if(c >= 32) {
		*loc = c | attr;
		cursor_x++;
	}

	// edge conditions
	if (cursor_x >= 80) { // goto next line
		cursor_x = 0;
		cursor_y++;
	}
	if (cursor_y >= 25) { // scroll screen up
		scroll_screen();
	}

	set_cursor(cursor_x,cursor_y);
}
Beispiel #4
0
void XAbstractGui::toggle_mouse_capture()
{
    XTextProperty titleProperty;
    Display       *dpy;
    const char    *title;
    char          **list;

    dpy = getDisplay();
    cursor_type = (cursor_type == FLX_DEFAULT_CURSOR) ?
                  FLX_INVISIBLE_CURSOR : FLX_DEFAULT_CURSOR;
    title = get_title();
    list  = const_cast<char **>(&title);

    if (XStringListToTextProperty(list, 1, &titleProperty) != 0)
    {
        XSetWMName(dpy, getWindow(FLX_MAIN), &titleProperty);
        XFree(titleProperty.value);
    }

    if (cursor_type == FLX_DEFAULT_CURSOR)
    {
        XUngrabPointer(dpy, CurrentTime);
    }
    else
    {
        unsigned int event_mask;

        event_mask = ButtonPressMask | ButtonReleaseMask |
                     EnterWindowMask | LeaveWindowMask | PointerMotionMask |
                     PointerMotionHintMask | Button1MotionMask |
                     Button2MotionMask | Button3MotionMask |
                     Button4MotionMask | Button5MotionMask |
                     ButtonMotionMask | KeymapStateMask;
        XGrabPointer(dpy, getWindow(), True, event_mask,
                     GrabModeAsync, GrabModeAsync, getWindow(),
                     None, CurrentTime);
    }

    set_cursor(cursor_type);
}
Beispiel #5
0
int main (void) {
  int i;
  

  Init_Timer1( );
  init_serial();                               /* Init UART                   */
  uart_init_0 ( );
  lcd_init();
  lcd_clear();
  lcd_print ("HSM AO Compare");
  set_cursor (0, 1);
  lcd_print ("EventDrivenSystem");

  for (i = 0; i < 10000; i++);       /* Wait for initial display           */
 

  comp_main();

 
 

}
Beispiel #6
0
/**
 * BrewStrengthMenu state handler
 **/
static QState MenuAO_BrewStrengthMenu(MenuAO *me, QEvent const *e)
{
    switch ( e->sig )
    {
    case Q_INIT_SIG:
    {
        return Q_HANDLED();
    }

    case Q_ENTRY_SIG:
    {
        // display brew strength menu (1st row of LCD)
        sprintf(output, "2: Strength %d", 2*me->brewStrength+2);
        lcd_clear();
        set_cursor(0, 0);
        lcd_print((unsigned char*)output);

        return Q_HANDLED();
    }

    case BUTTON_SHORTPRESS_SIG:
    {
        // short press > proceed to next submenu
        return Q_TRAN(&MenuAO_AlarmMenu);
    }

    case BUTTON_LONGPRESS_SIG:
    {
        return Q_TRAN(&MenuAO_ChangeBrewStrength);
    }

    case Q_EXIT_SIG:
    {
        return Q_HANDLED();
    }
    }

    return Q_SUPER(&MenuAO_Idle);
}
Beispiel #7
0
void
List::remove_local(uint32_t position)
{
	vector<ListItem *>::iterator iter;

	assert(position >= 0);
	assert(position < size());

	iter = items.begin() + position;
	assert(iter != items.end());
	assert(*iter);

	(*iter)->set_selected(false);
	delete *iter;
	items.erase(iter);

	if (cursor_position >= size()) {
		set_cursor(size() - 1);
	}

	set_selection_cache_valid(false);
}
Beispiel #8
0
/* --- Kernel entrypoint --- */
int
kernel_main()
{
    /*
     * Tell the kernel memory allocator which memory it can't use.
     * It already knows not to touch kernel image.
     */

    /* Everything above 16M */
    lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, -8 - USER_MEM_START );
    
    /* Everything below 1M */
    lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 );

    if(handler_install() < 0) {
      return 0;
    }

    /*
     * initialize the PIC so that IRQs and
     * exception handlers don't overlap in the IDT.
     */
    pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE );

    clear_console();

    show_cursor();

    set_term_color(FGND_GREEN | BGND_BLACK);

    set_cursor(12, 34);

    putbytes("Hello World!\n", 13);

    while(1) {
    }

    return 0;
}
Beispiel #9
0
/*
 Print a char on the screen at col, row, or at cursor position
*/
void print_char(char nChar, int nCol, int nRow, char nAttribute)
{
	unsigned char * pVidMem = (unsigned char*) VIDEO_ADDRESS;

	if (!nAttribute)
	{
		nAttribute = WHITE_ON_BLACK;
	}

	int offset = 0;
	
//	if (nCol >= 0 && nRow >= 0)
//	{
//		offset = get_screen_offset(nCol, nRow);
//	}	
//	else
//	{
		offset = get_cursor();
//	}


	
	if (nChar == '\n')
	{
		int rows = offset / (2*MAX_COLS);
		offset = get_screen_offset(79, rows);
		offset += 2;
	}
	else
	{
		pVidMem[offset] = nChar;
		pVidMem[offset + 1] = nAttribute;
		offset += 2;		
	}
	
	offset = handle_scrolling(offset);
	
	set_cursor(offset);
}
Beispiel #10
0
/* Print a char on the screen at col , row , or at cursor position */
void print_char(const char character, int col, int row, char attribute_byte)
{
  /* Create a byte ( char ) pointer to the start of video memory */
  unsigned char volatile *vidmem = VIDEO_ADDRESS;
  /* If attribute byte is zero , assume the default style . */
  if (!attribute_byte) {
    attribute_byte = WHITE_ON_BLACK;
  }
  /* Get the video memory offset for the screen location */
  int offset;
  /* If col and row are non - negative , use them for offset . */
  if (col >= 0 && row >= 0) {
    offset = get_screen_offset(col, row);
    /* Otherwise , use the current cursor position . */
  } else {
    offset = get_cursor();
  }
  // If we see a newline character , set offset to the end of
  // current row , so it will be advanced to the first col
  // of the next row.
  if (character == '\n') {
    int rows = offset / (2 * MAX_COLS);
    offset = get_screen_offset(79, rows);
    // Otherwise , write the character and its attribute byte to
    // video memory at our calculated offset .
  } else {
    vidmem[offset] = character;
    vidmem[offset + 1] = attribute_byte;
  }
  // Update the offset to the next character cell , which is
  // two bytes ahead of the current cell .
  offset += 2;
  // Make scrolling adjustment , for when we reach the bottom
  // of the screen .
  offset = handle_scrolling(offset);
  // Update the cursor position on the screen device .
  set_cursor(offset);
}
Beispiel #11
0
int main( int argc, char *argv[] ){
    int x,y;
    int quit = 0;
    init_cursor();
    bClick = 0;
    if( SDL_Init( SDL_INIT_VIDEO ) < 0){
        exit( -1 );
    }

    if( !SDL_SetVideoMode( 320, 200, 0, 0 ) ){
        SDL_Quit();
        exit( -1 );
    }

    time(&last_mouse);
    SDL_EnableUNICODE( 1 );
    set_cursor(x, y);
    while( !quit ){
        check_time();
        while( SDL_PollEvent( &event ) ){
            switch( event.type ){
                case SDL_KEYDOWN:
                    PrintKeyInfo( &event.key );
                    break;
                case SDL_QUIT:
                    quit = 1;
                    break;
                default:
                    checkHold();
                    break;
            }
        }
        sleep(.05);

    }
    SDL_Quit();
    exit( 0 );
}
Beispiel #12
0
/**
 * Initialize the console of a certain tty.
 * 
 * @param tty  Whose console is to be initialized.
 *****************************************************************************/
PUBLIC void init_screen(TTY* tty)
{
	int nr_tty = tty - tty_table;
	CONSOLE * con = console_table + nr_tty;
	con->con_tty = tty;
	tty->tty_devwrite = cons_write;
	tty->tty_echo = out_char;
	kb_init(tty);
	/* 
	 * NOTE:
	 *   variables related to `position' and `size' below are
	 *   in WORDs, but not in BYTEs.
	 */
	int v_mem_size = V_MEM_SIZE >> 1; /* size of Video Memory */
	int size_per_con = v_mem_size / NR_CONSOLES;
	con->orig = nr_tty * size_per_con;
	con->con_size = size_per_con / SCR_WIDTH * SCR_WIDTH;
	con->cursor = con->crtc_start = con->orig;
	con->is_full = 0;

	tty->tty_dev = con;
	if (nr_tty == 0) {
		((CONSOLE *)tty->tty_dev)->cursor = disp_pos / 2;
		disp_pos = 0;
	}
	/*else {*/
		/* 
		 * `?' in this string will be replaced with 0, 1, 2, ...
		 */
	/*	const char prompt[] = "[tty #?]\n";

		const char * p = prompt;
		for (; *p; p++)
			out_char(tty, *p == '?' ? nr_tty + '0' : *p);
	}*/

	set_cursor(((CONSOLE *)tty->tty_dev)->cursor);
}
Beispiel #13
0
void ttext_box::handle_mouse_selection(tpoint mouse, const bool start_selection)
{
	mouse.x -= get_x();
	mouse.y -= get_y();
	// FIXME we don't test for overflow in width
	if(mouse.x < static_cast<int>(text_x_offset_)
	   || mouse.y < static_cast<int>(text_y_offset_)
	   || mouse.y >= static_cast<int>(text_y_offset_ + text_height_)) {
		return;
	}

	int offset = get_column_line(tpoint(mouse.x - text_x_offset_, mouse.y - text_y_offset_)).x;

	if(offset < 0) {
		return;
	}


	set_cursor(offset, !start_selection);
	update_canvas();
	set_is_dirty(true);
	dragging_ |= start_selection;
}
Beispiel #14
0
	/**
	 * @brief   Get the color of a particular pixel.
	 * @note    Optional.
	 * @note    If x,y is off the screen, the result is undefined.
	 *
	 * @param[in] x, y     The start of the text
	 *
	 * @notapi
	 */
	color_t GDISP_LLD(getpixelcolor)(coord_t x, coord_t y) {
		/* This routine is marked "DO NOT USE" in the original
		 *  GLCD driver. We just keep our GDISP_HARDWARE_READPIXEL
		 *  turned off for now.
		 */
		color_t color;

		#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
			if (x < 0 || x >= GDISP.Width || y < 0 || y >= GDISP.Height) return 0;
		#endif

		aquire_bus();
		set_cursor(x, y);
		stream_start();

		color = lld_lcdReadData();
		color = lld_lcdReadData();

		stream_stop();
		release_bus();

		return color;
	}
Beispiel #15
0
void
cancel_place_lib_obj(int x, int y, int shift)
{
    /* if shift right-button, actually do a place in original position */
    if (shift) {
	place_lib_object_orig(x, y, shift);
	return;
    }
    reset_action_on();
    canvas_leftbut_proc = null_proc;
    canvas_middlebut_proc = null_proc;
    canvas_rightbut_proc = null_proc;
    canvas_locmove_proc = null_proc;
    canvas_ref_proc = null_proc;
    canvas_kbd_proc = null_proc;
    clear_mousefun();
    set_mousefun("","","", "", "", "");
    turn_off_current();
    set_cursor(arrow_cursor);
    put_draw(ERASE);
    /* remove it from the depths */
    remove_compound_depth(new_c);
}
Beispiel #16
0
static void
scroll (p_state *state)
{
  int x, y;

  for (x = 0; x < state->grid_width; x++)
    {
      p_cell *from = 0, *to = 0;
      for (y = 1; y < state->grid_height; y++)
        {
          from = &state->cells[state->grid_width * y     + x];
          to   = &state->cells[state->grid_width * (y-1) + x];

          if ((from->state == FLARE || from->state == NORMAL) &&
              !from->p_char->blank_p)
            {
              *to = *from;
              to->state = NORMAL;  /* should be FLARE?  Looks bad... */
            }
          else
            {
              if (to->state == FLARE || to->state == NORMAL)
                to->state = FADE;
            }

          to->changed = True;
        }

      to = from;
      if (to && (to->state == FLARE || to->state == NORMAL))
        {
          to->state = FADE;
          to->changed = True;
        }
    }
  set_cursor (state, True);
}
Beispiel #17
0
int
mail_eq (int argc, char **argv)
{
  msgset_t *list = NULL;
  size_t n;

  switch (argc)
    {
    case 1:
      n = get_cursor ();
      if (n == 0)
        mu_error (_("No applicable message"));
      else
        mu_printf ("%lu\n", (unsigned long) n);
      break;

    case 2:
      if (msgset_parse (argc, argv, MSG_NODELETED, &list) == 0)
	{
	  if (list->msg_part[0] <= total)
	    {
	      set_cursor (list->msg_part[0]);
	      mu_printf ("%lu\n",
				(unsigned long) list->msg_part[0]);
	    }
	  else
	    util_error_range (list->msg_part[0]);
	  msgset_free (list);
	}
      break;

    default:
      return 1;
    }
  
  return 0;
}
Beispiel #18
0
/**
 *******************************************************************************
 * @brief		time_display task		  
 * @param[in] 	pdata	A pointer to parameter passed to task.	 
 * @param[out] 	None  
 * @retval		None
 *		 
 * @details	    This task use to display time in LCD.
 *******************************************************************************
 */
void time_display(void *pdata)
{
	static unsigned char tim[3] = {0,0,0};
	static unsigned char *ptr;

	pdata = pdata;
	for (;;)
	{
		CoWaitForSingleFlag(time_display_flg,0);
		ptr = (unsigned char *)CoPendMail(mbox0,0,&errinfo[30]);

		CoEnterMutexSection(mut_lcd);
		if (tim[0] != *(ptr+0)) 
		{
			tim[0]   = *(ptr+0);
		   	chart[6] = tim[0]/10 + '0';
			chart[7] = tim[0]%10 + '0';			
		}
		if (tim[1] != *(ptr+1)) 
		{
			tim[1] 	 = *(ptr+1);
		   	chart[3] = tim[1]/10 + '0';
			chart[4] = tim[1]%10 + '0';
		}
		if (tim[2] != *(ptr+2)) 
		{
			tim[2] = *(ptr+2);
		   	chart[0] = tim[2]/10 + '0';
			chart[1] = tim[2]%10 + '0';
		}		

		set_cursor(7, 0);
		lcd_print (chart);

		CoLeaveMutexSection(mut_lcd);
	}		
}
Beispiel #19
0
static __inline void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) {
    /* HSA / HEA are 8 bit
     * VSA / VEA are 9 bit
     * use masks 0x00FF and 0x01FF to enforce this
     */

    switch(GDISP.Orientation) {
        case GDISP_ROTATE_0:
            write_reg(0x46, (((x + cx - 1) << 8) & 0xFF00 ) | 
                                      (x & 0x00FF));

            write_reg(0x48, y & 0x01FF);
            write_reg(0x47, (y + cy - 1) & 0x01FF);
            break;
        case GDISP_ROTATE_90:
            write_reg(0x46, (((y + cy - 1) << 8) & 0xFF00) |
                                      (y & 0x00FF));

            write_reg(0x48, x & 0x01FF);
            write_reg(0x47, (x + cx - 1) & 0x01FF);
            break;
        case GDISP_ROTATE_180:
            write_reg(0x46, (((GDISP_SCREEN_WIDTH - x - 1) & 0x00FF) << 8) |
                                      ((GDISP_SCREEN_WIDTH - (x + cx)) & 0x00FF));
            write_reg(0x48, (GDISP_SCREEN_HEIGHT - (y + cy)) & 0x01FF);
            write_reg(0x47, (GDISP_SCREEN_HEIGHT- y - 1) & 0x01FF);
            break;
        case GDISP_ROTATE_270:
            write_reg(0x46, (((GDISP_SCREEN_WIDTH - y - 1) & 0x00FF) << 8) |
                                      ((GDISP_SCREEN_WIDTH - (y + cy)) & 0x00FF));
            write_reg(0x48, (GDISP_SCREEN_HEIGHT - (x + cx)) & 0x01FF);
            write_reg(0x47, (GDISP_SCREEN_HEIGHT - x - 1) & 0x01FF);
            break;
    }   

    set_cursor(x, y);
}
Beispiel #20
0
Datei: tty.c Projekt: RCmerci/xos
static void flush_tty_out_cache(TTY * tty_p)
{
  char c;
  int line;
  while (tty_p->out_count > 0) {
    c = *(tty_p->out_tail_p);
    if (c == '\n') {
      line = tty_p->console_p->cursor / (80 * 2);
      tty_p->console_p->cursor = (line + 1) * (80 * 2);
    } else {
      xdisp_word_at(c|0x0F00, tty_p->console_p->cursor);
      tty_p->console_p->cursor += 2;
    }
    tty_p->out_tail_p ++ ;
    tty_p->out_count -- ;
    if (tty_p->out_tail_p == tty_p->tty_out_cache + TTY_CHAR_CACHE_SIZE)
      tty_p->out_tail_p = tty_p->tty_out_cache;


    if (is_current_console(tty_p->console_p))
      set_cursor(tty_p->console_p->cursor);
    
  }
}
Beispiel #21
0
void
chop_selected(void)
{
    set_mousefun("Select axe object", "Select log object", "Clear axe list", 
			LOC_OBJ, LOC_OBJ, LOC_OBJ);
    draw_mousefun_canvas();
    canvas_kbd_proc = null_proc;
    canvas_locmove_proc = null_proc;
    canvas_ref_proc = null_proc;
    init_searchproc_left(select_axe_object);
    init_searchproc_middle(select_log_object);
    /*    init_searchproc_right(init_chop_right); */	/* fixme don't need this now */
    canvas_leftbut_proc = object_search_left;		/* point search for axe */
    canvas_middlebut_proc = object_search_middle;	/* object search for log */
    canvas_rightbut_proc = clear_axe_objects;
    set_cursor(pick9_cursor);
    /* set the markers to show we only allow POLYLINES, ARCS and ELLIPSES */
    /* (the markers are originally set this way from the mode panel, but
       we need to set them again after the previous chop */   /* fixme -- neede for chop ? */
    update_markers(M_POLYLINE | M_ARC | M_ELLIPSE);
    reset_action_on();

    axe_objects_next = 0;
}
Beispiel #22
0
bool RedScreen::update_pointer_layer()
{
    ASSERT(!_mouse_captured);

    ScreenLayer* now = find_pointer_layer();

    if (now == _pointer_layer) {
        return false;
    }

    if (_pointer_layer) {
        _pointer_layer->on_pointer_leave();
    }

    _pointer_layer = find_pointer_layer();

    if (_pointer_layer) {
        _pointer_layer->on_pointer_enter(_pointer_pos.x, _pointer_pos.y, _mouse_botton_state);
    } else {
        set_cursor(_inactive_cursor);
    }

    return true;
}
Beispiel #23
0
// prefix s32 means simple, 32bit code (in x86 protected mode)
// this version don't specify video address
// for console io
void s32_print_char(u8 ch)
{
    switch (ch)
    {
    case '\r':
        //cur_x = cur_x - (cur_x % 80);
        cur_x = 0;
        text_vb = (u8*)((u32)text_vb - (((u32)text_vb-0xb8000) % 160));
        cur_pos = (((u32)text_vb - 0xb8000)/2);
        s32_print_int(cur_pos, (u8*)(0xb8000+160*1 + 18*2+20), 16);
        break;
    case '\n':
        text_vb+=160;
        cur_pos += 80;
        s32_print_int(cur_pos, (u8*)(0xb8000+160*1 + 18*2+40), 16);
        ++cur_y;
        break;
    case 0x20 ... 0x7e: // ascii printable char. gnu extension: I don't want use gnu extension, but it is very convenience.
        *text_vb = ch;
        *(text_vb+1) = (text_fg|text_bg);
        text_vb+=2;
        ++cur_x;
        ++cur_pos;
        break;
    default:
        break;
    }

    set_cursor(cur_pos);
    s32_print_int(cur_pos, (u8*)(0xb8000+160*1 + 18*2+60), 16);
    clear_line(18);
    s32_print_int(cur_x, (u8*)(0xb8000+160*18 + 23*2+40), 10);
    s32_print_int(cur_y, (u8*)(0xb8000+160*18 + 23*2+60), 10);
    if (cur_y >= 25 )
        set_video_start_addr(80*(cur_y - 24));
}
Beispiel #24
0
PUBLIC void init_screen(TTY* p_tty) {
    int nr_tty = p_tty - tty_table;
    p_tty -> p_console = &console_table[nr_tty];

    int v_mem_size = V_MEM_SIZE >> 1; /* 以双字节计的显存大小 */

    /* 一个字符占两个字节 */
    int con_v_mem_size = v_mem_size / NR_CONSOLE;
    p_tty -> p_console -> original_addr      = nr_tty * con_v_mem_size;
    p_tty -> p_console -> current_start_addr = p_tty -> p_console -> original_addr;
    p_tty -> p_console -> v_mem_limit        = con_v_mem_size;
    p_tty -> p_console -> cursor             = p_tty -> p_console -> original_addr;

    if (nr_tty == 0) {
	/* 保留原来的光标 */
	p_tty -> p_console -> cursor = disp_pos / 2;
	disp_pos = 0;
    } else {
	/* out_char(p_tty -> p_console, nr_tty + '0'); */
	/* out_char(p_tty -> p_console, '#'); */
    }

    set_cursor(p_tty -> p_console -> cursor);
}
Beispiel #25
0
void ds2450_single_demo(void)
{
    unsigned int wert;
    float spg;

    // Bildschirm-Maske
    clear_screen();
    printf("Demo-Betrieb fuer einen DS2450er am Bus\n");
    printf("=======================================\n\n\n");
    printf("  Kanal    Aufl.   Uref / V    MSByte   LSByte   Dig.Wert(dez)    Analog / mV\n");
    printf("\n   A\n");
    printf("\n   B\n");
    printf("\n   C\n");
    printf("\n   D");

    // Endlosschleife
    while(1)
    {
        // Abfrage des DS2450ers: Werte unter ds245_p[.] abgespeichert
        ds2450_convert_all();


        /*********************************/
        /*** Darstellung der Messwerte ***/
        /*********************************/

        // Für Kanal A
        wert = ((ds2450_p[1] * 256) + ds2450_p[0]);
        wert = wert >> (16 - res_A);

        spg = wert * (refspg_A / pot2[res_A]);
        spg = spg * 1000;
    
        set_cursor(6,12);
        printf("%2u      %4.2f        %3u      %3u       %5u           %8.3f",res_A,refspg_A,ds2450_p[1],ds2450_p[0],wert,spg);
        
        // Für Kanal B
        wert = ((ds2450_p[3] * 256) + ds2450_p[2]);
        wert = wert >> (16 - res_B);

        spg = wert * (refspg_B / pot2[res_B]);
        spg = spg * 1000;
    
        set_cursor(8,12);
        printf("%2u      %4.2f        %3u      %3u       %5u           %8.3f",res_B,refspg_B,ds2450_p[3],ds2450_p[2],wert,spg);
        
        // Für Kanal C
        wert = ((ds2450_p[5] * 256) + ds2450_p[4]);
        wert = wert >> (16 - res_C);
    
        spg = wert * (refspg_C / pot2[res_C]);
        spg = spg * 1000;
    
        set_cursor(10,12);
        printf("%2u      %4.2f        %3u      %3u       %5u           %8.3f",res_C,refspg_C,ds2450_p[5],ds2450_p[4],wert,spg);
    
        // Für Kanal D
        wert = ((ds2450_p[7] * 256) + ds2450_p[6]);
        wert = wert >> (16 - res_D);
    
        spg = wert * (refspg_D / pot2[res_D]);
        spg = spg * 1000;
    
        set_cursor(12,12);
        printf("%2u      %4.2f        %3u      %3u       %5u           %8.3f",res_D,refspg_D,ds2450_p[7],ds2450_p[6],wert,spg);

        // Wartezeit zwsichen den Messungen
        _wait_ms(400);

    }       // Ende Endloschleife
}
/*
RING<0><1>
*/
PUBLIC int printChar(int tty_id,t_32 key)
{
	//disable_int();
	char *output="1";
	int a=key&FLAG_EXT;
	
	TTY*p_tty=id2tty(tty_id);
	
	/*if 超出显示范围,则从头开始显示*/
	if(p_tty->cursor_addr>=p_tty->end_addr){
		p_tty->cursor_addr=p_tty->start_addr;
	}
	int ret=-1;
	disp_pos=p_tty->cursor_addr*2;
	if(a==0){
		output[0]=(char)(key&0xff);
		disp_str(output);
		ret=0;
	}else {
		int raw_code=key & MASK_RAW;
		switch(raw_code){
			case ENTER:
				disp_str("\n");
				//set_cursor(disp_pos/2);
				ret=0;
				break;
			case BACKSPACE:
				disp_pos-=2;
				ret=0;
				break;
			case UP:
				if( (key& FLAG_SHIFT_L) || (key& FLAG_SHIFT_R)){
					/*shift+UP*/
				}
				break;
			case DOWN:
				if( (key& FLAG_SHIFT_L) || (key& FLAG_SHIFT_R)){
					/*shift+DOWN*/
				}
				break;
			default:
				break;
		}
	}
//	disp_str(".");
	p_tty->cursor_addr=disp_pos/2;
	if(tty2id(p_tty)==__currentTTY){
		set_cursor(disp_pos/2);
	}
	int current_line=disp_pos/(2*80);
	int start_line=p_tty->display_addr/80;
	int lines=current_line-start_line;
	int diff=lines-24;
	/*如果超出了屏幕显示界限,则将起始显示地址重置为下一行。*/
	if(diff>=1){
		p_tty->display_addr+=diff*80;
		if(p_tty->display_addr+24*80>=p_tty->end_addr){
			p_tty->display_addr=p_tty->start_addr;
			p_tty->cursor_addr =p_tty->start_addr;
		}
		if(tty2id(p_tty)==__currentTTY){
			set_disp_addr(p_tty->display_addr);
		}
	}
	//enable_int();
	return ret;
}
Beispiel #27
0
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
POINT press;
HMENU menu;

	switch (message) {
	case WM_KEYDOWN:
		if (hwnd != mainPtr)
			check_cd_event(hwnd,message,wParam,lParam);
		return 0;
		break;

	case WM_CHAR:
		if (hwnd != mainPtr)
			check_cd_event(hwnd,message,wParam,lParam);
		return 0;
		break;

	case WM_LBUTTONDOWN:
		cursor_stay();
		if (hwnd != mainPtr)
			check_cd_event(hwnd,message,wParam,lParam);
			else {
				SetFocus(hwnd);
				press = MAKEPOINT(lParam);

				All_Done = handle_action(press, wParam,lParam);
				check_game_done();
				}
		return 0;
		break;


	case WM_RBUTTONDOWN:
		cursor_stay();
		if (hwnd != mainPtr)
			check_cd_event(hwnd,message,wParam,lParam);
		return 0;
		break;

	case WM_ACTIVATE:
		if (hwnd == mainPtr) {
			if ((LOWORD(wParam) == WA_ACTIVE) ||(LOWORD(wParam) == WA_CLICKACTIVE)) {
				window_in_front = TRUE;
				 }
			if (LOWORD(wParam) == WA_INACTIVE) {
				window_in_front = FALSE;
				}
			}
		return 0;


	case WM_MOUSEMOVE:
		set_cursor(sword_curs);
      return 0;

	case WM_PAINT:
		BeginPaint(hwnd,&ps);
		EndPaint(hwnd,&ps);
		if (hwnd != mainPtr)
			check_cd_event(hwnd,message,wParam,lParam);
			else redraw_screen();
		return 0;


	case WM_COMMAND:
		if (hwnd == mainPtr) {

			menu = GetMenu(mainPtr);
			handle_menu((short) LOWORD(wParam), menu);
			check_game_done();
			}
			else {
				check_cd_event(hwnd,message,wParam,lParam);
				}
		return 0;


	case WM_DESTROY:
	case WM_CLOSE:
		if (hwnd == mainPtr) {
		lose_graphics();
		PostQuitMessage(0);
			}
		return 0;
	case WM_QUIT:
      if (hwnd == mainPtr){
			lose_graphics();
			PostQuitMessage(0);
			}
		break;
	}

return DefWindowProc(hwnd,message,wParam,lParam);
}
Beispiel #28
0
void ScopePanel::create_objects()
{
	set_cursor(CROSS_CURSOR, 0, 0);
	clear_box(0, 0, get_w(), get_h());
}
void opdracht1() {
	init();
	display_text(1,"feest");
	display_text(2," boef12345678");
	set_cursor(18);
}
Beispiel #30
0
void restore_cursor() {
	set_cursor(Cursor::current);
}