Go to the documentation of this file.00001
00031
00032
00033
00034
00035
00036
00037
00038
00039
00047 #ifndef IO004_H_
00048 #define IO004_H_
00049
00050
00051
00052
00053 #include <DAVE3.h>
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00070
00071
00072
00076 typedef struct {
00077 __IO uint32_t OUT;
00078 __O uint32_t OMR;
00079 __I uint32_t RESERVED1[2];
00080 __IO uint32_t IOCR0;
00081 __IO uint32_t IOCR4;
00082 __IO uint32_t IOCR8;
00083 __IO uint32_t IOCR12;
00084 __I uint32_t RESERVED2[1];
00085 __I uint32_t IN;
00086 __I uint32_t RESERVED3[6];
00087 __IO uint32_t PDR0;
00088 __IO uint32_t PDR1;
00089 __I uint32_t RESERVED4[6];
00090 __IO uint32_t PDISC;
00091 __I uint32_t RESERVED5[3];
00092 __IO uint32_t PPS;
00093 __IO uint32_t HWSEL;
00094 }IO004_PORTS_TypeDef;
00095
00099 typedef struct IO004_HandleType
00100 {
00102 uint8_t PortNr;
00104 uint8_t PortPin;
00106 IO004_PORTS_TypeDef* PortRegs;
00107 }IO004_HandleType;
00108
00113 typedef enum IO004_InputModeType
00114 {
00116 IO004_TRISTATE,
00118 IO004_PULL_DOWN_DEVICE,
00120 IO004_PULL_UP_DEVICE,
00122 IO004_CONT_POLLING,
00124 IO004_INV_TRISTATE,
00126 IO004_INV_PULL_DOWN_DEVICE,
00128 IO004_INV_PULL_UP_DEVICE,
00130 IO004_INV_CONT_POLLING,
00131 }IO004_InputModeType;
00132
00136 typedef enum IO004_OutputModeType
00137 {
00139 IO004_PUSHPULL =0x10,
00141 IO004_OPENDRAIN =0x18
00142 }IO004_OutputModeType;
00143
00147
00148
00149
00175 void IO004_Init(void);
00176
00212 #define IO004_ReadPin(Handle ) (((Handle.PortRegs->IN) >> Handle.PortPin) & 1U)
00213
00237 #define IO004_SetPin(Handle) ((Handle.PortRegs->OMR) |= (1U << Handle.PortPin))
00238
00260 #define IO004_SetOutputValue(Handle,Value) (Handle.PortRegs->OMR |= Value ? (1U << Handle.PortPin):(0x10000UL << Handle.PortPin))
00261
00285 #define IO004_ResetPin(Handle) ((Handle.PortRegs->OMR) |= (0x10000UL << Handle.PortPin))
00286
00310 #define IO004_TogglePin(Handle) ((Handle.PortRegs->OMR) |= (0x10001UL << Handle.PortPin))
00311
00312
00313
00348 void IO004_DisableOutputDriver(const IO004_HandleType* Handle,IO004_InputModeType Mode);
00349
00350
00378 void IO004_EnableOutputDriver(const IO004_HandleType* Handle,IO004_OutputModeType Mode);
00379
00384
00385 #include "IO004_Conf.h"
00386
00387 #endif
00388
00389
00390