cc1km.nc

来自「tinyos中对cc1000芯片的操作实例」· NC 代码 · 共 55 行

NC
55
字号
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 + =
减小字号Ctrl + -
显示快捷键?