mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
Ported Christophe's i2c driver reimplementation to libopencm3 using test_baro for testing.
This commit is contained in:
@@ -182,7 +182,7 @@ test_baro.CFLAGS += -I$(SRC_LISA) -I$(SRC_BOARD)
|
||||
test_baro.srcs += $(SRC_BOARD)/test_baro.c
|
||||
test_baro.srcs += $(SRC_BOARD)/baro_board.c
|
||||
test_baro.CFLAGS += -DUSE_I2C2
|
||||
test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
|
||||
test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.rewritten.c
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
#define I2C_HW_H
|
||||
|
||||
#include "mcu_periph/i2c.h"
|
||||
#include <stm32/i2c.h>
|
||||
|
||||
#include <libopencm3/stm32/i2c.h>
|
||||
|
||||
#ifdef USE_I2C1
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
|
||||
#include "subsystems/sensors/baro.h"
|
||||
#include <stm32/gpio.h>
|
||||
#include <libopencm3/stm32/f1/gpio.h>
|
||||
|
||||
struct Baro baro;
|
||||
struct BaroBoard baro_board;
|
||||
@@ -75,16 +75,14 @@ void baro_init(void) {
|
||||
bmp085_baro_read_calibration();
|
||||
|
||||
/* STM32 specific (maybe this is a LISA/M specific driver anyway?) */
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
gpio_clear(GPIOB, GPIO0);
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_INPUT,
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN, GPIO0);
|
||||
}
|
||||
|
||||
static inline int baro_eoc(void)
|
||||
{
|
||||
return GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_0);
|
||||
return gpio_get(GPIOB, GPIO0);
|
||||
}
|
||||
|
||||
static inline void bmp085_request_pressure(void)
|
||||
|
||||
@@ -80,15 +80,15 @@ static inline void main_periodic_task( void ) {
|
||||
RunOnceEvery(256,
|
||||
{
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2_errors.ack_fail_cnt,
|
||||
&i2c2_errors.miss_start_stop_cnt,
|
||||
&i2c2_errors.arb_lost_cnt,
|
||||
&i2c2_errors.over_under_cnt,
|
||||
&i2c2_errors.pec_recep_cnt,
|
||||
&i2c2_errors.timeout_tlow_cnt,
|
||||
&i2c2_errors.smbus_alert_cnt,
|
||||
&i2c2_errors.unexpected_event_cnt,
|
||||
&i2c2_errors.last_unexpected_event);
|
||||
&i2c2.errors->ack_fail_cnt,
|
||||
&i2c2.errors->miss_start_stop_cnt,
|
||||
&i2c2.errors->arb_lost_cnt,
|
||||
&i2c2.errors->over_under_cnt,
|
||||
&i2c2.errors->pec_recep_cnt,
|
||||
&i2c2.errors->timeout_tlow_cnt,
|
||||
&i2c2.errors->smbus_alert_cnt,
|
||||
&i2c2.errors->unexpected_event_cnt,
|
||||
&i2c2.errors->last_unexpected_event);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user