bluenrg_ms.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:uble 作者: dmazzella 项目源码 文件源码
def __init__(
        self,
        spi_bus=machine.SPI(2, baudrate=8000000, polarity=0),
        irq_pin=machine.Pin('Y3', machine.Pin.IN, machine.Pin.PULL_DOWN),
        rst_pin=machine.Pin('Y4', machine.Pin.OUT_PP),
        nss_pin=machine.Pin('Y5', machine.Pin.OUT_PP),
    ):
        """
        Defaults:
            - SPI(2) on the Y position:
                (NSS, SCK, MISO, MOSI) = (Y5, Y6, Y7, Y8) = (PB12, PB13, PB14, PB15)
              Params:
                phase: 0
                dir: SPI_DIRECTION_2LINES
                bits: 8
                nss: SPI_NSS_SOFT
                firstbit: SPI_FIRSTBIT_MSB
                ti: SPI_TIMODE_DISABLED
                crc:
                crc_calc: SPI_CRCCALCULATION_DISABLED

            - IRQ  on Y3 Pin
            - RST  on Y4 Pin
            - NSS  on Y5 Pin
            - SCK  on Y6 Pin
            - MISO on Y7 Pin
            - MOSI on Y8 Pin
        """

        if not isinstance(spi_bus, machine.SPI):
            raise TypeError("")

        m_pins = (irq_pin, rst_pin, nss_pin)
        if not all([isinstance(pin, machine.Pin) for pin in m_pins]):
            raise TypeError("")

        self._spi_bus = spi_bus

        self._irq_pin = irq_pin
        self._rst_pin = rst_pin
        self._nss_pin = nss_pin

        # Release CS line
        self._nss_pin.on()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号