QCC蓝牙芯片PIO操作

这篇博客详细介绍了QCC系列蓝牙芯片中PIO(Peripheral Input/Output)的使用,包括API函数如PioGetMapPins32Bank、PioSetDir32Bank和PioSet32Bank的用法,以及如何设置PIO为输入、输出高电平和低电平。内容适用于QCC3020、QCC3031等多款芯片。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

QCC蓝牙芯片PIO操作
1.API
/**

  • \brief Returns a 32 bit value showing which PIO lines have been mapped to chip pins
  • (see documentation for PioSetMapPins32() for more detail).
  • \param bank PIO bank number.
  • \note This trap may NOT be called from a high-priority task handler
  • \ingroup trapset_core
    /
    uint32 PioGetMapPins32Bank(uint16 bank);
    /
    *
  • \brief Set PIOs as inputs or outputs.
  • Note that all PIOs must be mapped in before they can be used.
  • See the PioSetMapPins32() documentation for information on valid PIO
  • directions
  • and PIO mapping.
  • \param mask Each bit in the mask corresponds to a PIO line. Bits set to 1 in this mask will
  • be modified. Bits set to 0 in this mask will not be modified.
  • \param dir Each bit in the “dir” value corresponds to a PIO line. Bits set to 1 in this
  • value will result in that PIO line being configured as an output. Bits set to
  • 0 in this value will result in that PIO line being configured as an input.
  • \return A 32 bit mask. If any bit in this mask is high then that PIO could not be set
  • to the direction specified; note that no action will have been taken on any
  • PIOs.
  • \note This trap may NOT be called from a high-priority task handler
  • \ingroup trapset_core
    */
    uint32 PioSetDir32(uint32 mask, uint32 dir);

/**

  • \brief Set PIOs as inputs or outputs.
  • Note that all PIOs must be mapped in before they can be used.
  • See the PioSetMapPins32Bank() documentation for information on valid PIO
  • directions
  • and PIO mapping.
  • \param bank PIO bank number.
  • \param mask Each bit in the mask corresponds to a PIO line. Bits set to 1 in this mask will
  • be modified. Bits set to 0 in this mask will not be modified.
  • \param dir Each bit in the “dir” value corresponds to a PIO line. Bits set to 1 in this
  • value will result in that PIO line being configured as an output. Bits set to
  • 0 in this value will result in that PIO line being configured as an input.
  • \return A 32 bit mask. If any bit in this mask is high then that PIO could not be set
  • to the direction specified; note that no action will have been taken on any
  • PIOs.
  • \note This trap may NOT be called from a high-priority task handler
  • \ingroup trapset_core
    */
    uint32 PioSetDir32Bank(uint16 bank, uint32 mask, uint32 dir);

2.set PIO

2.1. set PIO as output high:
PioSetMapPins32Bank(PIO >>5 , (1UL << (PIO & 31)), (1UL << (PIO & 31)));
PioSetDir32Bank(PIO >>5, (1UL << (PIO & 31)), (1UL << (PIO & 31)));
PioSet32Bank(PIO >>5, (1UL << (PIO & 31)), 1UL << (PIO & 31)));
2.2. set PIO as output low:
PioSetMapPins32Bank(PIO >>5 , (1UL << (PIO & 31)), (1UL << (PIO & 31)));
PioSetDir32Bank(PIO >>5, (1UL << (PIO & 31)), (1UL << (PIO & 31)));
PioSet32Bank(PIO >>5, (1UL << (PIO & 31)), 0);

2.3. set PIO as input:
PioSetMapPins32Bank(PIO >>5 , (1UL << (PIO & 31)), (1UL << (PIO & 31)));
PioSetDir32Bank(PIO >>5, (1UL << (PIO & 31)), (0UL << (PIO & 31)));

3.Support Devices

QCC3020QCC3031QCC3040QCC3050QCC5121QCC5141QCC5151
QCC3021QCC3034QCC3044QCC3056QCC5124QCC5144
QCC3024QCC3046QCC5125
QCC3026QCC5126
QCC5127
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值