diff options
author | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2009-12-25 08:39:24 +0000 |
---|---|---|
committer | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2009-12-25 08:39:24 +0000 |
commit | b6674cd738cc22e61ea34cb659750ef45ce01df4 (patch) | |
tree | bfee2ae84883c32871ee13a6e0f346f144263cf6 /src/lib/gpio.h | |
parent | 3bb04834ffd3f90dc9015997ea11a56d9d150099 (diff) | |
download | librambutan-b6674cd738cc22e61ea34cb659750ef45ce01df4.tar.gz librambutan-b6674cd738cc22e61ea34cb659750ef45ce01df4.zip |
Fixed delayMicroseconds, changed serial interface, added an (untested) runtime check for pwm/serial collision, moved more headers around.
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@79 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/lib/gpio.h')
-rw-r--r-- | src/lib/gpio.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/lib/gpio.h b/src/lib/gpio.h index bc9bdde..5e7cf29 100644 --- a/src/lib/gpio.h +++ b/src/lib/gpio.h @@ -58,25 +58,17 @@ #define GPIO_MODE_INPUT_PD (0x02 << 2) #define GPIO_MODE_INPUT_PU (0x02 << 2) -//#define INPUT_ANALOG GPIO_MODE_INPUT_ANALOG -//#define INPUT_DIGITAL GPIO_MODE_INPUT_FLOATING -//#define INPUT_FLOATING GPIO_MODE_INPUT_FLOATING -//#define INPUT_PULLDOWN GPIO_MODE_INPUT_PD -//#define INPUT_PULLUP GPIO_MODE_INPUT_PU -//#define INPUT GPIO_MODE_INPUT_FLOATING -//#define OUTPUT GPIO_MODE_OUTPUT_PP - typedef struct { - volatile uint32_t CRL; // Port configuration register low - volatile uint32_t CRH; // Port configuration register high - volatile uint32_t IDR; // Port input data register - volatile uint32_t ODR; // Port output data register - volatile uint32_t BSRR; // Port bit set/reset register - volatile uint32_t BRR; // Port bit reset register - volatile uint32_t LCKR; // Port configuration lock register + volatile uint32 CRL; // Port configuration register low + volatile uint32 CRH; // Port configuration register high + volatile uint32 IDR; // Port input data register + volatile uint32 ODR; // Port output data register + volatile uint32 BSRR; // Port bit set/reset register + volatile uint32 BRR; // Port bit reset register + volatile uint32 LCKR; // Port configuration lock register } GPIO_Port; -typedef volatile uint32_t* GPIOReg; +typedef volatile uint32* GPIOReg; #define POS_MASK(shift) (~(0xF << shift)) #define POS(val) (val << 2) @@ -86,9 +78,9 @@ extern "C"{ #endif void gpio_init(void); -void gpio_set_mode(GPIO_Port* port, uint8_t gpio_pin, uint8_t mode); +void gpio_set_mode(GPIO_Port* port, uint8 gpio_pin, uint8 mode); -static inline void gpio_write_bit(GPIO_Port *port, uint8_t gpio_pin, uint8_t val) { +static inline void gpio_write_bit(GPIO_Port *port, uint8 gpio_pin, uint8 val) { if (val){ port->BSRR = BIT(gpio_pin); } else { |