⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cc1km.nc

📁 tinyos中对cc1000芯片的操作实例
💻 NC
字号:
module cc1km {
	provides{
		interface StdControl;
	}
	
	uses{
		interface HPLCC1000;
		interface Timer;
		interface HPLUART;
		interface Leds;
	}
}

implementation{
	uint8_t addr=0xff;
	uint8_t data=0;
	uint8_t count=0;
	
	command result_t StdControl.init() {
		call HPLCC1000.init();
		call HPLUART.init();
		call HPLCC1000.write(0x0d,0x93);
//		call HPLCC1000.write(0x0e,0x26);

//		call HPLCC1000.write(0x01,0x7b);
//		call HPLCC1000.write(0x02,0xf0);
//		call HPLCC1000.write(0x03,0x00);
//		call HPLCC1000.write(0x04,0x7b);
//		call HPLCC1000.write(0x05,0xe0);
//		call HPLCC1000.write(0x06,0x00);
	}
	
	command result_t StdControl.start() {
		return call Timer.start(0,100);
	}
	
	command result_t StdControl.stop() {
		return call HPLUART.stop();
	}
	
	event result_t Timer.fired() {
		addr++;
		data=call HPLCC1000.read(addr);
		return call HPLUART.put(data);
	}
	
	async event result_t HPLUART.putDone() {
		return SUCCESS;
	}
	
	async event result_t HPLUART.get(uint8_t data) {
//		addr=data;
		return SUCCESS;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -