自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 资源 (1)
  • 收藏
  • 关注

原创 allocator简单实现

allocator是c++标准库中用于管理内存的一个类。主要包括以下类方法:代码如下(来源于《STL源码剖析》):#ifndef _JJALLOC_#define _JJALLOC_#include //for placement new#include #include #include #include namespace JJ{ template

2017-07-28 16:07:10 759

原创 STL:: allocator之deallocate & destory的区别与联系

c++中的allocator是标准库中的一个类,负责内存分配管理。下面是《STL源码剖析》中一个简单allocator实现的部分源代码:deallocate: template inline void _deallocate(T* buffer) { ::operator delete(buffer); //为什么不用 delete [] ? ,operator

2017-07-28 14:34:30 2871 2

原创 数组方式赋值字符串及字面值常量赋值字符串的区别

c++实验笔记。数组赋值字符串时需要显示'\0',否则在某些时候会有问题。int main(){ const char a[] = {'a','v','b','b','\0'}; //数组需要显示的以\0结尾, //否则循环不会终止 const char b[] = "avbb";

2017-07-14 15:02:58 583

原创 c++ vector指针访问vector元素的方法

c++使用 vector指针访问vector元素时,不能简单的类似于c中数组和指针的方式。需要使用迭代器。int main(){ vector s; vector *p = &s; s.push_back(1); for (vector::iterator it = p->begin(); it != p->end(); it++) cout << *it<<endl; //

2017-07-12 10:28:02 41458 5

原创 c++ 大小写转换&&字符转数字

大小写转换&&字符转数字,实验笔记。int main(){ //其实就是对ASCii表的操作 string s; char a = 'a'; int b = a - '0'; //字符转成数字 int c = (int)a; //就是asc码十进制值,不加(int)也会隐式转 char d = a + 32; //转小写

2017-07-04 20:39:39 5543

原创 CC2630 TIMAC协议栈低功耗问题

项目功能: 采集5s数据发送——休眠5s——采集5s数据发送,循环往复平台: CC2630协议栈:timac_1_05_02_43299问题描述:  在休眠5s的过程中,整体电流在7,8ma,只比数据发送低1ma,这是不科学的。验证没有event在跑的时候是可以到3,400ua的电流消耗的(主要是板子上的传感器功耗)。看了TI的RTOS,TIMAC协议介

2017-06-19 20:28:54 3023 1

原创 CC2630选择内部32KHZ时钟

在进入standby模式前,需要确认设置LF clock。XOSC:外部的晶振作为时钟源RCOSC:内部RC电路作为时钟源在ccfg.c文件中,找到宏定义如下://#define SET_CCFG_MODE_CONF_SCLK_LF_OPTION             0x0        // Low frequency clock derive

2017-06-07 15:22:02 2955

原创 leetcode— 9. Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.class Solution {public: bool isPalindrome(int x) { int a, b, tmp;int i = 0; a = 0; b = (x); while (b > 0) //负数不是

2017-06-01 22:15:50 230

原创 嵌入式面试题

以下是我找嵌入式面试时遇到的一些问题,答案以后慢慢补充。1.incline和宏定义的区别2.const, volatile,static关键词作用3.linux自旋锁4.进程,线程的概念5.strcpy的使用6.双向链表的插入,删除7.大端小端8.写一段c程序检测cpu是32位还是64位9.

2017-05-27 09:52:28 715

原创 百度机试-度度熊回家

一个数轴上共有N个点,第一个点的坐标是度度熊现在位置,第N-1个点是度度熊的家。现在他需要依次的从0号坐标走到N-1号坐标。但是除了0号坐标和N-1号坐标,他可以在其余的N-2个坐标中选出一个点,并直接将这个点忽略掉,问度度熊回家至少走多少距离? 输入描述:输入一个正整数N, N <= 50。接下来N个整数表示坐标,正数表示X轴的正方向,负数表示X轴的负方向。绝对值小于等于

2017-05-04 20:41:32 598

原创 百度机试—买帽子

度度熊想去商场买一顶帽子,商场里有N顶帽子,有些帽子的价格可能相同。度度熊想买一顶价格第三便宜的帽子,问第三便宜的帽子价格是多少? 输入描述:首先输入一个正整数N(N 输出描述:如果存在第三便宜的帽子,请输出这个价格是多少,否则输出-1输入例子:1010 10 10 10 20 20 30 30 40 40输出例子:30

2017-05-04 15:04:34 486

转载 leetcode-6. ZigZag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I

2017-05-03 19:29:08 278

原创 leetcode-5. Longest Palindromic Substring

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.

2017-05-03 09:08:25 272

原创 leetcode-4. Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:nums1 =

2017-05-02 14:01:46 277

原创 leetcode-3. Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "

2017-04-27 19:33:50 200

原创 leetcode-2.Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i

2017-04-26 16:22:13 347

原创 leetcode-two sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sam

2017-04-24 20:19:52 301

原创 Cc26xx系列spi驱动失败的解决办法

Cc26xx系列spi驱动,本文是根据TI官方的develop's guide添加的驱动:添加完成后发现相关引脚没有波形产生,经过调试后,解决方法如下: 驱动定义中使用了static关键字,而Static定义的变量只在该.c文件中起作用。如果在一个.h文件中定义了static变量,同时有两个或以上的.c文件包含该h文件,则每个.c文件都会为该变量开辟存储空间,且这两

2016-11-28 13:25:45 2416

原创 室内定位综述

本篇文章是作者研究生毕设的前稿,每周更新补充,主要是中外关于室内定位的论文综述,偏向于TDOA方向,也会更新些其他的方向。-------有不当的地方欢迎有人指正♂^=^♀。2016.7.201.Contributed ReviewSource-localization algorithms and applications using timeofarrival

2016-07-20 21:29:25 4681 3

原创 matlab 串口读取设置

本例代码运行于 MATLAB2015b,参照网上的代码修改而成,可以自定义一次读取的数据,并做简单处理,随后绘图。实测可用、实用。%读串口% clear; clc;obj=serial('COM3');        %建立一个串口对象fopen(obj);                  %打开串口set(obj,'BaudRate', 115200,'ti

2016-03-14 20:33:52 6678

原创 cadence 17.0 生成钻孔文件 cam350打不开的问题解决

17.0生成钻孔文件后,cam350打不开。这时用记事本打开钻孔文件。对比发现相较于16.6的版本,多了以下一行红色高亮的的代码。将其删除就可以用cam350打开了。;LEADER: 12 ;HEADER: ;CODE  : ASCII ;FILE  : BottomBoard-1-bl-1-2.drl for  ... layers 1 and 2;DESIGN:

2015-11-27 16:50:32 6900

原创 cc2640 基于官方从机修改的通过手机实现蓝牙点灯例程

在TI官方从机例程中的simpleBLEPeripheral.c进行代码修改。添加引脚驱动头文件:添加全局变量:在从机任务函数中添加 led on之后的代码。这里的代码是进行led灯初始化,四灯全亮。如果只是硬件点灯,不需要手机进行控制,则不需要定义 ledhandle 这个变量。其实在

2015-11-27 11:19:38 3677 2

atmega128rfa1基础收发驱动

实现了atmega128rfa1基础收发驱动,选择性的屏蔽tx,rx函数可以选择接收还是发送。

2016-10-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除