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

C++ rt_device_control函数代码示例

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

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



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

示例1: adc_thread_entry

static void adc_thread_entry(void *parameter)
{
    rt_device_t device;
    
#ifdef RT_USING_RTGUI
    struct rtgui_event_command ecmd;
    
    RTGUI_EVENT_COMMAND_INIT(&ecmd);
    ecmd.type = RTGUI_CMD_USER_INT;
    ecmd.command_id = ADC_UPDATE;
#else
    struct lcd_msg msg;
#endif	

    device = rt_device_find("adc");

    while(1)
    {
        rt_device_control(device, RT_DEVICE_CTRL_ADC_START, RT_NULL);    
        rt_device_control(device, RT_DEVICE_CTRL_ADC_RESULT, &adc_value);
        pwm_update(adc_value/3);
#ifdef RT_USING_RTGUI
        rtgui_thread_send(info_tid, &ecmd.parent, sizeof(ecmd));
#else
        msg.type = ADC_MSG;
		msg.adc_value = adc_value;
        rt_mq_send(&mq, &msg, sizeof(msg));
#endif
        rt_thread_delay(20);
    }
}
开发者ID:bright-pan,项目名称:smart-lock,代码行数:31,代码来源:adc.c


示例2: calibration_entry

void calibration_entry(void* parameter)
{
    rt_device_t device;
    struct rtgui_rect rect;
    struct setup_items setup;

    device = rt_device_find("touch");
    if (device == RT_NULL) return; /* no this device */

    calibration_ptr = (struct calibration_session*)
        rt_malloc(sizeof(struct calibration_session));
    rt_memset(calibration_ptr, 0, sizeof(struct calibration_data));
    calibration_ptr->device = device;
    
    rt_device_control(calibration_ptr->device, RT_TOUCH_CALIBRATION, 
        (void*)calibration_data_post);
    
    rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect);
    
    /* set screen rect */
    calibration_ptr->width = rect.x2;
    calibration_ptr->height = rect.y2;

    calibration_ptr->app = rtgui_app_create("calibration");
    if (calibration_ptr->app != RT_NULL)
    {
        /* create calibration window */
        calibration_ptr->win = rtgui_win_create(RT_NULL,
            "calibration", &rect, 
            RTGUI_WIN_STYLE_NO_TITLE | RTGUI_WIN_STYLE_NO_BORDER | 
            RTGUI_WIN_STYLE_ONTOP | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
        if (calibration_ptr->win != RT_NULL)
        {   			
            rtgui_object_set_event_handler(RTGUI_OBJECT(calibration_ptr->win),
                calibration_event_handler);
            rtgui_win_show(calibration_ptr->win, RT_TRUE);
        }
        
        rtgui_app_destroy(calibration_ptr->app);
    }

    /* set calibration data */
    rt_device_control(calibration_ptr->device, RT_TOUCH_CALIBRATION_DATA, 
        &calibration_ptr->data);

    //save setup
    setup.touch_min_x = calibration_ptr->data.min_x;
    setup.touch_max_x = calibration_ptr->data.max_x;
    setup.touch_min_y = calibration_ptr->data.min_y;
    setup.touch_max_y = calibration_ptr->data.max_y;
    setup_save(&setup);
    
    /* recover to normal */
    rt_device_control(calibration_ptr->device, RT_TOUCH_NORMAL, RT_NULL);

    /* release memory */
    rt_free(calibration_ptr);
    calibration_ptr = RT_NULL;
}
开发者ID:suzuki8,项目名称:realtouch-stm32f4,代码行数:59,代码来源:calibration.c


示例3: can_bus_hook


//.........这里部分代码省略.........
#ifdef RT_USING_CAN
#define CANRT1   8
#define CANERR1  9
#define CANRT2   37
#define CANERR2  38
static struct canledtype
{
    struct stm32_hw_pin_userdata rtd;
    struct stm32_hw_pin_userdata err;
} canled[] =
{
#ifdef USING_BXCAN1
    {
        {CANRT1, PIN_MODE_OUTPUT,},
        {CANERR1, PIN_MODE_OUTPUT,},
    },
#endif /*USING_BXCAN1*/
#ifdef USING_BXCAN2
    {
        {CANRT2, PIN_MODE_OUTPUT_OD,},
        {CANERR2, PIN_MODE_OUTPUT_OD,},
    },
#endif /*USING_BXCAN2*/
};
void can_bus_hook(struct rt_can_device *can, struct canledtype *led)
{
    if (can->timerinitflag == 1)
    {
        rt_pin_write(led->rtd.pin, 0);
    }
    else
    {
        if (can->status.rcvchange == 1 || can->status.sndchange == 1)
        {
            can->status.rcvchange = 0;
            can->status.sndchange = 0;
            rt_pin_write(led->rtd.pin, rt_pin_read(led->rtd.pin) ? 0 : 1);
        }
        else
        {
            rt_pin_write(led->rtd.pin, 1);
        }
    }
    if (can->timerinitflag == 1)
    {
        rt_pin_write(led->err.pin, 0);
    }
    else
    {
        if (can->status.errcode)
        {
            rt_pin_write(led->err.pin, 0);
        }
        else
        {
            rt_pin_write(led->err.pin, 1);
        }
    }
}
#ifdef USING_BXCAN1
void can1_bus_hook(struct rt_can_device *can)
{
    static rt_int32_t inited = 0;
    if (!inited)
    {
        inited = 1;
        rt_pin_mode(canled[0].rtd.pin, canled[0].rtd.mode);
        rt_pin_mode(canled[0].err.pin, canled[0].err.mode);
    }
    can_bus_hook(can, &canled[0]);
}
#endif /*USING_BXCAN1*/
#ifdef USING_BXCAN2
void can2_bus_hook(struct rt_can_device *can)
{
    static rt_int32_t inited = 0;
    if (!inited)
    {
        inited = 1;
        rt_pin_mode(canled[1].rtd.pin, canled[1].rtd.mode);
        rt_pin_mode(canled[1].err.pin, canled[1].err.mode);
    }
    can_bus_hook(can, &canled[1]);
}
#endif /*USING_BXCAN2*/
int can_bus_hook_init(void)
{
    rt_device_t candev;
#ifdef USING_BXCAN1
    candev = rt_device_find("bxcan1");
    RT_ASSERT(candev);
    rt_device_control(candev, RT_CAN_CMD_SET_BUS_HOOK, (void *)can1_bus_hook);
#endif /*USING_BXCAN1*/
#ifdef USING_BXCAN2
    candev = rt_device_find("bxcan2");
    RT_ASSERT(candev);
    rt_device_control(candev, RT_CAN_CMD_SET_BUS_HOOK, (void *)can2_bus_hook);
#endif /*USING_BXCAN2*/
    return RT_EOK;
}
开发者ID:chinesebear,项目名称:rt-thread,代码行数:101,代码来源:canapp.c


示例4: rt_can_thread_entry

void rt_can_thread_entry(void *parameter)
{
    struct rt_can_msg msg;
    struct can_app_struct *canpara = (struct can_app_struct *) parameter;
    rt_device_t candev;
    rt_uint32_t e;

    candev = rt_device_find(canpara->name);
    RT_ASSERT(candev);
    rt_event_init(&canpara->event, canpara->name, RT_IPC_FLAG_FIFO);
    rt_device_open(candev, (RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX));
    rt_device_control(candev, RT_CAN_CMD_SET_FILTER, canpara->filter);
    while (1)
    {
        if (
            rt_event_recv(&canpara->event,
                          ((1 << canpara->filter->items[0].hdr)  |
                           (1 << canpara->filter->items[1].hdr) |
                           (1 << canpara->filter->items[2].hdr) |
                           (1 << canpara->filter->items[3].hdr)),
                          canpara->eventopt,
                          RT_WAITING_FOREVER, &e) != RT_EOK
        )
        {
            continue;
        }
        if (e & (1 << canpara->filter->items[0].hdr))
        {
            msg.hdr = canpara->filter->items[0].hdr;
            while (rt_device_read(candev, 0, &msg, sizeof(msg)) == sizeof(msg))
            {
                rt_device_write(candev, 0, &msg, sizeof(msg));
            }
        }
        if (e & (1 << canpara->filter->items[1].hdr))
        {
            msg.hdr = canpara->filter->items[1].hdr;
            while (rt_device_read(candev, 0, &msg, sizeof(msg)) == sizeof(msg))
            {
                rt_device_write(candev, 0, &msg, sizeof(msg));
            }
        }
        if (e & (1 << canpara->filter->items[2].hdr))
        {
            msg.hdr = canpara->filter->items[2].hdr;
            while (rt_device_read(candev, 0, &msg, sizeof(msg)) == sizeof(msg))
            {
                rt_device_write(candev, 0, &msg, sizeof(msg));
            }
        }
        if (e & (1 << canpara->filter->items[3].hdr))
        {
            msg.hdr = canpara->filter->items[3].hdr;
            while (rt_device_read(candev, 0, &msg, sizeof(msg)) == sizeof(msg))
            {
                rt_device_write(candev, 0, &msg, sizeof(msg));
            }
        }
    }
}
开发者ID:chinesebear,项目名称:rt-thread,代码行数:60,代码来源:canapp.c


示例5: time

time_t time(time_t* t)
#endif
{
    static rt_device_t device = RT_NULL;
    time_t time_now = 0;

    /* optimization: find rtc device only first. */
    if (device == RT_NULL)
    {
        device = rt_device_find("rtc");
    }

    /* read timestamp from RTC device. */
    if (device != RT_NULL)
    {
        rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time_now);
    }

    /* if t is not NULL, write timestamp to *t */
    if (t != RT_NULL)
    {
        *t = time_now;
    }

    return time_now;
}
开发者ID:dlts200466,项目名称:PowerSupply,代码行数:26,代码来源:rtc.c


示例6: calibration_init

void calibration_init(void)
{
    rt_thread_t tid;
    struct setup_items setup;
    
    if(setup_load(&setup) == RT_EOK)
    {    
        struct calibration_data data;        
        rt_device_t device;
        
        data.min_x = setup.touch_min_x;
        data.max_x = setup.touch_max_x;
        data.min_y = setup.touch_min_y;
        data.max_y = setup.touch_max_y;

        device = rt_device_find("touch");
        if(device != RT_NULL)
            rt_device_control(device, RT_TOUCH_CALIBRATION_DATA, &data);
        return;
    }
        
    tid = rt_thread_create("cali", calibration_entry, RT_NULL, 1024, 20, 20);
    if (tid != RT_NULL)
        rt_thread_startup(tid);
}
开发者ID:suzuki8,项目名称:realtouch-stm32f4,代码行数:25,代码来源:calibration.c


示例7: clock_settime

int clock_settime (clockid_t clockid, const struct timespec *tp)
{
	int second;
	rt_tick_t tick;
	rt_device_t device;

	if ((clockid != CLOCK_REALTIME) || (tp == RT_NULL)) {
		rt_set_errno(EINVAL);
		return -1;
	}

	/* get second */
	second = tp->tv_sec;
	/* get tick */
	tick = rt_tick_get();

	/* update timevalue */
	_timevalue.tv_usec = MICROSECOND_PER_SECOND - (tick % RT_TICK_PER_SECOND) * MICROSECOND_PER_TICK;
	_timevalue.tv_sec = second - tick/RT_TICK_PER_SECOND - 1;

	/* update for RTC device */
	device = rt_device_find("rtc");
	if (device != RT_NULL) {
		/* set realtime seconds */
		rt_device_control(device, RT_DEVICE_CTRL_RTC_SET_TIME, &second);
	} else return -1;

	return 0;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:29,代码来源:clock_time.c


示例8: PVD_IRQHandler

void PVD_IRQHandler(void)
{
	unsigned poweroff_cnt;
	unsigned long time;

	EXTI->PR = EXTI_Line16; //EXTI_ClearITPendingBit(EXTI_Line16);

	/* 系统上电前500ms, 不认为是掉电; 若已处于系统掉电状态, 将不再处理 */
	if ((rt_tick_get() < 50) || (NULL == rtc_dev) || is_system_powerdown) {
		return;
	}

	/*
		lcd_bl_led_off();
		buzzer_off(buzzer_gpio, buzzer_pin);
	*/
	is_system_powerdown = 1;
	sys_powerdown_delay4confirm = rt_tick_get();

	PWR_BackupAccessCmd(ENABLE);

	poweroff_cnt = BKP_ReadBackupRegister(RX_POWEROFF_CNT_BKP16BITS);
	BKP_WriteBackupRegister(RX_POWEROFF_CNT_BKP16BITS, ++poweroff_cnt);

	rt_device_control(rtc_dev, RT_DEVICE_CTRL_RTC_GET_TIME, &time);
	BKP_WriteBackupRegister(RX_POWEROFF_N_BKP16BITS_H, (time>>16) & 0xffff);
	BKP_WriteBackupRegister(RX_POWEROFF_N_BKP16BITS_L, (time) & 0xffff);

	PWR_BackupAccessCmd(DISABLE);

	//rt_kprintf("%s", __FUNCTION__);

	return;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:34,代码来源:stm32f10x_it.c


示例9: rtgui_gdev_set

rt_err_t rtgui_gdev_set(rt_device_t device)
{
	rt_err_t result;
	struct rt_device_graphic_info info;

	/* get framebuffer address */
	result = rt_device_control(device, RTGRAPHIC_CTRL_GET_INFO, &info);
	if(result != RT_EOK)
	{
		/* get device information failed */
		return -RT_ERROR;
	}

	/* initialize framebuffer driver */
	_driver.device = device;
	_driver.bits_per_pixel = info.bits_per_pixel;
	_driver.width = info.width;
	_driver.height = info.height;
	_driver.pitch = _driver.width * _driver.bits_per_pixel/8;
	_driver.framebuffer = info.framebuffer;

	/* is a frame buffer device */
	_driver.ops = rtgui_fb_get_ops();

	return RT_EOK;
}
开发者ID:amsl,项目名称:RTGUI,代码行数:26,代码来源:driver.c


示例10: eth_device_init_with_flag

/* Keep old drivers compatible in RT-Thread */
Int32 eth_device_init_with_flag(struct eth_device *dev, char *name, UInt8 flags)
{
    struct netif* netif;

    netif = (struct netif*) malloc (sizeof(struct netif));
    if (netif == NULL)
    {
        printf("malloc netif failed\n");
        return -RT_ERROR;
    }
    memset(netif, 0, sizeof(struct netif));

    /* set netif */
    dev->netif = netif;
    /* device flags, which will be set to netif flags when initializing */
    dev->flags = flags;
    /* link changed status of device */
    dev->link_changed = 0x00;
    dev->parent.type = RT_Device_Class_NetIf;
    /* register to RT-Thread device manager */
    rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR);
    rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO);

    /* set name */
    netif->name[0] = name[0];
    netif->name[1] = name[1];

    /* set hw address to 6 */
    netif->hwaddr_len 	= 6;
    /* maximum transfer unit */
    netif->mtu			= ETHERNET_MTU;

    /* get hardware MAC address */
    rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr);

    /* set output */
    netif->output		= etharp_output;
    netif->linkoutput	= ethernetif_linkoutput;

    /* if tcp thread has been started up, we add this netif to the system */
    if (rt_thread_find("tcpip") != NULL)
    {
        struct ip_addr ipaddr, netmask, gw;

#if !LWIP_DHCP
        IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3);
        IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3);
        IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3);
#else
        IP4_ADDR(&ipaddr, 0, 0, 0, 0);
        IP4_ADDR(&gw, 0, 0, 0, 0);
        IP4_ADDR(&netmask, 0, 0, 0, 0);
#endif

        netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input);
    }

    return RT_EOK;
}
开发者ID:haitao52198,项目名称:HD-Elastos,代码行数:60,代码来源:ethernetif.c


示例11: beep

void beep(int argc, char** argv)
{
    int time, freq;
    time = strtoul(argv[1],0,0);
    freq = strtoul(argv[2],0,0);
    if(!time) time = 1;
	dev_beep = rt_device_find("beep");
	if (dev_beep == RT_NULL)
	{
		rt_kprintf("no device found!\n");
		return;
	}
    rt_device_open(dev_beep, 0);
    rt_timer_init(&timer, "bt", timer_timeout, RT_NULL, time/(1000/RT_TICK_PER_SECOND), RT_TIMER_FLAG_ONE_SHOT);
    rt_timer_start(&timer);
    rt_device_control(dev_beep, RT_DEVICE_CTRL_SET_BEEP_FRQ, &freq);
    rt_device_control(dev_beep, RT_DEVICE_CTRL_BEEP_START, RT_NULL);
}
开发者ID:jeenter,项目名称:CH-K-Lib,代码行数:18,代码来源:drv_beep.c


示例12: gsm_thread_entry

static void gsm_thread_entry(void* parameter)  
{
    rt_size_t  res=RT_ERROR;
    u8  linkNum=0;	
        //     finsh_init(&shell->parser);
	rt_kprintf("\r\n ---> gsm thread start !\r\n");
	 //	  	 
	 
	while (1)
	{
	
            // 1.  after power  on    get imsi code  	 	
              IMSIcode_Get(); 
            //  2. after get imsi   Comm   AT  initial   start 
              GSM_Module_TotalInitial();  
            // 3. Receivce & Process   Communication  Module   data ----
	       GSM_Buffer_Read_Process(); 
	           
             if(!SMS_send_stateQuery())
             	{
		       DataLink_Process();		
	             //------------------------------------------------
			    if (Send_DataFlag== 1) 
	               {
				   //  rt_kprintf("\r\n  gsm rx  app msgQue:   rxlen=%d  rx_content=%s\r\n",msgq_gsm.len,msgq_gsm.info); 	 
	                        //  Data_Send(GPRS_info,GPRS_infoWr_Tx); 
				   res=rt_device_control(&Device_GSM, query_online, NULL);
				    if(res==RT_EOK)
				     { 
				          linkNum=gsm_rx_app_infoStruct.link_num;  // IC  link  ==1  
				          rt_device_write(&Device_GSM, linkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); 
				    }		  
				    Send_DataFlag=0;          
		
		         }    
			//---------  Step timer
			  Dial_step_Single_10ms_timer();    
			  	  //   TTS	
	                TTS_Data_Play(); 
			 
	                //   Get  CSQ value
		        // GSM_CSQ_Query();	 			  //   SMS Send
             	}
		else
			SMS_send_process();     //  相关短信处理
		 
                //   Get  CSQ value
	         GSM_CSQ_Query();	 
              
			  //	  Voice Record
			   VOC_REC_process();

			
	         rt_thread_delay(20);  	     
			   
	}
}
开发者ID:nathanlnw,项目名称:705_tw_DrvRec,代码行数:57,代码来源:App_gsm.c


示例13: eth_device_init

/* ethernetif APIs */
Int32 eth_device_init(struct eth_device* dev, const char* name)
{
	struct netif* netif;
        uip_ipaddr_t ipaddr;
	netif = (struct netif*) malloc (sizeof(struct netif));
	if (netif == NULL)
	{
		printf("malloc netif failed\n");
		return -RT_ERROR;
	}
	memset(netif, 0, sizeof(struct netif));

	/* set netif */
	dev->netif = netif;
	/* register to rt-thread device manager */
	rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR);
	dev->parent.type = RT_Device_Class_NetIf;
	rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO);

	/* set name */
	netif->name[0] = name[0];
	netif->name[1] = name[1];

	/* set hw address to 6 */
	netif->hwaddr_len	= 6;
	/* maximum transfer unit */
	netif->mtu			= ETHERNET_MTU;
	/* broadcast capability */
	netif->flags		= NETIF_FLAG_BROADCAST;

#if LWIP_IGMP
	/* igmp support */
	netif->flags |= NETIF_FLAG_IGMP;
#endif

	/* get hardware address */
	rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr);

	/* set output */
	netif->output		= ethernetif_output;
	netif->linkoutput	= ethernetif_linkoutput;

	/* add netif to lwip */

	if (netif_add(netif, IP_ADDR_ANY, IP_ADDR_BROADCAST, IP_ADDR_ANY, dev,
		eth_init, eth_input) == NULL)
	{
		/* failed, unregister device and free netif */
		rt_device_unregister(&(dev->parent));
		rt_free(netif);
		return -RT_ERROR;
	}

	netif_set_default(netif);
	return RT_EOK;
}
开发者ID:haitao52198,项目名称:HD-Elastos,代码行数:57,代码来源:uip_ethernetif.c


示例14: calibration_entry

void calibration_entry(void* parameter)
{
	rt_mq_t mq;
	rtgui_win_t* win;
	struct rtgui_rect rect;

	mq = rt_mq_create("cali", 40, 8, RT_IPC_FLAG_FIFO);
	if (mq == RT_NULL) return;

	rtgui_thread_register(rt_thread_self(), mq);

	rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect);

	/* set screen rect */
	calibration_ptr->width = rect.x2;
	calibration_ptr->height = rect.y2;

	/* create calibration window */
	win = rtgui_win_create(RT_NULL,
		"calibration", &rect, RTGUI_WIN_STYLE_NO_TITLE | RTGUI_WIN_STYLE_NO_BORDER);
	rtgui_widget_set_event_handler(RTGUI_WIDGET(win), calibration_event_handler);
	if (win != RT_NULL)
	{
		rtgui_win_show(win, RT_FALSE);
		// rtgui_widget_update(RTGUI_WIDGET(win));
		rtgui_win_event_loop(win);
	}

	rtgui_thread_deregister(rt_thread_self());
	rt_mq_delete(mq);

	/* set calibration data */
	rt_device_control(calibration_ptr->device, RT_TOUCH_CALIBRATION_DATA, &calibration_ptr->data);

	/* recover to normal */
	rt_device_control(calibration_ptr->device, RT_TOUCH_NORMAL, RT_NULL);

	/* release memory */
	rt_free(calibration_ptr);
	calibration_ptr = RT_NULL;
    /* tell other thread that we finished calibration */
    rt_sem_release(touch_screen_calibrated);
}
开发者ID:grissiom,项目名称:rtgui-stm32-tut,代码行数:43,代码来源:calibration.c


示例15: disk_ioctl_USB

/* Miscellaneous Functions */
DRESULT disk_ioctl_USB(BYTE drv, BYTE ctrl, void *buff)
{
	rt_device_t device = &mscdev;

	if (device == RT_NULL)
		return RES_ERROR;

	if (ctrl == GET_SECTOR_COUNT)
	{
		struct rt_device_blk_geometry geometry;

		rt_memset(&geometry, 0, sizeof(geometry));
		rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);

		*(DWORD *)buff = geometry.sector_count;
		if (geometry.sector_count == 0)
			return RES_ERROR;
	}
	else if (ctrl == GET_SECTOR_SIZE)
	{
		struct rt_device_blk_geometry geometry;

		rt_memset(&geometry, 0, sizeof(geometry));
		rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);

		*(WORD *)buff = geometry.bytes_per_sector;
	}
	else if (ctrl == GET_BLOCK_SIZE) /* Get erase block size in unit of sectors (DWORD) */
	{
		struct rt_device_blk_geometry geometry;

		rt_memset(&geometry, 0, sizeof(geometry));
		rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);

		*(DWORD *)buff = geometry.block_size/geometry.bytes_per_sector;
	}
	else if (ctrl == CTRL_SYNC)
	{
		rt_device_control(device, RT_DEVICE_CTRL_BLK_SYNC, RT_NULL);
	}

	return RES_OK;
}
开发者ID:mildrock,项目名称:705_1,代码行数:44,代码来源:usbh_usr.c


示例16: rtgui_cursor_set_image

void rtgui_cursor_set_image(enum rtgui_cursor_type type)
{
    rt_uint32_t value;

    if (_current_driver->device != RT_NULL)
    {
        value = type;
        rt_device_control(_driver.device, RT_DEVICE_CTRL_CURSOR_SET_TYPE, &value);
    }
};
开发者ID:onelife,项目名称:rt-thread,代码行数:10,代码来源:rtgui_driver.c


示例17: rtgui_gdev_update

/* screen update */
void rtgui_gdev_update(const struct rtgui_gdev* driver, rtgui_rect_t *rect)
{
	struct rt_device_rect_info rect_info;

	rect_info.x = rect->x1;
	rect_info.y = rect->y1;
	rect_info.w = rect->x2 - rect->x1;
	rect_info.h = rect->y2 - rect->y1;
	rt_device_control(driver->device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect_info);
}
开发者ID:amsl,项目名称:RTGUI,代码行数:11,代码来源:driver.c


示例18: rtgui_cursor_set_position

void rtgui_cursor_set_position(rt_uint16_t x, rt_uint16_t y)
{
    rt_uint32_t value;

    if (_current_driver->device != RT_NULL)
    {
        value = (x << 16 | y);
        rt_device_control(_driver.device, RT_DEVICE_CTRL_CURSOR_SET_POSITION, &value);
    }
}
开发者ID:onelife,项目名称:rt-thread,代码行数:10,代码来源:rtgui_driver.c


示例19: control_get_max_duty

int32_t control_get_max_duty(void)
{
	int32_t val;
	
	RT_ASSERT(s_dev_pwm != RT_NULL);
	
	rt_device_control(s_dev_pwm, CMD_PWM_MAX_DUTY_GET, &val);
	
	return val;
}
开发者ID:zhuhuijia0001,项目名称:eload,代码行数:10,代码来源:control.c


示例20: rtgui_graphic_driver_screen_update

/* screen update */
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect)
{
    struct rt_device_rect_info rect_info;

    rect_info.x = rect->x1;
    rect_info.y = rect->y1;
    rect_info.width = rect->x2 - rect->x1;
    rect_info.height = rect->y2 - rect->y1;
    rt_device_control(driver->device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect_info);
}
开发者ID:firetechmlf,项目名称:RTGUI,代码行数:11,代码来源:driver.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ rt_device_find函数代码示例发布时间:2022-05-30
下一篇:
C++ rtGetNaN函数代码示例发布时间: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