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
QCC3020 | QCC3031 | QCC3040 | QCC3050 | QCC5121 | QCC5141 | QCC5151 |
QCC3021 | QCC3034 | QCC3044 | QCC3056 | QCC5124 | QCC5144 | – |
QCC3024 | – | QCC3046 | – | QCC5125 | – | – |
QCC3026 | – | – | – | QCC5126 | – | – |
– | – | – | – | QCC5127 | – | – |