本文整理汇总了C++中rt_device_register函数的典型用法代码示例。如果您正苦于以下问题:C++ rt_device_register函数的具体用法?C++ rt_device_register怎么用?C++ rt_device_register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rt_device_register函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rt_hw_uart_init
void rt_hw_uart_init(void)
{
struct rt_uart_lpc* uart;
#ifdef RT_USING_UART0
/* get uart device */
uart = &uart0_device;
uart0_device.UART = LPC_UART0;
uart0_device.UART_IRQn = UART0_IRQn;
/* device initialization */
uart->parent.type = RT_Device_Class_Char;
rt_memset(uart->rx_buffer, 0, sizeof(uart->rx_buffer));
uart->read_index = uart->save_index = 0;
/* device interface */
uart->parent.init = rt_uart_init;
uart->parent.open = rt_uart_open;
uart->parent.close = rt_uart_close;
uart->parent.read = rt_uart_read;
uart->parent.write = rt_uart_write;
uart->parent.control = RT_NULL;
uart->parent.user_data = RT_NULL;
rt_device_register(&uart->parent,
"uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
#endif
#ifdef RT_USING_UART1
/* get uart device */
uart = &uart1_device;
uart1_device.UART = (LPC_UART_TypeDef *)LPC_UART1;
uart1_device.UART_IRQn = UART1_IRQn;
/* device initialization */
uart->parent.type = RT_Device_Class_Char;
rt_memset(uart->rx_buffer, 0, sizeof(uart->rx_buffer));
uart->read_index = uart->save_index = 0;
/* device interface */
uart->parent.init = rt_uart_init;
uart->parent.open = rt_uart_open;
uart->parent.close = rt_uart_close;
uart->parent.read = rt_uart_read;
uart->parent.write = rt_uart_write;
uart->parent.control = RT_NULL;
uart->parent.user_data = RT_NULL;
rt_device_register(&uart->parent,
"uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
#endif
}
开发者ID:heyuanjie87,项目名称:rt-thread,代码行数:52,代码来源:uart.c
示例2: USBH_USR_MSC_Application
/**
* @brief USBH_USR_MSC_Application
* Demo application for mass storage
* @param None
* @retval Staus
*/
int USBH_USR_MSC_Application( void )
{
// FRESULT res;
int ret;
if( diskinited )
{
return 0;
}
mscdev.type = RT_Device_Class_Block;
mscdev.init = msc_init;
mscdev.open = msc_open;
mscdev.close = msc_close;
mscdev.read = msc_read;
mscdev.write = msc_write;
mscdev.control = msc_control;
mscdev.user_data = RT_NULL;
diskinited = 1;
rt_device_register( &mscdev, "udisk", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE );
rt_device_init( &mscdev );
rt_thread_delay( RT_TICK_PER_SECOND / 10 );
//ret = dfs_mount( "udisk", "/udisk", "elm", 0, 0 );
if(0 == f_mount(USB, &fs))
{
rt_kprintf("\n f_mount USB OK!");
}
//rt_kprintf( "\ndfs_mount ret=%x now udisk start", ret );
return 0;
}
开发者ID:mildrock,项目名称:705_1,代码行数:39,代码来源:usbh_usr.c
示例3: USBH_USR_MSC_Application
/**
* @brief USBH_USR_MSC_Application
* Demo application for mass storage
* @param None
* @retval Staus
*/
int USBH_USR_MSC_Application( void )
{
int ret;
if( diskinited )
{
return 0;
}
mscdev.type = RT_Device_Class_Block;
mscdev.init = msc_init;
mscdev.open = msc_open;
mscdev.close = msc_close;
mscdev.read = msc_read;
mscdev.write = msc_write;
mscdev.control = msc_control;
mscdev.user_data = RT_NULL;
diskinited = 1;
rt_device_register( &mscdev, "udisk", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE );
rt_device_init( &mscdev );
rt_thread_delay( RT_TICK_PER_SECOND / 10 );
ret = dfs_mount( "udisk", "/udisk", "elm", 0, 0 );
rt_kprintf( "dfs_mount ret=%x now udisk start\r\n", ret );
USB_find_status = USB_FIND;
Show_Menu_5_2_ExportData();
return 0;
}
开发者ID:nathanlnw,项目名称:tw705_HB_gghypt,代码行数:35,代码来源:usbh_usr.c
示例4: gd32_hw_lcd_init
int gd32_hw_lcd_init(void)
{
_rt_framebuffer = rt_malloc_align(sizeof(rt_uint16_t) * RT_HW_LCD_WIDTH * RT_HW_LCD_HEIGHT, 32);
if (_rt_framebuffer == RT_NULL)
return -1; /* no memory yet */
lcd_config();
tli_config();
tli_layer_enable(LAYER0);
tli_reload_config(TLI_FRAME_BLANK_RELOAD_EN);
tli_enable();
_lcd_info.bits_per_pixel = LCD_BITS_PER_PIXEL;
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;
_lcd_info.framebuffer = (void *)_rt_framebuffer;
_lcd_info.width = RT_HW_LCD_WIDTH;
_lcd_info.height = RT_HW_LCD_HEIGHT;
lcd.type = RT_Device_Class_Graphic;
lcd.init = NULL;
lcd.open = NULL;
lcd.close = NULL;
lcd.read = NULL;
lcd.write = NULL;
lcd.control = rt_lcd_control;
lcd.user_data = (void *)&_lcd_info;
/* register lcd device to RT-Thread */
rt_device_register(&lcd, "lcd", RT_DEVICE_FLAG_RDWR);
return 0;
}
开发者ID:Alexlcb,项目名称:rt-thread,代码行数:32,代码来源:drv_lcd.c
示例5: rt_hw_lcd_init
/* LCD BL P5_4 */
void rt_hw_lcd_init(void)
{
rt_uint16_t * _rt_framebuffer = RT_NULL;
// _rt_framebuffer = rt_malloc_align(sizeof(rt_uint16_t)*RT_HW_LCD_HEIGHT*RT_HW_LCD_WIDTH, 8);
// if (_rt_framebuffer == RT_NULL) return; /* no memory yet */
_rt_framebuffer = (rt_uint16_t *)0xA0000000;
_lcd_info.bits_per_pixel = 16;
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;
_lcd_info.framebuffer = (void*)_rt_framebuffer;
_lcd_info.width = RT_HW_LCD_WIDTH;
_lcd_info.height = RT_HW_LCD_HEIGHT;
/* init device structure */
lcd.type = RT_Device_Class_Graphic;
lcd.init = rt_lcd_init;
lcd.open = RT_NULL;
lcd.close = RT_NULL;
lcd.control = rt_lcd_control;
lcd.user_data = (void*)&_lcd_info;
/* register lcd device to RT-Thread */
rt_device_register(&lcd, "lcd", RT_DEVICE_FLAG_RDWR);
}
开发者ID:304471720,项目名称:rt-thread,代码行数:27,代码来源:lpc17xx_lcd.c
示例6: rt_hw_console_init
/**
* This function initializes console
*
*/
void rt_hw_console_init(void)
{
rt_cga_init();
rt_serial_init();
init_keyboard();
/* install keyboard isr */
rt_hw_interrupt_install(INTKEYBOARD, rt_console_isr, RT_NULL, "kbd");
rt_hw_interrupt_umask(INTKEYBOARD);
rt_hw_interrupt_install(INTUART0_RX, rt_console_isr, RT_NULL, "COM1");
rt_hw_interrupt_umask(INTUART0_RX);
console_device.type = RT_Device_Class_Char;
console_device.rx_indicate = RT_NULL;
console_device.tx_complete = RT_NULL;
console_device.init = rt_console_init;
console_device.open = rt_console_open;
console_device.close = rt_console_close;
console_device.read = rt_console_read;
console_device.write = rt_console_write;
console_device.control = rt_console_control;
console_device.user_data = RT_NULL;
/* register a character device */
rt_device_register(&console_device,
"console",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
}
开发者ID:heyuanjie87,项目名称:rt-thread,代码行数:33,代码来源:console.c
示例7: rt_hw_dc_init
void rt_hw_dc_init(void)
{
rt_device_t dc = rt_malloc(sizeof(struct rt_device));
if (dc == RT_NULL)
{
rt_kprintf("dc == RT_NULL\n");
return; /* no memory yet */
}
_dc_info.bits_per_pixel = 16;
_dc_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
_dc_info.framebuffer = (rt_uint8_t*)HW_FB_ADDR;
_dc_info.width = FB_XSIZE;
_dc_info.height = FB_YSIZE;
/* init device structure */
dc->type = RT_Device_Class_Graphic;
dc->init = rt_dc_init;
dc->open = RT_NULL;
dc->close = RT_NULL;
dc->control = rt_dc_control;
dc->user_data = (void*)&_dc_info;
/* register Display Controller device to RT-Thread */
rt_device_register(dc, "dc", RT_DEVICE_FLAG_RDWR);
}
开发者ID:304471720,项目名称:rt-thread,代码行数:26,代码来源:display_controller.c
示例8: fm25_hw_init
void fm25_hw_init()
{
int i = 0xFFFFF;
fm25_spi_cfg();
while(i--);
//spi_config();
CS_LOW();
spi_readwrite( FM25_WRDI );
CS_HIGH();
spi_flash_device.type = RT_Device_Class_Block;
spi_flash_device.init = fm25_init;
spi_flash_device.open = fm25_open;
spi_flash_device.close = fm25_close;
spi_flash_device.read = fm25_read;
spi_flash_device.write = fm25_write;
spi_flash_device.control = fm25_control;
/* no private */
spi_flash_device.user_data = RT_NULL;
rt_device_register(&spi_flash_device, "fram0",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);
}
开发者ID:304471720,项目名称:rt-thread,代码行数:25,代码来源:FM25Lx.c
示例9: rt_hw_rtc_init
void rt_hw_rtc_init(void)
{
rtc.type = RT_Device_Class_RTC;
RTC_Init(LPC_RTC);
if (RTC_ReadGPREG(LPC_RTC,0) != FIRST_DATA)
{
rt_kprintf("rtc is not configured\n");
rt_kprintf("please configure with set_date and set_time\n");
}
else
{
}
RTC_Cmd(LPC_RTC,ENABLE);
/* register rtc device */
rtc.init = RT_NULL;
rtc.open = rt_rtc_open;
rtc.close = RT_NULL;
rtc.read = rt_rtc_read;
rtc.write = RT_NULL;
rtc.control = rt_rtc_control;
/* no private */
rtc.user_data = RT_NULL;
rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
#ifdef RT_USING_FINSH
{
extern void list_date(void);
list_date();
}
#endif
return;
}
开发者ID:TAURUS3G,项目名称:RealBoard4088,代码行数:35,代码来源:drv_rtc.c
示例10: rt_hw_lcd_init
int rt_hw_lcd_init(const char *name)
{
struct lcd_device *dev;
if(rt_device_find(name))
{
return -RT_EIO;
}
dev = rt_malloc(sizeof(struct lcd_device));
if(!dev)
{
return RT_ENOMEM;
}
dev->rtdev.type = RT_Device_Class_Graphic;
dev->rtdev.rx_indicate = RT_NULL;
dev->rtdev.init = rt_lcd_init;
dev->rtdev.open = RT_NULL;
dev->rtdev.close = RT_NULL;
dev->rtdev.read = RT_NULL;
dev->rtdev.write = RT_NULL;
dev->rtdev.control = rt_lcd_control;
dev->rtdev.user_data = RT_NULL;
/* initialize mutex */
rt_mutex_init(&dev->lock, name, RT_IPC_FLAG_FIFO);
rt_device_register(&dev->rtdev, name, RT_DEVICE_FLAG_RDWR);
return RT_EOK;
}
开发者ID:yanbib,项目名称:smartcar,代码行数:31,代码来源:drv_lcd.c
示例11: RS485_init
/*RS485设备初始化*/
void RS485_init( void )
{
//rt_sem_init( &sem_RS485, "sem_RS485", 0, 0 );
rt_mq_init( &mq_RS485, "mq_RS485", &RS485_rawinfo[0], 128 - sizeof( void* ), RS485_RAWINFO_SIZE, RT_IPC_FLAG_FIFO );
dev_RS485.type = RT_Device_Class_Char;
dev_RS485.init = dev_RS485_init;
dev_RS485.open = dev_RS485_open;
dev_RS485.close = dev_RS485_close;
dev_RS485.read = dev_RS485_read;
dev_RS485.write = dev_RS485_write;
dev_RS485.control = dev_RS485_control;
rt_device_register( &dev_RS485, "RS485", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE );
rt_device_init( &dev_RS485 );
Cam_Device_init( );
rt_thread_init( &thread_RS485,
"RS485",
rt_thread_entry_RS485,
RT_NULL,
&thread_RS485_stack[0],
sizeof( thread_RS485_stack ), 9, 5 );
rt_thread_startup( &thread_RS485 );
}
开发者ID:mildrock,项目名称:705_1,代码行数:26,代码来源:rs485.c
示例12: sdlfb_hw_init
static void sdlfb_hw_init(void)
{
/* set video driver for VC++ debug */
//_putenv("SDL_VIDEODRIVER=windib");
//if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0)
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
_device.parent.init = sdlfb_init;
_device.parent.open = sdlfb_open;
_device.parent.close = sdlfb_close;
_device.parent.read = RT_NULL;
_device.parent.write = RT_NULL;
_device.parent.control = sdlfb_control;
_device.width = SDL_SCREEN_WIDTH;
_device.height = SDL_SCREEN_HEIGHT;
_device.screen = SDL_SetVideoMode(_device.width, _device.height, 16, SDL_SWSURFACE | SDL_DOUBLEBUF);
if (_device.screen == NULL)
{
fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
exit(1);
}
SDL_WM_SetCaption("RT-Thread/GUI Simulator", NULL);
rt_device_register(RT_DEVICE(&_device), "sdl", RT_DEVICE_FLAG_RDWR);
sdllock = rt_mutex_create("fb", RT_IPC_FLAG_FIFO);
}
开发者ID:634351070,项目名称:rt-thread,代码行数:33,代码来源:sdl_fb.c
示例13: stm32_hw_lcd_init
int stm32_hw_lcd_init(void)
{
_rt_framebuffer = rt_malloc_align(sizeof(rt_uint16_t) * RT_HW_LCD_WIDTH * RT_HW_LCD_HEIGHT, 32);
if (_rt_framebuffer == RT_NULL)
return -1; /* no memory yet */
LTDC_CLK_Config();
MX_LTDC_Init();
lcd_backlight_init();
MX_DMA2D_Init();
_lcd_info.bits_per_pixel = LCD_BITS_PER_PIXEL;
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565; // RTGRAPHIC_PIXEL_FORMAT_ARGB888
_lcd_info.framebuffer = (void *)_rt_framebuffer;
_lcd_info.width = RT_HW_LCD_WIDTH;
_lcd_info.height = RT_HW_LCD_HEIGHT;
/* init device structure */
lcd.type = RT_Device_Class_Graphic;
lcd.init = rt_lcd_init;
lcd.open = rt_lcd_open;
lcd.close = rt_lcd_close;
lcd.read = NULL;
lcd.write = NULL;
lcd.control = rt_lcd_control;
lcd.user_data = (void *)&_lcd_info;
/* register lcd device to RT-Thread */
rt_device_register(&lcd, "lcd", RT_DEVICE_FLAG_RDWR);
return 0;
}
开发者ID:onelife,项目名称:rt-thread,代码行数:32,代码来源:drv_lcd.c
示例14: ads7843_init
rt_err_t ads7843_init(const char * name, const char * spi_device_name)
{
rt_spi_device = (struct rt_spi_device *)rt_device_find(spi_device_name);
if(rt_spi_device == RT_NULL)
{
rt_kprintf("spi device %s not found!\r\n", spi_device_name);
return -RT_ENOSYS;
}
/* config spi */
{
struct rt_spi_configuration cfg;
cfg.data_width = 8;
cfg.mode = RT_SPI_MODE_0 | RT_SPI_MSB; /* SPI Compatible: Mode 0 and Mode 3 */
cfg.max_hz = 2 * 1000 * 1000;
rt_spi_configure(rt_spi_device, &cfg);
}
/* register device */
ads7843_device.type = RT_Device_Class_Block;
ads7843_device.init = RT_NULL;
ads7843_device.open = RT_NULL;
ads7843_device.close = RT_NULL;
ads7843_device.read = ads7843_read;
ads7843_device.write = RT_NULL;
ads7843_device.control = RT_NULL;
/* no private */
ads7843_device.user_data = RT_NULL;
rt_device_register(&ads7843_device, name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);
return RT_EOK;
}
开发者ID:guzhaoyuan,项目名称:smartCar,代码行数:35,代码来源:drv_ads7843.c
示例15: rt_hw_sd_mmc_init
void rt_hw_sd_mmc_init()
{
if (sd_mmc_spi_internal_init())
{
rt_uint8_t *sector = rt_malloc(MMC_SECTOR_SIZE);
sd_mmc_spi_read_open(0);
if (sd_mmc_spi_read_sector_to_ram(sector))
{
if (dfs_filesystem_get_partition(&sd_mmc_partition, sector, 0) != RT_EOK)
{
sd_mmc_partition.offset = 0;
sd_mmc_partition.size = 0;
}
}
else
{
sd_mmc_partition.offset = 0;
sd_mmc_partition.size = 0;
}
sd_mmc_spi_read_close();
rt_free(sector);
rt_device_register(&sd_mmc_device, "sd0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
}
else
{
rt_kprintf("Failed to initialize SD/MMC card.\n");
}
}
开发者ID:ceecer2,项目名称:avr32-hifi-player,代码行数:29,代码来源:sd_mmc.c
示例16: rt_hw_rtc_init
void rt_hw_rtc_init(void)
{
rtc.type = RT_Device_Class_RTC;
if (BKP_ReadBackupRegister(BKP_DR1) != 0xA5A5)
{
rt_kprintf("rtc is not configured\n");
rt_kprintf("please configure with set_date and set_time\n");
if ( RTC_Configuration() != 0)
{
rt_kprintf("rtc configure fail...\r\n");
return ;
}
}
else
{
/* Wait for RTC registers synchronization */
RTC_WaitForSynchro();
}
/* register rtc device */
rtc.init = RT_NULL;
rtc.open = rt_rtc_open;
rtc.close = RT_NULL;
rtc.read = rt_rtc_read;
rtc.write = RT_NULL;
rtc.control = rt_rtc_control;
/* no private */
rtc.user_data = RT_NULL;
rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
return;
}
开发者ID:nodeboy,项目名称:nodeboyRepo,代码行数:34,代码来源:rtc.c
示例17: rt_hw_console_init
void rt_hw_console_init(void)
{
struct rt_lm3s_serial* serial;
serial = &serial1;
serial->parent.type = RT_Device_Class_Char;
serial->hw_base = UART0_BASE;
serial->baudrate = 115200;
rt_memset(serial->rx_buffer, 0, sizeof(serial->rx_buffer));
serial->read_index = serial->save_index = 0;
/* enable UART0 clock */
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
/* set UART0 pinmux */
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
/* Configure the UART for 115,200, 8-N-1 operation. */
MAP_UARTConfigSetExpClk(UART0_BASE, MAP_SysCtlClockGet(), serial->baudrate, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
serial->parent.init = rt_serial_init;
serial->parent.open = rt_serial_open;
serial->parent.close = rt_serial_close;
serial->parent.read = rt_serial_read;
serial->parent.write = rt_serial_write;
serial->parent.control = rt_serial_control;
serial->parent.user_data= RT_NULL;
rt_device_register(&serial->parent, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
}
开发者ID:comrid1987,项目名称:jb3500,代码行数:34,代码来源:serial.c
示例18: rt_hw_serial_register
/*
* serial register
*/
rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
const char *name,
rt_uint32_t flag,
void *data)
{
struct rt_device *device;
RT_ASSERT(serial != RT_NULL);
device = &(serial->parent);
device->type = RT_Device_Class_Char;
device->rx_indicate = RT_NULL;
device->tx_complete = RT_NULL;
device->init = rt_serial_init;
device->open = rt_serial_open;
device->close = rt_serial_close;
device->read = rt_serial_read;
device->write = rt_serial_write;
device->control = rt_serial_control;
device->user_data = data;
/* register a character device */
return rt_device_register(device, name, flag);
}
开发者ID:CHINAoneBOY,项目名称:rt-thread-stm32f405-enc28j60-,代码行数:28,代码来源:serial.c
示例19: rt_hw_usart_register
/***************************************************************************//**
* @brief
* Register USART device
*
* @details
*
* @note
*
* @param[in] device
* Pointer to device descriptor
*
* @param[in] name
* Device name
*
* @param[in] flag
* Configuration flags
*
* @param[in] usart
* Pointer to USART device descriptor
*
* @return
* Error code
******************************************************************************/
rt_err_t rt_hw_usart_register(
rt_device_t device,
const char *name,
rt_uint32_t flag,
struct efm32_usart_device_t *usart)
{
RT_ASSERT(device != RT_NULL);
if ((flag & RT_DEVICE_FLAG_DMA_RX) ||
(flag & RT_DEVICE_FLAG_INT_TX))
{
RT_ASSERT(0);
}
if (usart->state & USART_STATE_SYNC)
{
device->type = RT_Device_Class_SPIBUS;
}
else
{
device->type = RT_Device_Class_Char;
}
device->rx_indicate = RT_NULL;
device->tx_complete = RT_NULL;
device->init = rt_usart_init;
device->open = rt_usart_open;
device->close = rt_usart_close;
device->read = rt_usart_read;
device->write = rt_usart_write;
device->control = rt_usart_control;
device->user_data = usart;
/* register a character device */
return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
}
开发者ID:hduffddybz,项目名称:rt-thread,代码行数:58,代码来源:drv_usart.c
示例20: rt_hw_iic_register
/***************************************************************************//**
* @brief
* Register IIC device
*
* @details
*
* @note
*
* @param[in] device
* Pointer to device descriptor
*
* @param[in] name
* Device name
*
* @param[in] flag
* Configuration flags
*
* @param[in] iic
* Pointer to IIC device descriptor
*
* @return
* Error code
******************************************************************************/
rt_err_t rt_hw_iic_register(
rt_device_t device,
const char *name,
rt_uint32_t flag,
struct efm32_iic_device_t *iic)
{
RT_ASSERT(device != RT_NULL);
if ((flag & RT_DEVICE_FLAG_DMA_TX) || (flag & RT_DEVICE_FLAG_DMA_RX) ||
(flag & RT_DEVICE_FLAG_INT_TX))
{
RT_ASSERT(0);
}
device->type = RT_Device_Class_Unknown;
device->rx_indicate = RT_NULL;
device->tx_complete = RT_NULL;
device->init = rt_iic_init;
device->open = rt_iic_open;
device->close = rt_iic_close;
device->read = rt_iic_read;
device->write = rt_iic_write;
device->control = rt_iic_control;
device->user_data = iic;
/* register a character device */
return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
}
开发者ID:304471720,项目名称:rt-thread,代码行数:51,代码来源:drv_iic.c
注:本文中的rt_device_register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论