STC15W408AS library 0.10.0
Loading...
Searching...
No Matches
pin.h
Go to the documentation of this file.
1#ifndef STC15_PINH
2#define STC15_PINH
13#include <sys.h>
14#include <bits.h>
15#include <stdint.h>
16#include <stdbool.h>
17
31#define pin_quasi_bidiretional_init(port, port_pin) \
32do { \
33 bit_clr(port ## M1, ~(1 << port_pin)); \
34 bit_clr(port ## M0, ~(1 << port_pin)); \
35} while(0)
36
51#define pin_push_pull_init(port, port_pin) \
52do { \
53 bit_clr(port ## M1, ~(1 << port_pin)); \
54 bit_set(port ## M0, 1 << port_pin); \
55} while(0)
56
69#define pin_input_only_init(port, port_pin) \
70do { \
71 bit_set(port ## M1, 1 << port_pin); \
72 bit_clr(port ## M0, ~(1 << port_pin)); \
73} while(0)
74
88#define pin_open_drain_init(port, port_pin) \
89do { \
90 bit_set(port ## M1, 1 << port_pin); \
91 bit_set(port ## M0, 1 << port_pin); \
92} while(0)
93
101#define is_pin_mode_quasi_bidiretional(port, port_pin) ( ((port ## M1 & (1 << port_pin)) == 0) && ((port ## M0 & (1 << port_pin)) == 0 ) )
102
110#define is_pin_mode_push_pull(port, port_pin) ( ((port ## M1 & (1 << port_pin)) == 0) && ((port ## M0 & (1 << port_pin)) != 0) )
111
119#define is_pin_mode_input_only(port, port_pin) ( ((port ## M1 & (1 << port_pin)) != 0) && ((port ## M0 & (1 << port_pin)) == 0) )
120
128#define is_pin_mode_open_drain(port, port_pin) ( ((port ## M1 & (1 << port_pin)) != 0) && ((port ## M0 & (1 << port_pin)) != 0) )
129
137#define pin_port_quasi_bidiretional_init(port) \
138do { \
139 port ## M1 = 0x00; \
140 port ## M0 = 0x00; \
141} while(0)
142
150#define pin_port_pull_push_init(port) \
151do { \
152 port ## M1 = 0x00; \
153 port ## M0 = 0xff; \
154} while(0)
155
163#define pin_port_input_only_init(port) \
164do { \
165 port ## M1 = 0xff; \
166 port ## M0 = 0x00; \
167} while(0)
168
176#define pin_port_open_drain_init(port) \
177do { \
178 port ## M1 = 0xff; \
179 port ## M0 = 0xff; \
180} while(0)
181
182#endif