[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [6213] moving peripherals
From: |
Felix Ruess |
Subject: |
[paparazzi-commits] [6213] moving peripherals |
Date: |
Sat, 23 Oct 2010 21:11:54 +0000 |
Revision: 6213
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6213
Author: flixr
Date: 2010-10-23 21:11:54 +0000 (Sat, 23 Oct 2010)
Log Message:
-----------
moving peripherals
Added Paths:
-----------
paparazzi3/trunk/sw/airborne/peripherals/
paparazzi3/trunk/sw/airborne/peripherals/adxl345.h
paparazzi3/trunk/sw/airborne/peripherals/ami601.c
paparazzi3/trunk/sw/airborne/peripherals/ami601.h
paparazzi3/trunk/sw/airborne/peripherals/hmc5843.c
paparazzi3/trunk/sw/airborne/peripherals/hmc5843.h
paparazzi3/trunk/sw/airborne/peripherals/itg3200.h
paparazzi3/trunk/sw/airborne/peripherals/max1168.c
paparazzi3/trunk/sw/airborne/peripherals/max1168.h
paparazzi3/trunk/sw/airborne/peripherals/ms2001.c
paparazzi3/trunk/sw/airborne/peripherals/ms2001.h
paparazzi3/trunk/sw/airborne/peripherals/sc18i600.c
paparazzi3/trunk/sw/airborne/peripherals/sc18i600.h
Removed Paths:
-------------
paparazzi3/trunk/sw/airborne/booz/peripherals/
Copied: paparazzi3/trunk/sw/airborne/peripherals/adxl345.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_adxl345.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/adxl345.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/adxl345.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,17 @@
+#ifndef BOOZ_ADXL345_H
+#define BOOZ_ADXL345_H
+
+
+#define ADXL345_REG_BW_RATE 0x2C
+#define ADXL345_REG_POWER_CTL 0x2D
+#define ADXL345_REG_INT_ENABLE 0x2E
+#define ADXL345_REG_DATA_FORMAT 0x31
+#define ADXL345_REG_DATA_X0 0x32
+#define ADXL345_REG_DATA_X1 0x33
+#define ADXL345_REG_DATA_Y0 0x34
+#define ADXL345_REG_DATA_Y1 0x35
+#define ADXL345_REG_DATA_Z0 0x36
+#define ADXL345_REG_DATA_Z1 0x37
+
+
+#endif /* BOOZ_ADXL345_H */
Copied: paparazzi3/trunk/sw/airborne/peripherals/ami601.c (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ami601.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/ami601.c
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/ami601.c 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,40 @@
+#include "peripherals/booz_ami601.h"
+
+uint8_t ami601_foo1;
+uint8_t ami601_foo2;
+uint8_t ami601_foo3;
+uint16_t ami601_values[AMI601_NB_CHAN];
+
+volatile uint8_t ami601_status;
+struct i2c_transaction ami601_i2c_trans;
+volatile uint32_t ami601_nb_err;
+
+void ami601_init( void ) {
+
+ uint8_t i;
+ for (i=0; i< AMI601_NB_CHAN; i++) {
+ ami601_values[i] = 0;
+ }
+ ami601_i2c_trans.status = I2CTransSuccess;
+ ami601_i2c_trans.slave_addr = AMI601_SLAVE_ADDR;
+ ami601_i2c_trans.stop_after_transmit = TRUE;
+ ami601_nb_err = 0;
+ ami601_status = AMI601_IDLE;
+
+}
+
+void ami601_read( void ) {
+ if (ami601_status != AMI601_IDLE) {
+ ami601_nb_err++;
+ ami601_status == AMI601_IDLE;
+ }
+ else {
+ ami601_status = AMI601_SENDING_REQ;
+ ami601_i2c_trans.type = I2CTransTx;
+ ami601_i2c_trans.len_w = 3;
+ ami601_i2c_trans.buf[0] = 0x55;
+ ami601_i2c_trans.buf[1] = 0xAA;
+ ami601_i2c_trans.buf[2] = 0x14;
+ i2c_submit(&i2c1, &ami601_i2c_trans);
+ }
+}
Copied: paparazzi3/trunk/sw/airborne/peripherals/ami601.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ami601.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/ami601.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/ami601.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,71 @@
+#ifndef BOOZ_AMI601_H
+#define BOOZ_AMI601_H
+
+#include "std.h"
+#include "i2c.h"
+
+extern void ami601_init( void );
+
+extern void ami601_read( void );
+extern void ami601_periodic( void );
+extern void ami601_scale_measures(void);
+
+#define AMI601_NB_CHAN 6
+extern uint16_t ami601_values[AMI601_NB_CHAN];
+extern uint8_t ami601_foo1;
+extern uint8_t ami601_foo2;
+extern uint8_t ami601_foo3;
+
+#define AMI601_IDLE 0
+#define AMI601_SENDING_REQ 1
+#define AMI601_WAITING_MEASURE 2
+#define AMI601_READING_MEASURE 3
+#define AMI601_DATA_AVAILABLE 4
+extern volatile uint8_t ami601_status;
+extern struct i2c_transaction ami601_i2c_trans;
+extern volatile uint32_t ami601_nb_err;
+
+#define AMI601_SLAVE_ADDR 0x60
+#define AMI601_IT TIR_MR1I
+#define AMI601_ISR() {}
+
+#ifdef SITL
+#define AMI601Event(_handler) {
\
+ if (ami601_status == AMI601_DATA_AVAILABLE) \
+ _handler();
\
+ }
+#else
+#define AMI601Event(_handler) {
\
+ switch (ami601_status) {
\
+ case AMI601_SENDING_REQ :
\
+ if ( ami601_i2c_trans.status == I2CTransSuccess ) {
\
+ ami601_status = AMI601_WAITING_MEASURE;
\
+ }
\
+ break;
\
+ case AMI601_WAITING_MEASURE : \
+ ami601_status = AMI601_READING_MEASURE; \
+ ami601_i2c_trans.type = I2CTransRx;
\
+ ami601_i2c_trans.len_r = 15;
\
+ i2c_submit(&i2c1, &ami601_i2c_trans);
\
+ break; \
+ case AMI601_READING_MEASURE :
\
+ if ( ami601_i2c_trans.status == I2CTransSuccess ) {
\
+ ami601_foo1 = ami601_i2c_trans.buf[0]; /* AA ? */
\
+ ami601_foo2 = ami601_i2c_trans.buf[1]; /* 55 ? */
\
+ ami601_foo3 = ami601_i2c_trans.buf[2]; /* ERR ? */
\
+ uint8_t i;
\
+ for (i=0; i< AMI601_NB_CHAN; i++) {
\
+ ami601_values[i] = ami601_i2c_trans.buf[3 + 2 * i];
\
+ ami601_values[i] += ami601_i2c_trans.buf[3 + 2 * i + 1] * 256;\
+ }
\
+ ami601_status = AMI601_DATA_AVAILABLE;
\
+ _handler();
\
+ }
\
+ break;
\
+ }
\
+}
+#endif
+
+
+
+#endif /* AMI601_H */
Copied: paparazzi3/trunk/sw/airborne/peripherals/hmc5843.c (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_hmc5843.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/hmc5843.c
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/hmc5843.c 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,75 @@
+#include "peripherals/booz_hmc5843.h"
+
+#define HMC5843_TIMEOUT 100
+
+#define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
+
+struct Hmc5843 hmc5843;
+void exti9_5_irq_handler(void);
+
+void hmc5843_init(void)
+{
+ hmc5843.i2c_trans.status = I2CTransSuccess;
+ hmc5843.i2c_trans.slave_addr = HMC5843_ADDR;
+ hmc5843.i2c_trans.stop_after_transmit = TRUE;
+
+ hmc5843_arch_init();
+}
+
+// blocking, only intended to be called for initialization
+static void send_config(void)
+{
+ hmc5843.i2c_trans.type = I2CTransTx;
+ hmc5843.i2c_trans.buf[0] = HMC5843_REG_CFGA; // set to rate to 50Hz
+ hmc5843.i2c_trans.buf[1] = 0x00 | (0x06 << 2);
+ hmc5843.i2c_trans.len_w = 2;
+ i2c_submit(&i2c2,&hmc5843.i2c_trans);
+ while(hmc5843.i2c_trans.status == I2CTransPending);
+
+ hmc5843.i2c_trans.type = I2CTransTx;
+ hmc5843.i2c_trans.buf[0] = HMC5843_REG_CFGB; // set to gain to 1 Gauss
+ hmc5843.i2c_trans.buf[1] = 0x01<<5;
+ hmc5843.i2c_trans.len_w = 2;
+ i2c_submit(&i2c2,&hmc5843.i2c_trans);
+ while(hmc5843.i2c_trans.status == I2CTransPending);
+
+ hmc5843.i2c_trans.type = I2CTransTx;
+ hmc5843.i2c_trans.buf[0] = HMC5843_REG_MODE; // set to continuous mode
+ hmc5843.i2c_trans.buf[1] = 0x00;
+ hmc5843.i2c_trans.len_w = 2;
+ i2c_submit(&i2c2,&hmc5843.i2c_trans);
+ while(hmc5843.i2c_trans.status == I2CTransPending);
+
+}
+
+void hmc5843_idle_task(void)
+{
+ if (hmc5843.initialized && hmc5843.ready_for_read &&
(hmc5843.i2c_trans.status == I2CTransSuccess || hmc5843.i2c_trans.status ==
I2CTransFailed)) {
+ hmc5843.i2c_trans.type = I2CTransRx;
+ hmc5843.i2c_trans.len_r = 7;
+ i2c_submit(&i2c2, &hmc5843.i2c_trans);
+ hmc5843.reading = TRUE;
+ hmc5843.ready_for_read = FALSE;
+ }
+
+ if (hmc5843.reading && hmc5843.i2c_trans.status == I2CTransSuccess) {
+ hmc5843.timeout = 0;
+ hmc5843.data_available = TRUE;
+ hmc5843.reading = FALSE;
+ memcpy(hmc5843.data.buf, (const void *) hmc5843.i2c_trans.buf,
6);
+ for (int i = 0; i < 3; i++) {
+ hmc5843.data.value[i] = bswap_16(hmc5843.data.value[i]);
+ }
+ }
+}
+
+void hmc5843_periodic(void)
+{
+ if (!hmc5843.initialized) {
+ send_config();
+ hmc5843.initialized = TRUE;
+ } else if (hmc5843.timeout++ > HMC5843_TIMEOUT) {
+ hmc5843_arch_reset();
+ hmc5843.timeout = 0;
+ }
+}
Copied: paparazzi3/trunk/sw/airborne/peripherals/hmc5843.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_hmc5843.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/hmc5843.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/hmc5843.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,81 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef BOOZ_HMC5843_H
+#define BOOZ_HMC5843_H
+
+#include "std.h"
+#include "i2c.h"
+
+#include "peripherals/hmc5843_arch.h"
+
+struct Hmc5843 {
+ struct i2c_transaction i2c_trans;
+ union {
+ uint8_t buf[7];
+ int16_t value[3];
+ } data;
+ uint8_t initialized;
+ uint8_t reading;
+ volatile uint8_t ready_for_read;
+ uint8_t data_available;
+ uint32_t timeout;
+};
+
+extern struct Hmc5843 hmc5843;
+
+extern void hmc5843_arch_init( void );
+extern void hmc5843_arch_reset( void );
+
+extern void hmc5843_init(void);
+extern void hmc5843_periodic(void);
+extern void hmc5843_idle_task(void);
+
+/* default I2C address */
+#define HMC5843_ADDR 0x3C
+
+/* Registers */
+#define HMC5843_REG_CFGA 0x00
+#define HMC5843_REG_CFGB 0x01
+#define HMC5843_REG_MODE 0x02
+#define HMC5843_REG_DATXM 0x03
+#define HMC5843_REG_DATXL 0x04
+#define HMC5843_REG_DATYM 0x05
+#define HMC5843_REG_DATYL 0x06
+#define HMC5843_REG_DATZM 0x07
+#define HMC5843_REG_DATZL 0x08
+#define HMC5843_REG_STATUS 0x09
+#define HMC5843_REG_IDA 0x0A
+#define HMC5843_REG_IDB 0x0B
+#define HMC5843_REG_IDC 0x0C
+
+#include <string.h>
+
+#define MagEvent(_m_handler) { \
+ hmc5843_idle_task(); \
+ if (hmc5843.data_available) { \
+ _m_handler(); \
+ } \
+ }
+
+#endif /* BOOZ_HMC5843_H */
Copied: paparazzi3/trunk/sw/airborne/peripherals/itg3200.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_itg3200.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/itg3200.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/itg3200.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,25 @@
+#ifndef BOOZ_ITG3200
+#define BOOZ_ITG3200
+
+/* default I2C address */
+#define ITG3200_ADDR 0xD0
+
+/* Registers */
+#define ITG3200_REG_WHO_AM_I 0X00
+#define ITG3200_REG_SMPLRT_DIV 0X15
+#define ITG3200_REG_DLPF_FS 0X16
+#define ITG3200_REG_INT_CFG 0X17
+#define ITG3200_REG_INT_STATUS 0X1A
+#define ITG3200_REG_TEMP_OUT_H 0X1B
+#define ITG3200_REG_TEMP_OUT_L 0X1C
+#define ITG3200_REG_GYRO_XOUT_H 0X1D
+#define ITG3200_REG_GYRO_XOUT_L 0X1E
+#define ITG3200_REG_GYRO_YOUT_H 0X1F
+#define ITG3200_REG_GYRO_YOUT_L 0X20
+#define ITG3200_REG_GYRO_ZOUT_H 0X21
+#define ITG3200_REG_GYRO_ZOUT_L 0X22
+#define ITG3200_REG_PWR_MGM 0X3E
+
+
+
+#endif /* BOOZ_ITG3200 */
Copied: paparazzi3/trunk/sw/airborne/peripherals/max1168.c (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_max1168.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/max1168.c
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/max1168.c 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "booz_max1168.h"
+
+
+volatile uint8_t booz_max1168_status;
+uint16_t booz_max1168_values[MAX1168_NB_CHAN];
+
+extern void booz_max1168_init( void ) {
+
+ booz_max1168_arch_init();
+
+ uint8_t i;
+ for (i=0; i<MAX1168_NB_CHAN; i++)
+ booz_max1168_values[i] = 0;
+
+ booz_max1168_status = STA_MAX1168_IDLE;
+}
Copied: paparazzi3/trunk/sw/airborne/peripherals/max1168.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_max1168.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/max1168.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/max1168.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,48 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef BOOZ_MAX1168_H
+#define BOOZ_MAX1168_H
+
+#include "std.h"
+
+#define MAX1168_NB_CHAN 8
+
+extern void booz_max1168_init( void );
+
+#define STA_MAX1168_IDLE 0
+#define STA_MAX1168_SENDING_REQ 1
+#define STA_MAX1168_READING_RES 2
+#define STA_MAX1168_DATA_AVAILABLE 3
+extern volatile uint8_t booz_max1168_status;
+
+extern uint16_t booz_max1168_values[MAX1168_NB_CHAN];
+
+/* underlying architecture */
+#include "peripherals/booz_max1168_arch.h"
+/* must be implemented by underlying architecture */
+extern void booz_max1168_arch_init( void );
+extern void booz_max1168_read( void );
+
+
+#endif /* BOOZ_MAX1168_H */
Copied: paparazzi3/trunk/sw/airborne/peripherals/ms2001.c (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ms2001.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/ms2001.c
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/ms2001.c 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "booz_ms2001.h"
+
+volatile uint8_t ms2001_status;
+volatile int16_t ms2001_values[MS2001_NB_AXIS];
+
+void ms2001_init( void ) {
+
+ ms2001_arch_init();
+
+ uint8_t i;
+ for (i=0; i<MS2001_NB_AXIS; i++)
+ ms2001_values[i] = 0;
+ ms2001_status = MS2001_IDLE;
+}
+
+void ms2001_reset() {
+ ms2001_status = MS2001_IDLE;
+}
Copied: paparazzi3/trunk/sw/airborne/peripherals/ms2001.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ms2001.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/ms2001.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/ms2001.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,59 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef BOOZ_MS2001_H
+#define BOOZ_MS2001_H
+
+
+#include "std.h"
+#define MS2001_NB_AXIS 3
+
+extern void ms2001_init( void );
+extern void ms2001_read( void );
+extern void ms2001_reset( void);
+
+#define MS2001_IDLE 0
+#define MS2001_BUSY 1
+#define MS2001_SENDING_REQ 2
+#define MS2001_WAITING_EOC 3
+#define MS2001_GOT_EOC 4
+#define MS2001_READING_RES 5
+#define MS2001_DATA_AVAILABLE 6
+
+extern volatile uint8_t ms2001_status;
+extern volatile int16_t ms2001_values[MS2001_NB_AXIS];
+
+/* underlying architecture */
+#include "peripherals/booz_ms2001_arch.h"
+/* must be implemented by underlying architecture */
+extern void ms2001_arch_init( void );
+
+#define MS2001_DIVISOR_128 2
+#define MS2001_DIVISOR_256 3
+#define MS2001_DIVISOR_512 4
+#define MS2001_DIVISOR_1024 5
+
+#define MS2001_DIVISOR MS2001_DIVISOR_1024
+
+
+#endif /* BOOZ_MS2001_H */
Copied: paparazzi3/trunk/sw/airborne/peripherals/sc18i600.c (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_sc18is600.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/sc18i600.c
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/sc18i600.c 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,10 @@
+#include "booz/peripherals/booz_sc18is600.h"
+
+struct Sc18Is600 sc18is600;
+
+void sc18is600_init(void) {
+
+ sc18is600.status = Sc18Is600Idle;
+ sc18is600_arch_init();
+
+}
Copied: paparazzi3/trunk/sw/airborne/peripherals/sc18i600.h (from rev 6212,
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_sc18is600.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/peripherals/sc18i600.h
(rev 0)
+++ paparazzi3/trunk/sw/airborne/peripherals/sc18i600.h 2010-10-23 21:11:54 UTC
(rev 6213)
@@ -0,0 +1,54 @@
+#ifndef SC18IS600_H
+#define SC18IS600_H
+
+#include "std.h"
+
+/* Register definitions */
+#define Sc18Is600_IOConfig 0x00
+#define Sc18Is600_IOState 0x01
+#define Sc18Is600_I2CClock 0x02
+#define Sc18Is600_I2CTO 0x03
+#define Sc18Is600_I2CStat 0x04
+#define Sc18Is600_I2CAdr 0x05
+
+
+enum Sc18Is600Status {
+ Sc18Is600Idle,
+ Sc18Is600SendingRequest,
+ Sc18Is600WaitingForI2C,
+ Sc18Is600ReadingI2CStat,
+ Sc18Is600ReadingBuffer,
+ Sc18Is600TransactionComplete,
+};
+
+enum Sc18Is600Transaction {
+ Sc18Is600Transmit,
+ Sc18Is600Receive,
+ Sc18Is600Transcieve,
+ Sc18Is600ReadRegister,
+ Sc18Is600WriteRegister,
+};
+#define SC18IS600_BUF_LEN 96
+
+struct Sc18Is600 {
+ enum Sc18Is600Status status;
+ enum Sc18Is600Transaction transaction;
+ uint8_t priv_tx_buf[SC18IS600_BUF_LEN];
+ uint8_t priv_rx_buf[SC18IS600_BUF_LEN];
+ uint8_t rx_len;
+ uint8_t i2c_status;
+};
+
+extern struct Sc18Is600 sc18is600;
+
+extern void sc18is600_init(void);
+extern void sc18is600_transmit(uint8_t addr, uint8_t len);
+extern void sc18is600_receive(uint8_t addr, uint8_t len);
+extern void sc18is600_tranceive(uint8_t addr, uint8_t len_tx, uint8_t len_rx);
+extern void sc18is600_write_to_register(uint8_t addr, uint8_t value);
+extern void sc18is600_read_from_register(uint8_t addr);
+
+#include "peripherals/booz_sc18is600_arch.h"
+extern void sc18is600_arch_init(void);
+
+#endif /* SC18IS600_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [6213] moving peripherals,
Felix Ruess <=