BeRTOS
gpio_lm3s.h
Go to the documentation of this file.
00001 
00036 #ifndef GPIO_LM3S_H
00037 #define GPIO_LM3S_H
00038 
00039 #include <io/lm3s.h>
00040 
00044 /*\{*/
00045 enum
00046 {
00047     GPIO_DIR_MODE_IN = 0, //< Pin is a GPIO input
00048     GPIO_DIR_MODE_OUT,    //< Pin is a GPIO output
00049     GPIO_DIR_MODE_HW,     //< Pin is a peripheral function
00050 };
00051 /*\}*/
00052 
00056 /*\{*/
00057 enum
00058 {
00059     GPIO_STRENGTH_2MA = 0, //< 2mA drive strength
00060     GPIO_STRENGTH_4MA,     //< 4mA drive strength
00061     GPIO_STRENGTH_8MA,     //< 8mA drive strength
00062     GPIO_STRENGTH_8MA_SC,  //< 8mA drive with slew rate control
00063 };
00064 /*\}*/
00065 
00069 /*\{*/
00070 enum
00071 {
00072     GPIO_PIN_TYPE_ANALOG = 0, //< Analog comparator
00073     GPIO_PIN_TYPE_STD,        //< Push-pull
00074     GPIO_PIN_TYPE_STD_WPU,    //< Push-pull with weak pull-up
00075     GPIO_PIN_TYPE_STD_WPD,    //< Push-pull with weak pull-down
00076     GPIO_PIN_TYPE_OD,         //< Open-drain
00077     GPIO_PIN_TYPE_OD_WPU,     //< Open-drain with weak pull-up
00078     GPIO_PIN_TYPE_OD_WPD,     //< Open-drain with weak pull-down
00079 };
00080 /*\}*/
00081 
00082 /* Write a value to the specified pin(s) */
00083 INLINE void lm3s_gpioPinWrite(uint32_t port, uint8_t pins, uint8_t val)
00084 {
00085     HWREG(port + GPIO_O_DATA + (pins << 2)) = val;
00086 }
00087 
00088 /* Read a value from the specified pin(s) */
00089 INLINE uint32_t lm3s_gpioPinRead(uint32_t port, uint8_t pins)
00090 {
00091     return HWREG(port + GPIO_O_DATA + (pins << 2));
00092 }
00093 
00094 int lm3s_gpioPinConfig(uint32_t port, uint8_t pins,
00095         uint32_t mode, uint32_t strength, uint32_t type);
00096 
00097 #endif /* GPIO_LM3S_H */