ATY_LIB V2_102_230218
ATY_LIB for general devices or ALGO
 
Loading...
Searching...
No Matches
fw_gpio.h File Reference
#include "fw_conf.h"
#include "fw_types.h"

Go to the source code of this file.

Macros

#define GPIO_P0_SetMode(__PINS__, __MODE__)
 
#define GPIO_P1_SetMode(__PINS__, __MODE__)
 
#define GPIO_P2_SetMode(__PINS__, __MODE__)
 
#define GPIO_P3_SetMode(__PINS__, __MODE__)
 
#define GPIO_P4_SetMode(__PINS__, __MODE__)
 
#define GPIO_P5_SetMode(__PINS__, __MODE__)
 
#define GPIO_P6_SetMode(__PINS__, __MODE__)
 
#define GPIO_P7_SetMode(__PINS__, __MODE__)
 
#define GPIO_SetPullUp(__PORT__, __PINS__, __STATE__)
 
#define GPIO_SetSchmittTrigger(__PORT__, __PINS__, __STATE__)
 
#define GPIO_SetSwitchSpeed(__PORT__, __PINS__, __STATE__)
 
#define GPIO_SetDriveCapability(__PORT__, __PINS__, __STATE__)
 
#define GPIO_SetDigitalInput(__PORT__, __PINS__, __STATE__)
 

Enumerations

enum  GPIO_Mode_t { GPIO_Mode_InOut_QBD = 0x00 , GPIO_Mode_Output_PP = 0x01 , GPIO_Mode_Input_HIP = 0x02 , GPIO_Mode_InOut_OD = 0x03 }
 
enum  GPIO_Port_t {
  GPIO_Port_0 = 0U , GPIO_Port_1 = 1U , GPIO_Port_2 = 2U , GPIO_Port_3 = 3U ,
  GPIO_Port_4 = 4U , GPIO_Port_5 = 5U , GPIO_Port_6 = 6U , GPIO_Port_7 = 7U
}
 
enum  GPIO_Pin_t {
  GPIO_Pin_0 = B00000001 , GPIO_Pin_1 = B00000010 , GPIO_Pin_2 = B00000100 , GPIO_Pin_3 = B00001000 ,
  GPIO_Pin_4 = B00010000 , GPIO_Pin_5 = B00100000 , GPIO_Pin_6 = B01000000 , GPIO_Pin_7 = B10000000 ,
  GPIO_Pin_All = B11111111
}
 
enum  GPIO_SchmittTrigger_t { GPIO_SchmittTrigger_ON = 0x00 , GPIO_SchmittTrigger_OFF = 0x01 }
 
enum  GPIO_SwitchSpeed_t { GPIO_SwitchSpeed_High = 0x00 , GPIO_SwitchSpeed_Low = 0x01 }
 
enum  GPIO_DriveCapability_t { GPIO_DriveCapability_High = 0x00 , GPIO_DriveCapability_Normal = 0x01 }
 

Macro Definition Documentation

◆ GPIO_P0_SetMode

#define GPIO_P0_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P0M0 = P0M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P0M1 = P0M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 74 of file fw_gpio.h.

◆ GPIO_P1_SetMode

#define GPIO_P1_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P1M0 = P1M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P1M1 = P1M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 79 of file fw_gpio.h.

◆ GPIO_P2_SetMode

#define GPIO_P2_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P2M0 = P2M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P2M1 = P2M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 84 of file fw_gpio.h.

◆ GPIO_P3_SetMode

#define GPIO_P3_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P3M0 = P3M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P3M1 = P3M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 89 of file fw_gpio.h.

◆ GPIO_P4_SetMode

#define GPIO_P4_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P4M0 = P4M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P4M1 = P4M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 94 of file fw_gpio.h.

◆ GPIO_P5_SetMode

#define GPIO_P5_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P5M0 = P5M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P5M1 = P5M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 99 of file fw_gpio.h.

◆ GPIO_P6_SetMode

#define GPIO_P6_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P6M0 = P6M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P6M1 = P6M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 105 of file fw_gpio.h.

◆ GPIO_P7_SetMode

#define GPIO_P7_SetMode (   __PINS__,
  __MODE__ 
)
Value:
do { \
P7M0 = P7M0 & ~(__PINS__) | (((__MODE__) & 0x01)? (__PINS__) : 0x00); \
P7M1 = P7M1 & ~(__PINS__) | (((__MODE__) & 0x02)? (__PINS__) : 0x00); \
} while(0)

Definition at line 110 of file fw_gpio.h.

◆ GPIO_SetDigitalInput

#define GPIO_SetDigitalInput (   __PORT__,
  __PINS__,
  __STATE__ 
)
Value:
do { \
SFRX_ON(); \
SFRX(PxIE + (__PORT__)) = SFRX(PxIE + (__PORT__)) \
& ~(__PINS__) | (((__STATE__) & 0x01)? (__PINS__) : 0x00); \
SFRX_OFF(); \
} while(0)
#define PxIE

Definition at line 144 of file fw_gpio.h.

◆ GPIO_SetDriveCapability

#define GPIO_SetDriveCapability (   __PORT__,
  __PINS__,
  __STATE__ 
)
Value:
do { \
SFRX_ON(); \
SFRX(PxDR + (__PORT__)) = SFRX(PxDR + (__PORT__)) \
& ~(__PINS__) | (((__STATE__) & 0x01)? (__PINS__) : 0x00); \
SFRX_OFF(); \
} while(0)
#define PxDR
Definition: fw_reg_stc8g.h:316

Definition at line 137 of file fw_gpio.h.

◆ GPIO_SetPullUp

#define GPIO_SetPullUp (   __PORT__,
  __PINS__,
  __STATE__ 
)
Value:
do { \
SFRX_ON(); \
SFRX(PxPU + (__PORT__)) = SFRX(PxPU + (__PORT__)) \
& ~(__PINS__) | (((__STATE__) & 0x01)? (__PINS__) : 0x00); \
SFRX_OFF(); \
} while(0)
#define PxPU
Definition: fw_reg_stc8g.h:289

Definition at line 116 of file fw_gpio.h.

◆ GPIO_SetSchmittTrigger

#define GPIO_SetSchmittTrigger (   __PORT__,
  __PINS__,
  __STATE__ 
)
Value:
do { \
SFRX_ON(); \
SFRX(PxNCS + (__PORT__)) = SFRX(PxNCS + (__PORT__)) \
& ~(__PINS__) | (((__STATE__) & 0x01)? (__PINS__) : 0x00); \
SFRX_OFF(); \
} while(0)
#define PxNCS
Definition: fw_reg_stc8g.h:298

Definition at line 123 of file fw_gpio.h.

◆ GPIO_SetSwitchSpeed

#define GPIO_SetSwitchSpeed (   __PORT__,
  __PINS__,
  __STATE__ 
)
Value:
do { \
SFRX_ON(); \
SFRX(PxSR + (__PORT__)) = SFRX(PxSR + (__PORT__)) \
& ~(__PINS__) | (((__STATE__) & 0x01)? (__PINS__) : 0x00); \
SFRX_OFF(); \
} while(0)
#define PxSR
Definition: fw_reg_stc8g.h:307

Definition at line 130 of file fw_gpio.h.

Enumeration Type Documentation

◆ GPIO_DriveCapability_t

Enumerator
GPIO_DriveCapability_High 
GPIO_DriveCapability_Normal 

Definition at line 68 of file fw_gpio.h.

69{
GPIO_DriveCapability_t
Definition: fw_gpio.h:69
@ GPIO_DriveCapability_Normal
Definition: fw_gpio.h:71
@ GPIO_DriveCapability_High
Definition: fw_gpio.h:70

◆ GPIO_Mode_t

Enumerator
GPIO_Mode_InOut_QBD 
GPIO_Mode_Output_PP 
GPIO_Mode_Input_HIP 
GPIO_Mode_InOut_OD 

Definition at line 21 of file fw_gpio.h.

22{
23 GPIO_Mode_InOut_QBD = 0x00, /* quasi-bidirectional(be compatible with classical 8051 MCUs) */
24 GPIO_Mode_Output_PP = 0x01, /* push-pull output */
25 GPIO_Mode_Input_HIP = 0x02, /* high-impedance input */
26 GPIO_Mode_InOut_OD = 0x03, /* open drain output */
GPIO_Mode_t
Definition: fw_gpio.h:22
@ GPIO_Mode_InOut_OD
Definition: fw_gpio.h:26
@ GPIO_Mode_Input_HIP
Definition: fw_gpio.h:25
@ GPIO_Mode_Output_PP
Definition: fw_gpio.h:24
@ GPIO_Mode_InOut_QBD
Definition: fw_gpio.h:23

◆ GPIO_Pin_t

enum GPIO_Pin_t
Enumerator
GPIO_Pin_0 
GPIO_Pin_1 
GPIO_Pin_2 
GPIO_Pin_3 
GPIO_Pin_4 
GPIO_Pin_5 
GPIO_Pin_6 
GPIO_Pin_7 
GPIO_Pin_All 

Definition at line 43 of file fw_gpio.h.

44{
GPIO_Pin_t
Definition: fw_gpio.h:44
@ GPIO_Pin_5
Definition: fw_gpio.h:50
@ GPIO_Pin_2
Definition: fw_gpio.h:47
@ GPIO_Pin_0
Definition: fw_gpio.h:45
@ GPIO_Pin_4
Definition: fw_gpio.h:49
@ GPIO_Pin_3
Definition: fw_gpio.h:48
@ GPIO_Pin_All
Definition: fw_gpio.h:53
@ GPIO_Pin_1
Definition: fw_gpio.h:46
@ GPIO_Pin_6
Definition: fw_gpio.h:51
@ GPIO_Pin_7
Definition: fw_gpio.h:52
#define B00010000
Definition: fw_types.h:40
#define B11111111
Definition: fw_types.h:65
#define B00100000
Definition: fw_types.h:45
#define B00001000
Definition: fw_types.h:36
#define B00000001
Definition: fw_types.h:30
#define B00000010
Definition: fw_types.h:31
#define B10000000
Definition: fw_types.h:58
#define B00000100
Definition: fw_types.h:33
#define B01000000
Definition: fw_types.h:51

◆ GPIO_Port_t

Enumerator
GPIO_Port_0 
GPIO_Port_1 
GPIO_Port_2 
GPIO_Port_3 
GPIO_Port_4 
GPIO_Port_5 
GPIO_Port_6 
GPIO_Port_7 

Definition at line 29 of file fw_gpio.h.

30{
31 GPIO_Port_0 = 0U,
32 GPIO_Port_1 = 1U,
33 GPIO_Port_2 = 2U,
34 GPIO_Port_3 = 3U,
35 GPIO_Port_4 = 4U,
36 GPIO_Port_5 = 5U,
37#if (__CONF_MCU_TYPE == 1 ) || (__CONF_MCU_TYPE == 3 )
38 GPIO_Port_6 = 6U,
39 GPIO_Port_7 = 7U,
40#endif
GPIO_Port_t
Definition: fw_gpio.h:30
@ GPIO_Port_6
Definition: fw_gpio.h:38
@ GPIO_Port_1
Definition: fw_gpio.h:32
@ GPIO_Port_0
Definition: fw_gpio.h:31
@ GPIO_Port_4
Definition: fw_gpio.h:35
@ GPIO_Port_5
Definition: fw_gpio.h:36
@ GPIO_Port_3
Definition: fw_gpio.h:34
@ GPIO_Port_2
Definition: fw_gpio.h:33
@ GPIO_Port_7
Definition: fw_gpio.h:39

◆ GPIO_SchmittTrigger_t

Enumerator
GPIO_SchmittTrigger_ON 
GPIO_SchmittTrigger_OFF 

Definition at line 56 of file fw_gpio.h.

57{
GPIO_SchmittTrigger_t
Definition: fw_gpio.h:57
@ GPIO_SchmittTrigger_ON
Definition: fw_gpio.h:58
@ GPIO_SchmittTrigger_OFF
Definition: fw_gpio.h:59

◆ GPIO_SwitchSpeed_t

Enumerator
GPIO_SwitchSpeed_High 
GPIO_SwitchSpeed_Low 

Definition at line 62 of file fw_gpio.h.

63{
GPIO_SwitchSpeed_t
Definition: fw_gpio.h:63
@ GPIO_SwitchSpeed_Low
Definition: fw_gpio.h:65
@ GPIO_SwitchSpeed_High
Definition: fw_gpio.h:64