• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ con_printf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中con_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ con_printf函数的具体用法?C++ con_printf怎么用?C++ con_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了con_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv) {

    struct import * hDll;
    int a,b,c,d;

    if((hDll = (struct import *)_ksys_cofflib_load(dllname)) == 0) {
        debug_out_str("can't load lib\n");
        return 1;
    }
    link(hDll, imports);
    debug_out_str("dll loaded\n");

    if(dll_start(1) == 0) {
        debug_out_str("dll_start failed\n");
        return 1;
    }

    con_init(-1, -1, -1, -1, caption);

    for(i = 0; i < 256; i++) {
        con_printf("Color 0x%02X: ", i);
        con_write_asciiz("Text sample.");

        con_printf("  printf %s test %d\n", "small", i);

    }

    con_exit(0);
    debug_out_str("all right's ;)\n");
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:30,代码来源:console.c


示例2: mem_check_integrity

int mem_check_integrity( int block_number )
{
	int i, ErrorCount;
	ubyte * CheckData;

	CheckData = (ubyte *)((char *)MallocBase[block_number] + MallocSize[block_number]);

	ErrorCount = 0;
			
	for (i=0; i<CHECKSIZE; i++ )
		if (CheckData[i] != CHECKBYTE ) {
			ErrorCount++;
			con_printf(CON_CRITICAL, "OA: %p ", &CheckData[i] );
		}

	if (ErrorCount &&  (!out_of_memory))	{
		con_printf(CON_CRITICAL, "\nMEM_OVERWRITE: Memory after the end of allocated block overwritten.\n" );
		PrintInfo( block_number );
		con_printf(CON_CRITICAL, "\t%d/%d check bytes were overwritten.\n", ErrorCount, CHECKSIZE );
		Int3();
	}

	return ErrorCount;

}
开发者ID:jihnsius,项目名称:d2r,代码行数:25,代码来源:mem.c


示例3: cmd_recdemo

void cmd_recdemo(){
    // Begins recording a demo.
    int m;

    // Check if we're allready recording/playing.
    if(player_connected!=1||map_type!=MAP_IWAD){
        con_printf("not connected to an iwad map");
        return;
    }
    if(player_recording!=0){
        con_printf("demo buffers in use");
        return;
    }
    if(internal_setdemoname(parse_words[1])==0){
        // Initiate the demo.
        m=sizeof(DEMO_CELL)*10000;
        bufdemo=(DEMO_CELL *)malloc(m);
        demo_count=0;
        demo_header.ver=DJDOOM_VER;
        strcpy(demo_header.mapname,mapname);

        // Display recording statistics.
        sprintf(saybuf,"version %d demo (%s)",demo_header.ver,demo_header.mapname);
        con_printf(saybuf);
        player_recording=1;
    }
    else{
        con_printf("bad demo name");
    }
}
开发者ID:amcgregor,项目名称:raven,代码行数:30,代码来源:cmds.c


示例4: digi_mixer_init

/* Initialise audio */
int digi_mixer_init() {
  digi_sample_rate = SAMPLE_RATE_44K;

  if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_init %d (SDL_Mixer)\n", MAX_SOUNDS);
  if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) Error("SDL audio initialisation failed: %s.", SDL_GetError());

  if (Mix_OpenAudio(digi_sample_rate, MIX_OUTPUT_FORMAT, MIX_OUTPUT_CHANNELS, SOUND_BUFFER_SIZE)) {
    //edited on 10/05/98 by Matt Mueller - should keep running, just with no sound.
    con_printf(CON_URGENT,"\nError: Couldn't open audio: %s\n", SDL_GetError());
    GameArg.SndNoSound = 1;
    return 1;
  }

  Mix_AllocateChannels(digi_max_channels);
  Mix_Pause(0);

  // Attempt to load jukebox
  jukebox_load();
  //jukebox_list();

  digi_initialised = 1;

  oplmus_init();

  return 0;
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:27,代码来源:digi_mixer.c


示例5: IPXOpenSocket

static int IPXOpenSocket(socket_t *sk, int port)
{
    int sock;			/* sock here means Linux socket handle */
    int opt;
    struct sockaddr_ipx ipxs;
    socklen_t len;
    struct sockaddr_ipx ipxs2;

    /* do a socket call, then bind to this port */
    sock = socket(AF_IPX, SOCK_DGRAM, PF_IPX);
    if (sock == -1) {
        con_printf(CON_URGENT,"IPX: could not open IPX socket.\n");
        return -1;
    }

    opt = 1;
    /* Permit broadcast output */
    if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt)) == -1)
    {
        con_printf(CON_URGENT,"IPX: could not set socket option for broadcast.\n");
        return -1;
    }

    ipxs.sipx_family = AF_IPX;
    ipxs.sipx_network = *((unsigned int *)&MyAddress[0]);
    /*  ipxs.sipx_network = htonl(MyNetwork); */
    bzero(ipxs.sipx_node, 6);	/* Please fill in my node name */
    ipxs.sipx_port = htons(port);

    /* now bind to this port */
    if (bind(sock, (struct sockaddr *) &ipxs, sizeof(ipxs)) == -1)
    {
        con_printf(CON_URGENT,"IPX: could not bind socket to address\n");
        close( sock );
        return -1;
    }

    if( port==0 )
    {
        len = sizeof(ipxs2);
        if (getsockname(sock,(struct sockaddr *)&ipxs2,&len) < 0)
        {
            con_printf(CON_URGENT,"IPX: could not get socket name in IPXOpenSocket\n");
            close( sock );
            return -1;
        }
        else
        {
            port = htons(ipxs2.sipx_port);
            con_printf(CON_URGENT,"IPX: opened dynamic socket %04x\n", port);
        }
    }

    sk->fd = sock;
    sk->socket = port;

    IPXGetMyAddress();

    return 0;
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:60,代码来源:netdrv_ipx.c


示例6: clcmd_help

static void clcmd_help(int s, char *arg)
{
	unsigned int i;
	con_printf("Command List:\n");
	for(i = 0; i < sizeof(command)/sizeof(*command); i++)
		con_printf(" %s: %s\n", command[i].name, command[i].help);
}
开发者ID:giannitedesco,项目名称:blackbloc,代码行数:7,代码来源:cl_cmd.c


示例7: RBAInit

void RBAInit()
{
	int num_cds;
	int i,j;
	
	if (initialised) return;

	if (SDL_Init(SDL_INIT_CDROM) < 0)
	{
		Warning("SDL library initialisation failed: %s.",SDL_GetError());
		return;
	}

	num_cds = SDL_CDNumDrives();
	if (num_cds < 1)
	{
		con_printf(CON_NORMAL, "No cdrom drives found!\n");
#if defined(__APPLE__) || defined(macintosh)
		SDL_QuitSubSystem(SDL_INIT_CDROM);	// necessary for rescanning CDROMs
#endif
		return;
	}
	
	for (i = 0; i < num_cds; i++)
	{
		if (s_cd)
			SDL_CDClose(s_cd);
		s_cd = SDL_CDOpen(i);
		
		if (s_cd && CD_INDRIVE(SDL_CDStatus(s_cd)))
		{
			for (j = 0; j < s_cd->numtracks; j++)
			{
				if (s_cd->track[j].type == SDL_AUDIO_TRACK)
					break;
			}
			
			if (j != s_cd->numtracks)
				break;	// we've found an audio CD
		}
		else if (s_cd == NULL)
			Warning("Could not open cdrom %i for redbook audio:%s\n", i, SDL_GetError());
	}
	
	if (i == num_cds)
	{
		con_printf(CON_NORMAL, "No audio CDs found\n");
		if (s_cd)	// if there's no audio CD, say that there's no redbook and hence play MIDI instead
		{
			SDL_CDClose(s_cd);
			s_cd = NULL;
		}
#if defined(__APPLE__) || defined(macintosh)
		SDL_QuitSubSystem(SDL_INIT_CDROM);	// necessary for rescanning CDROMs
#endif
		return;
	}
	
	initialised = 1;
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:60,代码来源:rbaudio.cpp


示例8: pthread_setcanceltype

void *mixer_thread(void *data) {
 int err;
 ubyte buffer[SOUND_BUFFER_SIZE];

 /* Allow ourselves to be asynchronously cancelled */
 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
 while (1) {

   memset(buffer, 0x80, SOUND_BUFFER_SIZE);
   LOCK();
   audio_mixcallback(NULL,buffer,SOUND_BUFFER_SIZE);
   UNLOCK();
again:
   err = snd_pcm_writei(snd_devhandle, buffer, SOUND_BUFFER_SIZE/2);

   if (err == -EPIPE) {
        // Sound buffer underrun
        err = snd_pcm_prepare(snd_devhandle);
        if (err < 0) {
            con_printf(CON_CRITICAL, "Can't recover from underrun: %s\n",
                    snd_strerror(err));
        }
   } else if (err == -EAGAIN) {
        goto again;
   } else if (err != SOUND_BUFFER_SIZE/2) {
        // Each frame has size 2 bytes - hence we expect SOUND_BUFFER_SIZE/2
        // frames to be written.
        con_printf(CON_CRITICAL, "Unknown err %d: %s\n", err, snd_strerror(err));
   }
 } 
 return 0;
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:32,代码来源:alsadigi.c


示例9: mixdigi_convert_sound

/*
 * Play-time conversion. Performs output conversion only once per sound effect used.
 * Once the sound sample has been converted, it is cached in SoundChunks[]
 */
void mixdigi_convert_sound(int i) {

  SDL_AudioCVT cvt;
  Uint8 *data = GameSounds[i].data;
  Uint32 dlen = GameSounds[i].length;
  int freq = GameSounds[i].freq;
  //int bits = GameSounds[i].bits;

  if (SoundChunks[i].abuf) return; //proceed only if not converted yet

  if (data) {
    if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"converting %d (%d)\n", i, dlen);
    SDL_BuildAudioCVT(&cvt, AUDIO_U8, 1, freq, MIX_OUTPUT_FORMAT, MIX_OUTPUT_CHANNELS, digi_sample_rate);

    cvt.buf = malloc(dlen * cvt.len_mult);
    cvt.len = dlen;
    memcpy(cvt.buf, data, dlen);
    if (SDL_ConvertAudio(&cvt)) con_printf(CON_DEBUG,"conversion of %d failed\n", i);

    SoundChunks[i].abuf = cvt.buf;
    SoundChunks[i].alen = dlen * cvt.len_mult;
    SoundChunks[i].allocated = 1;
    SoundChunks[i].volume = 128; // Max volume = 128
  }
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:29,代码来源:digi_mixer.c


示例10: RBASetVolume

void RBASetVolume(int volume)
{
#ifdef __linux__
	int cdfile, level;
	struct cdrom_volctrl volctrl;

	if (!s_cd) return;

	cdfile = s_cd->id;
	level = volume*REDBOOK_VOLUME_SCALE/8;

	if ((level<0) || (level>REDBOOK_VOLUME_SCALE)) {
		con_printf(CON_CRITICAL, "illegal volume value (allowed values 0-%i)\n",REDBOOK_VOLUME_SCALE);
		return;
	}

	volctrl.channel0
		= volctrl.channel1
		= volctrl.channel2
		= volctrl.channel3
		= level;
	if ( ioctl(cdfile, CDROMVOLCTRL, &volctrl) == -1 ) {
		con_printf(CON_CRITICAL, "CDROMVOLCTRL ioctl failed\n");
		return;
	}
#else
	volume;
#endif
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:29,代码来源:rbaudio.cpp


示例11: clipboard_set_text

/**
 * Copy @p text to the clipboard
 *
 * @param[in]       text        Text to copy to the clipboard
 *
 * @retval          true        On success
 * @retval          false       If any of the Windows clipboard functions failed
 */
bool clipboard_set_text(char *text)
{
    bool retval;
    HGLOBAL hdst;
    char *dst;

    DWORD dst_sz = strlen(text) + sizeof('\0');

    /* Allocate and copy the string to the global memory */
    hdst = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dst_sz);
    dst = (char *)GlobalLock(hdst);
    util_strlcpy(dst, text, dst_sz);
    GlobalUnlock(hdst);

    /* Set clipboard data */
    retval = OpenClipboard(NULL);
    if (!retval)
    {
        con_printf("Error opening clipboard\n");
        return false;
    }

    EmptyClipboard();

    retval = SetClipboardData(CF_TEXT, hdst);
    if (!retval)
    {
        con_printf("Error pasting to clipboard\n");
        return false;
    }

    CloseClipboard();
    return true;
}
开发者ID:CeeJay79,项目名称:apme,代码行数:42,代码来源:util.c


示例12: drp_debug3

void drp_debug3(void){
    int value=0, res=0;
    unsigned int index;
    unsigned long block;

    con_printf("(Destructive) Testing -256block r/w- memSD\r\n");
    for(block=0; block<1024; block=block+256){
        printf("testing 256Block = %lu\n", block);

        value=20000;
        for(index=0; index<=0xFFFF; index++, value++){

            con_printf("writing: ");
            msd_setVar_256BlockExtMem( block, index, value);
            printf("value[%u] = %d    |    ", index, value);

            printf("reading: ");
            msd_getVar_256BlockExtMem( block, index, &res);
            printf("value[%u] = %d    |    ", index, res);

            printf("comparing: ");
            if( value==res ){ printf("ok\n"); }
            else{ con_printf("fail\n"); return; }

            ClrWdt();
        }
    }
    //drp_memSD_BlockErase();
}
开发者ID:keimi,项目名称:SUCHAI,代码行数:29,代码来源:cmdDRP.c


示例13: sys_runas_admin

/**
 * Execute process @p path with admin privileges
 *
 * @note This function will trigger the UAC dialog
 *
 * @param[in]   path    Path to the executable
 *
 * @retval      true    If process was executed successfully
 * @retval      false   On error, or if the user declined the UAC
 */
bool sys_runas_admin(char *path)
{
    BOOL success;
    SHELLEXECUTEINFO shexe_info;

    bool isadmin = false;

    printf("Trying to execute '%s' as admin!\n", path);
    /* Check if we're already admin */
    if (!sys_is_admin(&isadmin))
    {
        con_printf("Unable to determine if we're running elevated.\n");
        return false;
    }

    if (isadmin)
    {
        con_printf("Unable to execute %s as we're already elevated.\n", path);
        return false;
    }

    /* Do the undocumented "runas" trick of ShellExecute() */
    memset(&shexe_info, 0, sizeof(shexe_info));
    shexe_info.cbSize = sizeof(shexe_info);

    shexe_info.lpVerb = "runas";
    shexe_info.lpFile = path;
    shexe_info.nShow = SW_MAXIMIZE;

    success = ShellExecuteEx(&shexe_info);
    return (success == TRUE);
}
开发者ID:CeeJay79,项目名称:apme,代码行数:42,代码来源:util.c


示例14: gr_close

void gr_close()
{
	ogl_brightness_r = ogl_brightness_g = ogl_brightness_b = 0;

	if (gl_initialized)
	{
		ogl_smash_texture_list_internal();
	}

	if (grd_curscreen)
	{
		if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
			d_free(grd_curscreen->sc_canvas.cv_bitmap.bm_data);
		d_free(grd_curscreen);
	}
	ogl_close_pixel_buffers();
#ifdef _WIN32
	if (ogl_rt_loaded)
		OpenGL_LoadLibrary(false);
#endif

#ifdef OGLES
	ogles_destroy();
#ifdef RPI
	con_printf(CON_DEBUG, "RPi: cleanuing up\n");
	if (dispman_display != DISPMANX_NO_HANDLE) {
		rpi_destroy_element();
		con_printf(CON_DEBUG, "RPi: closing display\n");
		vc_dispmanx_display_close(dispman_display);
		dispman_display = DISPMANX_NO_HANDLE;
	}
#endif
#endif
}
开发者ID:CDarrow,项目名称:DXX-Retro,代码行数:34,代码来源:gr.c


示例15: internal_set_gfx_mode

void internal_set_gfx_mode(){
    // Actually sets the graphics mode.
    int error,n=player_gfx_mode-1;

    // Try to set the graphics mode (unless we're allready in it).
    if(n!=old_gfx_mode){
        error=set_gfx_mode(GFX_AUTODETECT,gfx_mode_info[n].width,gfx_mode_info[n].height,0,0);
        if(error<0){
            // DEBUG: Will this error even appear in a bad graphics mode?
            con_printf("Couldn't initiate the graphics mode!");
        }
        else{
            // Get the new screen width/height.
            screen_width=gfx_mode_info[n].width;
            screen_height=gfx_mode_info[n].height;
            set_palette(gamma_pal);

            // DEBUG: Shouldn't we free the old VGABUF?!!
            vgabuf=create_bitmap(screen_width,screen_height);
            sprintf(saybuf,"%d x %d mode set (%dk vgabuf)",screen_width,screen_height,screen_width*screen_height/1024);
            con_printf(saybuf);

            // Reset the console height, if the console is down.
            if(player_connected==1&&player_con==1){
                con_height=screen_height/2;
            }
        }
    }

    // Save the old mode.
    old_gfx_mode=n;
}
开发者ID:amcgregor,项目名称:raven,代码行数:32,代码来源:cmds.c


示例16: gyr_get_FIFO_samples

// ============================================================================================================
// Reads the FIFO content
// Arguments	: None
// Return      	: int direcc_b (Value of first address of data buffer)
// ============================================================================================================
void gyr_get_FIFO_samples(BOOL verb, GYR_DATA *res_data){
    #if (SCH_GYRO_VERBOSE>=2)
	con_printf("Entered to read FIFO\r\n");
    #endif
	
    unsigned char dummy = gyr_read_reg(GYR_FIFO_CTRL_REG);
    unsigned char muestras = (dummy & 0x1F)+1;
    // Plus one because the first sample is in the position zero of the array

    #if (SCH_GYRO_VERBOSE>=2)
	con_printf("SAMPLES (number) recovered \t");		// Samples for ONE axis
        char ret[6];
        itoa(ret,  (unsigned int)muestras, 10); con_printf(ret); con_printf("\r\n");
    #endif

    char address[] = {GYR_ADD, GYR_OUT_X_L_RB};
    unsigned char buffer[muestras*3*2]; // By 3 because there's 3 axes
                                        // By 2 because each sample is two bytes
    i2c3_master_fgets((char *)buffer, muestras*3*2, address, 2);

    #if (SCH_GYRO_VERBOSE>=2)
	con_printf("Samples read ... \r\n");	// for debugging
    #endif

    unsigned char *direcc_b;
    direcc_b = &buffer[0];
    gyr_get_data(verb, direcc_b, muestras, res_data);

}
开发者ID:keimi,项目名称:SUCHAI,代码行数:34,代码来源:dig_gyro.c


示例17: gyr_print_temp

// ============================================================================================================
// Reads the temperature of the sensor
// Arguments	: None
// Return      	: None
// ============================================================================================================
void gyr_print_temp(void){
    unsigned char dummy = gyr_read_reg(GYR_OUT_TEMP);
    con_printf("Sensor temperature: \t ");
    char ret[10];
    //itoa(ret, (unsigned int)dummy, 16);
    sprintf (ret, "0x%X", (unsigned int)dummy);
    con_printf(ret); con_printf("\r\n");
}
开发者ID:keimi,项目名称:SUCHAI,代码行数:13,代码来源:dig_gyro.c


示例18: sys_is_admin

/**
 * Check whether we're running with elevated privileges
 * (as Administrator)
 *
 * @param[out]  isadmin @p true if we're running as admin, @p false otherwise
 *
 * @note This function only works if compiled under MinGW
 *
 * @retval      true    On success
 * @retval      false   On error
 */
bool sys_is_admin(bool *isadmin)
{
#ifdef OS_CYGWIN
    /*
     * Under Cygwin the elevation stuff does not work, and the binary crashes
     * because it cannot find the .DLL anyway
     */
    (void)isadmin;
    return false;
#else
    HANDLE proc_token;
    BOOL ok;

    (void)isadmin;

    /* Open the current process' token */
    ok = OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &proc_token);
    if (!ok)
    {
        con_printf("OpenProcessToken() failed\n");
        return false;
    }

    TOKEN_ELEVATION_TYPE ele_type;
    DWORD ele_size;

    ok = GetTokenInformation(proc_token,
                             TokenElevationType,
                             &ele_type,
                             sizeof(ele_type),
                             &ele_size);
    if (!ok)
    {
        con_printf("GetTokenInformation() failed\n");
        return false;
    }

    switch (ele_type)
    {
        case TokenElevationTypeDefault:
            /*
             * TokenElevationTypeDefault is apparently returned when UAC is disabled; does this
             * also mean we have admin rights?
             */
        case TokenElevationTypeFull:
        default:
            *isadmin = true;
            break;

        case TokenElevationTypeLimited:
            *isadmin = false;
    }

    con_printf("sys_is_admin() says admin = %s!\n", *isadmin ? "TRUE" : "FALSE");

    return true;
#endif
}
开发者ID:CeeJay79,项目名称:apme,代码行数:69,代码来源:util.c


示例19: CanJoinNetgame

int CanJoinNetgame (tNetgameInfo *game, tAllNetPlayersInfo *people)
{
	// Can this tPlayer rejoin a netgame in progress?

	int i, nNumPlayers;

if (game->gameStatus == NETSTAT_STARTING)
   return 1;
if (game->gameStatus != NETSTAT_PLAYING) {
#if 1      
	con_printf (CONDBG, "Error: Can't join because gameStatus !=NETSTAT_PLAYING\n");
#endif
	return 0;
    }

if (game->versionMajor == 0 && D2X_MAJOR>0) {
#if 1      
	con_printf (CONDBG, "Error:Can't join because version majors don't match!\n");
#endif
	return 0;
	}

if (game->versionMajor>0 && D2X_MAJOR == 0) {
#if 1      
	con_printf (CONDBG, "Error:Can't join because version majors2 don't match!\n");
#endif
	return 0;
	}
// Game is in progress, figure out if this guy can re-join it
nNumPlayers = game->nNumPlayers;

if (!(game->gameFlags & NETGAME_FLAG_CLOSED)) {
	// Look for tPlayer that is not connected
	if (game->nConnected == game->nMaxPlayers)
		 return 2;
	if (game->bRefusePlayers)
		 return 3;
	if (game->nNumPlayers < game->nMaxPlayers)
		return 1;
	if (game->nConnected<nNumPlayers)
		return 1;
	}
if (!people) {
	con_printf (CONDBG, "Error! Can't join because people == NULL!\n");
	return 0;
   }
// Search to see if we were already in this closed netgame in progress
for (i = 0; i < nNumPlayers; i++)
	if (!CmpNetPlayers (LOCALPLAYER.callsign, 
							  people->players [i].callsign, 
							  &networkData.thisPlayer.player.network, 
							  &people->players [i].network))
		return 1;
#if 1      
con_printf (CONDBG, "Error: Can't join because at end of list!\n");
#endif
return 0;
}
开发者ID:paud,项目名称:d2x-xl,代码行数:58,代码来源:network_join.cpp


示例20: gyr_take_samples

void gyr_take_samples(BOOL verb, GYR_DATA *res_data){
    gyr_config_GYR_CTRL_REG1(0x01, 0x03);  // 200 Hz datarate and 70 cutoff
    gyr_enable_axis(0x07);                  // Enable three axes
    gyr_powermode(0x01);                    // Enable device
    __delay_ms(50);

    config_FIFO_GYR_CTRL_REG(0b00000111);   // configure FIFO_GYR_CTRL_REG with watermark
    if(verb){
        gyr_print_remain_samp();            // Obtain the number of remaining samples
    }
    gyr_config_FIFO_mode(0x01);         // Mode to FIFO mode

    while(!GYR_INT2){
        if(verb){
            con_printf("GYR_INT2=0\r\n");
        }
    }
    __delay_ms(50);

    if(verb){
        gyr_print_FIFO_int_source();    // see FIFO interruption
        gyr_print_remain_samp();        // Samples to read
        gyr_print_temp();               // Read the temperature of the sensor
    }


    __delay_ms(50);
    if(verb){
        con_printf("showing samples from buffer\r\n");
    }

    gyr_get_FIFO_samples(verb, res_data);  // read FIFO data
    if(verb){
	printf("gyr_take_samples\r\n");
	printf("X axis : %d\n", (*res_data).a_x );
        printf("Y axis : %d\n", (*res_data).a_y );
        printf("Z axis : %d\n", (*res_data).a_z );
        printf("************************\n");
    }

    __delay_ms(50);

    gyr_config_FIFO_mode(0x00);     // go to bypass mode (in order to go
                                    // to FIFO mode again - device requirement)
    __delay_ms(50);


    //ClrWdt();
    // --------------------------------------------
    // Debugging purposes (Change scale to 250 dps)
    /*
    gyr_config_GYR_CTRL_REG4(0x01, 0x00, 0x00);
    con_printf("Scale changed to 250 dps\r\n");

    gyr_powermode(0x00);						// to powerdown
    */
}
开发者ID:keimi,项目名称:SUCHAI,代码行数:57,代码来源:dig_gyro.c



注:本文中的con_printf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ concat函数代码示例发布时间:2022-05-30
下一篇:
C++ con函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap