📄 pca9555.h
字号:
#ifndef __pca9555_H__
#define __pca9555_H__
#define W9555 0x42 //9555写
#define R9555 0x43 //9555读
#define Cmd_ip0 0x00
#define Cmd_ip1 0x01
#define Cmd_op0 0x02
#define Cmd_op1 0x03
#define Cmd_polarity0 0x04
#define Cmd_polarity1 0x05
#define Cmd_cfg0 0x06
#define Cmd_cfg1 0x07
/*-----------写pca9555输出寄存器---------------*/
void W9555output(uchar input1,uchar input2)
{
IICStart();
IICSendByte(W9555);
IICSendByte(Cmd_op0);
IICSendByte(input1);
IICSendByte(input2);
IICStop();
}
/*------------写pca9555配置寄存器------------*/
void W9555cfg(uchar input1,uchar input2)
{
IICStart();
IICSendByte(W9555);
IICSendByte(Cmd_cfg0);
IICSendByte(input1);
IICSendByte(input2);
IICStop();
}
void pca9555_init(void)
{
W9555cfg(0x00,0x00); //设置I/O状态
W9555output(0x00,0x00); //
}
void Opt9555(uchar cmd,uchar data_1)
{
pca9555_init();
IICStart();
IICSendByte(W9555);
IICSendByte(cmd);
IICSendByte(data_1);
IICStart();
}
/*
void Ipt9555(uchar idata *i9555temp)
{
pca9555_init();
IICStart();
IICSendByte(W9555);
IICSendByte(Cmd_ip0);
IICStart();
IICSendByte(R9555);
*i9555temp=IICReceiveByte();
IICAck();
i9555temp++;
*i9555temp=IICReceiveByte();
IICNoAck();
} */
//
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -