资源简介
app 控制cortexM0和4412与两个ZigBee模块相互通信

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
//jni相关头文件
#include
#include “jni.h“
//串口相关头文件
#include
#include
//线程相关头文件
#include
//ASC 头文件
#include
#define LOG_TAG “strCommon_jni_log“
#define FALSE -1
#define TRUE 0
//存储M0回复数据buffer的大小
#define CallBuffSize 128
//串口设备文件描述符
static int fd;
//接收数据线程结束标志
int threadendflag = 0;
//存储回复数据
char callbackbuff[CallBuffSize]={0};
//-----------------------------------------------------------------------------------------------------------------------
//-----------------设置串口信息相关的操作
//-----------------------------------------------------------------------------------------------------------------------
int speed_arr[] = { B38400 B19200 B9600 B4800 B2400 B1200 B300B38400 B19200B115200 B9600 B4800 B2400 B1200 B300 };
int name_arr[] = {38400 19200 9600 4800 2400 1200 300 38400 19200 115200 9600 4800 2400 1200 300 };
void set_speed(int fd int speed){
int i;
int status;
struct termios Opt;
tcgetattr(fd &Opt);
for ( i= 0; i < sizeof(speed_arr) / sizeof(int); i++) {
if (speed == name_arr[i]) {
tcflush(fd TCIOFLUSH);
cfsetispeed(&Opt speed_arr[i]);
cfsetospeed(&Opt speed_arr[i]);
status = tcsetattr(fd TCSANOW &Opt);
if (status != 0) {
perror(“tcsetattr fd1“);
return;
}
tcflush(fdTCIOFLUSH);
}
}
}
int set_Parity(int fdint databitsint stopbitsint parity)
{
struct termios options;
if ( tcgetattr( fd&options) != 0) {
perror(“SetupSerial 1“);
return(FALSE);
}
options.c_cflag &= ~CSIZE;
switch (databits)
{
case 7:
options.c_cflag |= CS7;
break;
case 8:
options.c_cflag |= CS8;
break;
default:
fprintf(stderr“Unsupported data size\n“); return (FALSE);
}
switch (parity)
{
case ‘n‘:
case ‘N‘:
options.c_cflag &= ~PARENB; /* Clear parity enable */
options.c_iflag &= ~INPCK; /* Enable parity checking */
break;
case ‘o‘:
case ‘O‘:
options.c_cflag |= (PARODD | PARENB);
options.c_iflag |= INPCK; /* Disnable parity checking */
break;
case ‘e‘:
case ‘E‘:
options.c_cflag |= PARENB; /* Enable parity */
options.c_cflag &= ~PARODD;
options.c_iflag |= INPCK; /* Disnable parity checking */
break;
case ‘S‘:
case ‘s‘: /*as no parity*/
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;break;
default:
fprintf(stderr“Unsupported parity\n“);
return (FALSE);
}
switch (stopbits)
{
case 1:
options.c_cflag &= ~CSTOPB;
break;
case 2:
options.c_cflag |= CSTOPB;
break;
default:
fprintf(stderr“Unsupported stop bits\n“);
return (FALSE);
}
/* Set input parity option */
if (parity != ‘n‘)
options.c_iflag |= INPCK;
//---
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-07-04 17:57 M0-APP数据收发\
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\
文件 475 2016-06-28 09:03 M0-APP数据收发\JniStrTestV2\.classpath
文件 848 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\.project
文件 868 2016-06-28 09:02 M0-APP数据收发\JniStrTestV2\AndroidManifest.xm
目录 0 2016-07-23 13:25 M0-APP数据收发\JniStrTestV2\assets\
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\bin\
文件 868 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\AndroidManifest.xm
文件 391302 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\JniStrTestV2.apk
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\bin\classes\
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\bin\classes\com\
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jniNative\
文件 627 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jniNative\JniCommonNative.class
目录 0 2016-07-04 17:57 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\
文件 347 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\BuildConfig.class
文件 1393 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\JniStrMainActivity$1.class
文件 1641 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\JniStrMainActivity$2.class
文件 1650 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\JniStrMainActivity$3.class
文件 1494 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\JniStrMainActivity$RecvSendListener.class
文件 3830 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\JniStrMainActivity.class
文件 343 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$attr.class
文件 464 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$dimen.class
文件 410 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$drawable.class
文件 655 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$id.class
文件 414 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$layout.class
文件 399 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$menu.class
文件 475 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$string.class
文件 434 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R$st
文件 683 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes\com\ch\jnistrtestv1\R.class
文件 1035452 2016-07-03 21:37 M0-APP数据收发\JniStrTestV2\bin\classes.dex
............此处省略63个文件信息
- 上一篇:谷歌地图世界国家边界经纬度
- 下一篇:AES加密完整Verilog源码
相关资源
- IAR7.20H破解机注册机
- cc2530寄存器手册
- uboot到linux logo显示不间断 补丁
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- 课程设计蔬菜大棚自动控制系统,包
- linux下用多进程同步方法解决生产者
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
- linux实验报告及心得体会
- 基于GTK的Linux环境下的简易任务管理器
- linux扫雷游戏代码
- CAN Linux驱动代码
- Linux系统教材
- intel 82579LM 网卡驱动Linux系统版 v1.9.
评论
共有 条评论