Skip to content

Instantly share code, notes, and snippets.

View jannson's full-sized avatar
💭
I may be slow to respond.

Jason jannson

💭
I may be slow to respond.
View GitHub Profile
find . -path .svn -prune -o -name "*.[ch]" | grep -v ".svn"
find . -path .svn -prune -o -name "*.[ch]" | grep -v ".svn"
LNX=.
find $LNX -path "$LNX/arch/*" ! -path "$LNX/arch/x86*" -prune -o \
-path "$LNX/Documentation*" -prune -o \
-path "$LNX/scripts*" -prune -o \
-path "$LNX/drivers*" -prune -o \
-name "*.[chxsS]" -print > cscope.files
@jannson
jannson / imu.c
Created April 1, 2014 02:51
陀螺仪重力传感器融合代码
//=====================================================================================================
// IMU.c
// S.O.H. Madgwick
// 25th September 2010
//=====================================================================================================
// Description:
//
// Quaternion implementation of the 'DCM filter' [Mayhony et al].
//
// User must define 'halfT' as the (sample period / 2), and the filter gains 'Kp' and 'Ki'.
/** A simple kalman filter example by Adrian Boeing
www.adrianboeing.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double frand() {
return 2*((rand()/(double)RAND_MAX) - 0.5);
@jannson
jannson / mpu6050_dmp.c
Last active January 23, 2018 03:31
打开MPU6050的DMP功能,MPU6050能以400K的速率输出姿态数据(FIFO,一共42个字节);DMP有个好处, 不需要经过复杂的滤波过程,出来的数据,特别是四位元和YRP数据,是直接可用,而且效果比简化KALMAN滤波的要好和稳定,响应速度很快很快;
---------------------
/*****************************************************
http://bbs.cmnxt.com/thread-13197-1-1.html
Date : 2013-7-2
Author :
Chip type : ATmega16
Program type : Application
AVR Core Clock frequency: 16.000000 MHz
Memory model : Small
External RAM size : 0
@jannson
jannson / mem_cdev.c
Created May 8, 2014 07:10
字符设备驱动示例
/* http://blog.chinaunix.net/uid-28732854-id-3858242.html */
/*******************************memdev.h********************************/
#ifndef _MEMDEV_H_
#define _MEMDEV_H_
#ifndef MEMDEV_MAJOR
#define MEMDEV_MAJOR 251 /*预设的mem的主设备号*/
#endif
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
rd /s /q "%%i"
)
@jannson
jannson / eep_Makefile
Created May 23, 2014 00:16
package Makefile example in openwrt
#opt/openwrt/trunk-qemu/package/utils/eep
include $(TOPDIR)/rules.mk
PKG_NAME:=eep
PKG_VERSION:=5.0
PKG_RELEASE:=1
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
@jannson
jannson / rootfs_test.c
Last active August 29, 2015 14:01
openwrt kernel test
//static int __init populate_rootfs(void)
{/* Just test hear */
int fd, cnt;
char* buf = NULL;
fd = sys_open("/etc/preinit", O_RDONLY, 0);
buf = (char*)kmalloc(1024, GFP_KERNEL);
cnt = sys_read(fd, buf, 1024);
if(cnt == 1024)
/* endian convertor */
/* use cmp to test it: cmp -l flash flash3 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
@jannson
jannson / mt7620a.dts
Created June 23, 2014 05:23
mt7620a dts
/dts-v1/;
/include/ "mt7620a.dtsi"
/ {
compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
model = "Ralink MT7620A board";
palmbus@10000000 {
sysc@0 {