123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef __IO_H
- #define __IO_H
- #include <stdbool.h>
- #define DI_NUMBER 8
- #define DI_MODE_IN 0
- #define DI_MODE_CNT 1
- #define DO_NUMBER 8
- #define DEBOUNCE_CNT 50
- void io_port_init(void);
- void io_init(void);
- void io_tim_init(void);
- typedef struct
- {
- gpio_type *port;
- uint16_t pin;
-
- } simple_gpio_t;
- typedef struct
- {
- gpio_type *port;
- uint16_t pin;
- uint16_t mode;
- uint32_t deb_counter;
- uint32_t cnt;
- bool p_flag;
- bool cnt_flag;
-
- } din_t;
- typedef struct
- {
- gpio_type *port;
- uint16_t pin;
- uint16_t mode;
- uint16_t pwm_period_cnt;
- uint16_t pwm_duty_cnt;
- uint16_t pwm_flag;
- uint16_t pwm_period;
- uint16_t pwm_duty;
-
- } out_t;
- extern uint16_t input_state[DI_NUMBER];
- extern uint16_t input_state_bit;
- extern uint32_t input_cnt[DI_NUMBER];
- extern uint16_t output_state_bit;
- extern uint16_t output_mode_bit;
- extern uint16_t output_pwm[];
- extern uint16_t output_pwm_save[];
- extern uint16_t output_pwm_period[];
- extern uint16_t output_pwm_period_save[];
- typedef struct
- {
- uint16_t state;
- uint16_t pwm;
- uint16_t mode;
- uint16_t smode_state;
-
- uint16_t smode_pwm;
- uint16_t normal_state;
-
- } output_t;
- typedef struct
- {
- uint16_t smode;
- uint16_t com_timeout;
- } system_t;
- #endif
|