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

📄 hplspim.nc

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 NC
字号:
module HPLSpiM {  provides {    interface SpiByte;  }  uses {    interface HPLUSARTControl as USARTControl;  }}implementation {  /**   * Initialize the SPI bus   */  command result_t SpiByte.init() {    call USARTControl.setModeSPI();    call USARTControl.disableRxIntr();    call USARTControl.disableTxIntr();    return SUCCESS;  }  /**   * Enable the SPI bus functionality   */  async command result_t SpiByte.enable() {    call USARTControl.setModeSPI();    call USARTControl.disableRxIntr();    call USARTControl.disableTxIntr();    return SUCCESS;  }  /**   * Disable the SPI bus functionality   */  async command result_t SpiByte.disable() {    return SUCCESS;  }  /**   * Write a byte to the SPI bus   * @param data value written to the MOSI pin   * @return value read on the MISO pin   */  async command uint8_t SpiByte.write(uint8_t data) {    uint8_t retdata;    atomic {      call USARTControl.tx(data);      while(!(call USARTControl.isRxIntrPending())) ;      retdata = call USARTControl.rx();    }    return retdata;  }}

⌨️ 快捷键说明

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