326159487 发表于 2012-12-29 20:38:12

CSR蓝牙模块BC5的I/O口控制

本帖最后由 bluetooth 于 2012-12-29 20:40 编辑

CSR的BC5一共有13个IO口

include pio.h
直接调用'PioSet'函数,设置上1下0拉。
直接调用'PioSetDir'函数,设置输入0输出1
一般输入为弱上拉,直接调用’PioSetStrongBias‘函数,实现强上下拉,1为设置强,0为弱,不代表上下拉
另外还有复用引脚查询,设置
Kalimba用引脚查询,设置
@param mask The bit mask to use.
@param bits The bits to use.
This function is used to write the value of the data-output register. Only a
subset of bits is written, controlled by the value of 'mask'; setting a bit in
mask allows the corresponding bit in the output register to be changed according
to the value of the bit in data. Note that bits not set in the mask lead to the
corresponding output bits being set to the value shown in the data input register
rather than the value stored in the data output register. i.e.
\code
foreach bit
   if mask is 1
         pioOut => data
   else
         pioOut => pioIn
\endcode
BlueCore (excluding BC01) has internal resistors which can be configured
to either pull-up or pull-down mode when the pins are used for input. This
is controlled by the value written to the output register using 'PioSet'.
The resistors pull-down if the value is zero, and pull-up otherwise, so the
following fragment sets pins 1 and 2 to inputs with pin 1 configured to
pull-up and pin 2 configured to pull-down.
\code
PioSet(2|4, 2);
PioSetDir(2|4, 0);
\endcode

All BlueCore variants (above BC01) include weak internal pull-ups or
pull-downs on pins which are being used as inputs. If the value set
in the output register (for a pin which is being used as an input) is
1, then the internal pull-up is enabled, otherwise the pin is pulled-down.
On later BlueCore variants (not BC01, BC02-external), the pull-up or
pull-down can be made stronger by writing a 1 into the corresponding bit
in the bias register by calling this function.
So to set pin 4 and 5 as inputs, 4 pulled up weakly, 5 pulled down strongly
\code
   PioSetDir((1<<4)|(1<<5), 0);
   PioSet((1<<4)|(1<<5), (1<<4));
   PioSetStrongBias((1<<4)|(1<<5), (1<<5));
\endcode

Wistao 发表于 2013-1-2 09:51:21

不错,又占了一个沙发!

gaojiang861209 发表于 2013-1-21 12:08:33

学习了!感觉不够详细!

gaojiang861209 发表于 2013-1-21 20:16:03

挣积分,积分!

jkl 发表于 2013-4-23 12:55:12

下来学习学习

cnc2020 发表于 2013-5-27 22:42:23

学习 :)学习了:)

yk0yk 发表于 2013-9-4 23:35:46

谢谢楼主讲解

长乐 发表于 2013-9-8 01:33:30

使用CSR蓝牙Chip进行Layout PCB注意事项

chlln 发表于 2013-10-29 23:22:27

这个好好学习

hoccabcd1 发表于 2013-12-9 09:34:28

谢谢!新手来学习了!
页: [1] 2
查看完整版本: CSR蓝牙模块BC5的I/O口控制