STM32_杂_01_串口代码

时间:2023-02-14 22:05:11
 #include "stm32f10x.h"
#include "serial.h"
#include "rtthread.h"
#include <rtdevice.h>
/***********************************************************************************************************
@ pin config USART1_REMAP = 0
@____________________________________________________________________________*/ #define UART1_GPIO_TX GPIO_Pin_9
#define UART1_GPIO_RX GPIO_Pin_10
#define UART1_GPIO GPIOA
#define RCC_APBPeriph_UART1 RCC_APB2Periph_USART1
#define UART1_TX_DMA DMA1_Channel4
#define UART1_RX_DMA DMA1_Channel5 /***********************************************************************************************************
@ Struct Definition
@____________________________________________________________________________*/
struct serial_ringbuffer serial_int_rx_buffer;
struct serial_ringbuffer serial_int_tx_buffer;
struct rt_serial_device serialx_device;
struct serial_user_data
{
USART_TypeDef* uart_device;
const char name[RT_NAME_MAX];
}; /***********************************************************************************************************
@ Hardware clock configuration
@____________________________________________________________________________*/
static void RCC_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); /* Enable USART1 and GPIOA clocks */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE); } static void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; /* Configure USART1 Rx (PA.10) as input floating */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); /* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_TX;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); } static void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure; /* Enable the USART1 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = ;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); } /***********************************************************************************************************
@ model driven architecture interface
@____________________________________________________________________________*/
int serial_put_char(struct rt_serial_device *serial, char c)
{
USART_ClearFlag(USART1,USART_FLAG_TC);
USART_SendData(USART1, (u8) c);
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
return c;
} int serial_get_char(struct rt_serial_device *serial)
{
int ch = -;
struct serial_user_data* user = (struct serial_user_data *)(serial->parent.user_data); if(USART_GetITStatus(user->uart_device, USART_IT_RXNE) != RESET)
{
/* interrupt mode receive */
RT_ASSERT(serial->parent.flag & RT_DEVICE_FLAG_INT_RX); ch = USART_ReceiveData(user->uart_device); /* clear interrupt */
USART_ClearITPendingBit(user->uart_device, USART_IT_RXNE);
}
return ch;
} rt_err_t serial_control(struct rt_serial_device *serial, int cmd, void *arg)
{
u16 int_flag; //interrupt flag
FunctionalState NewState;
struct serial_user_data *user = (struct serial_user_data *)serial->parent.user_data; switch(*(rt_uint32_t *)arg)
{
case RT_SERIAL_RX_INT:
{
int_flag = USART_IT_RXNE;
break;
}
case RT_SERIAL_TX_INT:
{
int_flag = USART_IT_TC;
break;
}
default :
{
break;
}
} switch(cmd)
{
case RT_DEVICE_CTRL_SET_INT:
{
NewState = ENABLE;
break;
}
case RT_DEVICE_CTRL_CLR_INT:
{
NewState = DISABLE;
break;
}
default:
{
break;
}
}
USART_ITConfig(user->uart_device, int_flag, NewState);
} rt_size_t serial_dma_transmit(struct rt_serial_device *serial, const char *buf, rt_size_t size)
{ }
/***********************************************************************************************************
@Struct declaration
@____________________________________________________________________________*/
struct serial_configure serial_config =
{
,
,
,
,
,
, };
struct serial_user_data serial_user_struct=
{
USART1,
"usart1"
};
rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg);
struct rt_uart_ops serial_ops =
{
stm32_serial_config,
serial_control,
serial_put_char,
serial_get_char,
serial_dma_transmit
}; rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg)
{
USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
struct serial_user_data* user = (struct serial_user_data *)serial->parent.user_data; RCC_Configuration(); GPIO_Configuration(); NVIC_Configuration();
/*
serial->config = serial_config;
serial->int_rx = &serial_int_rx_buffer;
serial->int_tx = &serial_int_tx_buffer;
serial->ops = &serial_ops;
*/
USART_InitStructure.USART_BaudRate = ;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(user->uart_device, &USART_InitStructure);
USART_ClockInit(user->uart_device, &USART_ClockInitStructure); // rt_hw_serial_register(serial, user->name,
// RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
// user); /* enable interrupt */
USART_ITConfig(user->uart_device, USART_IT_RXNE, ENABLE); return RT_EOK;
} void rt_hw_usart2_init(void)
{
/* USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure; RCC_Configuration(); GPIO_Configuration(); NVIC_Configuration();
*/
serialx_device.config = serial_config;
serialx_device.int_rx = &serial_int_rx_buffer;
serialx_device.int_tx = &serial_int_tx_buffer;
serialx_device.ops = &serial_ops;
/*
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(serial_user_struct.uart_device, &USART_InitStructure);
USART_ClockInit(serial_user_struct.uart_device, &USART_ClockInitStructure); */
rt_hw_serial_register(&serialx_device, serial_user_struct.name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&serial_user_struct); /* enable interrupt */
//USART_ITConfig(serial_user_struct.uart_device, USART_IT_RXNE, ENABLE); //stm32_serial_config(&serialx_device,&serial_config);
}

下面是第二份代码:

 #include "stm32f10x.h"
#include "serial.h"
#include "rtthread.h"
#include <rtdevice.h>
/***********************************************************************************************************
@ pin config USART1_REMAP = 0
@____________________________________________________________________________*/ /* USART1_REMAP = 0 */
#define UART1_GPIO_TX GPIO_Pin_9
#define UART1_GPIO_RX GPIO_Pin_10
#define UART1_GPIO GPIOA
#define RCC_APBPeriph_UART1 RCC_APB2Periph_USART1
#define USART1_TX_DMA DMA1_Channel4
#define USART1_RX_DMA DMA1_Channel5 #if defined(STM32F10X_LD) || defined(STM32F10X_MD) || defined(STM32F10X_CL)
#define UART2_GPIO_TX GPIO_Pin_5
#define UART2_GPIO_RX GPIO_Pin_6
#define UART2_GPIO GPIOD
#define RCC_APBPeriph_UART2 RCC_APB1Periph_USART2
#else /* for STM32F10X_HD */
/* USART2_REMAP = 0 */
#define UART2_GPIO_TX GPIO_Pin_2
#define UART2_GPIO_RX GPIO_Pin_3
#define UART2_GPIO GPIOA
#define RCC_APBPeriph_UART2 RCC_APB1Periph_USART2
#define UART2_TX_DMA DMA1_Channel7
#define UART2_RX_DMA DMA1_Channel6
#endif /* USART3_REMAP[1:0] = 00 */
#define UART3_GPIO_RX GPIO_Pin_11
#define UART3_GPIO_TX GPIO_Pin_10
#define UART3_GPIO GPIOB
#define RCC_APBPeriph_UART3 RCC_APB1Periph_USART3
#define UART3_TX_DMA DMA1_Channel2
#define UART3_RX_DMA DMA1_Channel3 /***********************************************************************************************************
@ Struct Definition
@____________________________________________________________________________*/
struct serial_user_data
{
USART_TypeDef* uart_device;
const char name[RT_NAME_MAX];
}; /***********************************************************************************************************
@ Hardware clock configuration
@____________________________________________________________________________*/
static void RCC_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); /* Enable USART1 and GPIOA clocks */
RCC_APB2PeriphClockCmd(RCC_APBPeriph_UART1 | RCC_APB2Periph_GPIOA, ENABLE); /* Enable AFIO and GPIOD clock */
RCC_APB1PeriphClockCmd(RCC_APBPeriph_UART2, ENABLE); } static void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; /* Configure USART1 Rx (PA.10) as input floating */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); /* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_TX;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); /* Configure USART2 Rx as input floating */
GPIO_InitStructure.GPIO_Pin = UART2_GPIO_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(UART2_GPIO, &GPIO_InitStructure); /* Configure USART2 Tx as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = UART2_GPIO_TX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(UART2_GPIO, &GPIO_InitStructure); } static void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure; /* Enable the USART1 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = ;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); /* Enable the USART2 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = ;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); } static void DMA_Configuration(void)
{
#if defined (RT_USING_UART3)
DMA_InitTypeDef DMA_InitStructure; /* fill init structure */
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; /* DMA1 Channel5 (triggered by USART3 Tx event) Config */
DMA_DeInit(UART3_TX_DMA);
DMA_InitStructure.DMA_PeripheralBaseAddr = USART3_DR_Base;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
/* As we will set them before DMA actually enabled, the DMA_MemoryBaseAddr
* and DMA_BufferSize are meaningless. So just set them to proper values
* which could make DMA_Init happy.
*/
DMA_InitStructure.DMA_MemoryBaseAddr = (u32);
DMA_InitStructure.DMA_BufferSize = ;
DMA_Init(UART3_TX_DMA, &DMA_InitStructure);
DMA_ITConfig(UART3_TX_DMA, DMA_IT_TC | DMA_IT_TE, ENABLE);
DMA_ClearFlag(DMA1_FLAG_TC2);
#endif
} /***********************************************************************************************************
@ model driven architecture interface
@____________________________________________________________________________*/
rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg); int serial_put_char(struct rt_serial_device *serial, char c)
{
struct serial_user_data* user = (struct serial_user_data *)(serial->parent.user_data); USART_ClearFlag(user->uart_device,USART_FLAG_TC);
USART_SendData(user->uart_device, c);
while (USART_GetFlagStatus(user->uart_device, USART_FLAG_TC) == RESET); return c;
} int serial_get_char(struct rt_serial_device *serial)
{
int ch = -;
struct serial_user_data* user = (struct serial_user_data *)(serial->parent.user_data); if(USART_GetITStatus(user->uart_device, USART_IT_RXNE) != RESET)
{
/* interrupt mode receive */
RT_ASSERT(serial->parent.flag & RT_DEVICE_FLAG_INT_RX); ch = USART_ReceiveData(user->uart_device); /* clear interrupt */
USART_ClearITPendingBit(user->uart_device, USART_IT_RXNE);
}
return ch;
} rt_err_t serial_control(struct rt_serial_device *serial, int cmd, void *arg)
{
FunctionalState NewState; struct serial_user_data *user = (struct serial_user_data *)serial->parent.user_data; switch(cmd)
{
case RT_DEVICE_CTRL_SET_INT:
{
NewState = ENABLE;
break;
}
case RT_DEVICE_CTRL_CLR_INT:
{
NewState = DISABLE;
break;
}
default:
{
break;
}
} switch(*(rt_uint32_t *)arg)
{
case RT_SERIAL_RX_INT:
{
USART_ITConfig(user->uart_device, USART_IT_RXNE, NewState);
break;
}
case RT_SERIAL_TX_INT:
{
USART_ITConfig(user->uart_device, USART_IT_TC, NewState);
break;
}
default :
{
break;
}
} return RT_EOK;
} rt_size_t serial_dma_transmit(struct rt_serial_device *serial, const char *buf, rt_size_t size)
{
return size;
} rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg)
{
USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
struct serial_user_data* user = (struct serial_user_data *)serial->parent.user_data; RCC_Configuration();
GPIO_Configuration();
NVIC_Configuration();
DMA_Configuration(); USART_InitStructure.USART_BaudRate = cfg->baud_rate; switch(cfg->data_bits)
{
case :
{
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
break;
}
case :
{
USART_InitStructure.USART_WordLength = USART_WordLength_9b;
break;
}
default :
{
#ifndef RT_USING_FINSH
rt_kprintf("data bit set error\n");
#endif
break;
}
} switch(cfg->stop_bits)
{
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_1;
break;
}
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_2;
break;
}
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_0_5;
break;
}
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_1_5;
break;
}
default :
{
#ifndef RT_USING_FINSH
rt_kprintf("stopbits bit set error\n");
#endif
break;
}
} switch(cfg->parity)
{
case :
{
USART_InitStructure.USART_Parity = USART_Parity_No;
break;
}
case :
{
USART_InitStructure.USART_Parity = USART_Parity_Odd;
break;
}
case :
{
USART_InitStructure.USART_Parity = USART_Parity_Even;
break;
}
default :
{
#ifndef RT_USING_FINSH
rt_kprintf("data bit set error\n");
#endif
break;
}
} USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(user->uart_device, &USART_InitStructure);
USART_ClockInit(user->uart_device, &USART_ClockInitStructure); /* enable interrupt */
USART_ITConfig(user->uart_device, USART_IT_RXNE, ENABLE); return RT_EOK;
} /***********************************************************************************************************
@serial private function
@____________________________________________________________________________*/
struct rt_uart_ops serial_ops =
{
stm32_serial_config,
serial_control,
serial_put_char,
serial_get_char,
serial_dma_transmit
};
/***********************************************************************************************************
@Struct declaration
@____________________________________________________________________________*/
struct serial_configure serial_config =
{
, //USART_BaudRate
, //USART_WordLength
, //USART_StopBits
, //USART_Parity
, //
, //
//
};
struct serial_user_data serial_user_struct =
{
USART2, //hardware device
"uart2" //device name
};
struct serial_ringbuffer serial_int_rx_buffer;
struct serial_ringbuffer serial_int_tx_buffer;
struct rt_serial_device serialx_device; void rt_hw_serialx_register(void)
{
serialx_device.config = serial_config;
serialx_device.int_rx = &serial_int_rx_buffer;
serialx_device.int_tx = &serial_int_tx_buffer;
serialx_device.ops = &serial_ops; rt_hw_serial_register(&serialx_device, serial_user_struct.name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&serial_user_struct);
} struct serial_user_data serial_user_struct1 =
{
USART1, //hardware device
"uart1" //device name
};
struct rt_serial_device serialx_device1;
struct serial_ringbuffer serial_int_rx_buffer1;
struct serial_ringbuffer serial_int_tx_buffer1;
void rt_hw_serialx_register1(void)
{
serialx_device1.config = serial_config;
serialx_device1.int_rx = &serial_int_rx_buffer1;
serialx_device1.int_tx = &serial_int_tx_buffer1;
serialx_device1.ops = &serial_ops; rt_hw_serial_register(&serialx_device1, serial_user_struct1.name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&serial_user_struct1);
} #ifdef RT_USING_FINSH
#include <finsh.h>
static rt_uint8_t led_inited = ;
void usarts2(char *str)
{
rt_device_t usart; usart = rt_device_find("uart2");
rt_device_write(usart,,str,);
}
FINSH_FUNCTION_EXPORT(usarts2,str)
#endif

STM32_杂_01_串口代码的更多相关文章

  1. 没有真实串口设备时使用&quot&semi;虚拟串口驱动&quot&semi;调试你的串口代码

    目录 前言 示例代码 总结 前言 很多时候需要编写串口代码,但是又没有真实串口设备来调试代码.以及本身就是要操作2个串口的情况,可以使用"虚拟串口驱动"工具方便的调试代码. 使用方 ...

  2. 低功耗蓝牙4&period;0BLE编程-nrf51822开发&lpar;11&rpar;-蓝牙串口代码分析

    代码实例:点击打开链接 实现的功能是从uart口发送数据至另一个蓝牙串口,或是从蓝牙读取数据通过uart打印出数据. int main(void) { // Initialize leds_init( ...

  3. u-boot移植(六)---代码修改---串口

    一.代码流程 1.1 串口代码 程序流程图如下: default_serial_console 执行的代码如下: 在JZ2440.H中有如下定义: 则执行结构体s3c24xx_serial0_devi ...

  4. linux串口编程&lpar;c&rpar;

    //linux c: 串口设置//串口操作无非以下几个://1 打开                       //2 设置串口属性//3 read write //struct termios能够 ...

  5. ASP&period;NET&bsol;MVC 解决C&num;上传图片质量下降,图片模糊,水印有杂点的问题

    对图片处理这一块不是很懂,自己写不出来,这些年一直没有停止找一个上传图片质量不下降,加水印不会导致模糊和水印周边产生杂点的代码. 网上基本上99.9%的代码处理图片质量都是下面这两句: //设置质量 ...

  6. Android串口通讯

    今天在整一个项目,需要利用串口通讯在网上看了好多人的帖子才稍微整出了一点头绪. 首先串口代码就是利用谷歌自己的api,将java代码放在java/android_serialport_api目录下,如 ...

  7. 【接口时序】3、UART串口收发的原理与Verilog实现

    一.软件平台与硬件平台 软件平台: 1.操作系统:Windows-8.1 2.开发套件:ISE14.7 3.仿真工具:ModelSim-10.4-SE 硬件平台: 1.FPGA型号:XC6SLX45- ...

  8. ubuntu下irobot串口通讯

    在window下以前就`有一个现成的串口代码.想移植到ubuntu下,发现都不一样了.要重新找个. 折腾了一上午之后,发现自己写这个串口通讯还是有一点难度. 于是,用了github上 Erick Co ...

  9. 【转】如何在VC下检测当前存在的串口及串口热拔插

    当我们在用VS进行串口编程时,在打开串口前,经常想知道当前PC上存在多少个串口,哪些串口可用?哪些串口已经打开了,最好是在一个Combo Box中列表系统当前所有可用的串口以供选择,然而如何获取系统当 ...

随机推荐

  1. jQuery之DOM属性

    1. .addClass()方法:为每个匹配的元素添加指定的样式类名.值得注意的是设个方法不会替换一个样式类名.他只是简单的添加一个样式类名到元素上.对所有匹配的元素可以一次添加多个用空格隔开的样式类 ...

  2. 在Unity中创建可远程加载的&period;unity3d包

    在一个Unity项目中,发布包本身不一定要包括所有的Asset(译为资产或组件),其它的部分可以单独发布为.unity3d,再由程序从本地/远程加载执行,这部分不在本文讨论范围.虽然Unity并没有直 ...

  3. JAVA--网络编程(UDP)

    上午给大家简单介绍了一下TCP网络通信的知识,现在就为大家补充完整网络编程的知识,关于UDP的通信知识. UDP是一种不可靠的网络协议,那么还有什么使用价值或必要呢?其实不然,在有些情况下UDP协议可 ...

  4. Unity3d 防止内存修改工具的小方法

    一个非常简单的方法,直接上代码. private int curATK; private int curAtkKey; public int CurATK { get { return curATK ...

  5. ZOJ 1115 Digital Roots

    原题链接 题目大意:给一个数字,每一位相加求和,不断重复过程,直到剩一位数字. 解法:考虑到输入的数字可以很大,把输入按照字符串格式读入,再逐位处理. 参考代码: #include <iostr ...

  6. unshift&lpar;&rpar; 方法将一个或多个元素添加到数组的开头,并返回新数组的长度

    var arr = [1, 2]; arr.unshift(0); //result of call is 3, the new array length //arr is [0, 1, 2] arr ...

  7. Oracle 12c新特性&lpar;For DBA&rpar;

    一: Multitenant Architecture (12.1.0.1)      多租户架构是Oracle 12c(12.1)的新增重磅特性,内建的多分租(Multi-tenancy),一个容器 ...

  8. samba 使用tips

    安装: 推荐使用新立德包管理器安装 SAMBA配置文件: /etc/samba/smb.conf Samba服务器的启动与关闭: sudo /etc/init.d/smbd start ubuntu访 ...

  9. 在sys用户下执行的sql脚本创建了摁多个表和序列&comma; 怎么回退&quest;

    一个个删除, 暂时不会别的方法...

  10. 自动创建orcl表

    using System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Text; ...