📄 piolib.h
字号:
#include "daadioLib.h"#include "semLib.h"/************************************************** PUBLIC**************************************************//* Number of PIO ports */#define PIO_MAX_PORTS 6/* Number of channels per port */#define PIO_MAX_CHANNELS_PER_PORT 8#define ON 1#define OFF 0#define PORT_A 0#define PORT_B 1#define PORT_C 2#define PORT_D 3#define PORT_E 4#define PORT_F 5/************************************************** PRIVATE**************************************************//* offset of PIO registers */#define PIO_OFFSET 0x20/* offset of the Output Enable Register */#define PIO_OUTPUT_ENABLE_OFFSET 0x27/* To obtain a port register offset we need to add PIO_OFFSET plus the port number with bit 0 inverted. This is due to each even numbered port is at an address one higher than its odd brethern, i.e. Port A (0) is at offset 0x21 while Port B (1) is at 0x20. */#define PIO_PORT_NUM_TO_OFF(port) (PIO_OFFSET + (int)(((port) & ~1) + \ (((port) & 1) ^ 1)))typedef struct { SEM_ID mutexSem; /* this is used for the optional lab */ BOOL initialized; /* TRUE if the PIO module has been initialized */ } PIO;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -