mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-13 11:29:12 +08:00
Merge pull request #498 from flixr/gpio_setclear
[mcu_periph] replace gpio_output_[high|low] with gpio_[set|clear]
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
/**
|
||||
* Set a gpio output to high level.
|
||||
*/
|
||||
static inline void gpio_output_high(uint32_t port, uint16_t pin) {
|
||||
static inline void gpio_set(uint32_t port, uint16_t pin) {
|
||||
if (port == 0)
|
||||
IO0SET = _BV(pin);
|
||||
else if (port == 1)
|
||||
@@ -44,7 +44,7 @@ static inline void gpio_output_high(uint32_t port, uint16_t pin) {
|
||||
/**
|
||||
* Clear a gpio output to low level.
|
||||
*/
|
||||
static inline void gpio_output_low(uint32_t port, uint16_t pin) {
|
||||
static inline void gpio_clear(uint32_t port, uint16_t pin) {
|
||||
if (port == 0)
|
||||
IO0CLR = _BV(pin);
|
||||
else if (port == 1)
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
* @ingroup stm32_arch
|
||||
*
|
||||
* GPIO helper functions for STM32F1 and STM32F4.
|
||||
*
|
||||
* The gpio_set and gpio_clear functions are already available from libopencm3.
|
||||
*/
|
||||
|
||||
#ifndef GPIO_ARCH_H
|
||||
@@ -31,20 +33,6 @@
|
||||
|
||||
#include <libopencm3/stm32/gpio.h>
|
||||
|
||||
/**
|
||||
* Set a gpio output to high level.
|
||||
*/
|
||||
static inline void gpio_output_high(uint32_t port, uint16_t pin) {
|
||||
gpio_set(port, pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a gpio output to low level.
|
||||
*/
|
||||
static inline void gpio_output_low(uint32_t port, uint16_t pin) {
|
||||
gpio_clear(port, pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup a gpio for input or output with alternate function.
|
||||
*/
|
||||
|
||||
@@ -96,7 +96,7 @@ void imu_impl_init(void)
|
||||
// With CS tied high to VDD I/O, the ADXL345 is in I2C mode
|
||||
#ifdef ASPIRIN_I2C_CS_PORT
|
||||
gpio_setup_output(ASPIRIN_I2C_CS_PORT, ASPIRIN_I2C_CS_PIN);
|
||||
gpio_output_high(ASPIRIN_I2C_CS_PORT, ASPIRIN_I2C_CS_PIN);
|
||||
gpio_set(ASPIRIN_I2C_CS_PORT, ASPIRIN_I2C_CS_PIN);
|
||||
#endif
|
||||
|
||||
/* Gyro configuration and initalization */
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
* output low sets it to normal polarity.
|
||||
*/
|
||||
#ifndef RC_SET_POLARITY
|
||||
#define RC_SET_POLARITY gpio_output_high
|
||||
#define RC_SET_POLARITY gpio_set
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user