mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 23:49:00 +08:00
Merge branch 'master' of git://github.com/paparazzi/paparazzi
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file spi_hw.c
|
/** \file mcu_periph/spi_arch.c
|
||||||
* \brief handling of hardware dependant SPI on AVR architecture
|
* \brief handling of hardware dependant SPI on AVR architecture
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SPI_HW_H
|
#ifndef SPI_ARCH_H
|
||||||
#define SPI_HW_H
|
#define SPI_ARCH_H
|
||||||
|
|
||||||
/** Index in SPI buffers: one is enough for full duplex communication */
|
/** Index in SPI buffers: one is enough for full duplex communication */
|
||||||
extern volatile uint8_t spi_idx_buf;
|
extern volatile uint8_t spi_idx_buf;
|
||||||
@@ -83,4 +83,4 @@ extern volatile uint8_t spi_idx_buf;
|
|||||||
#endif /* SPI_MASTER */
|
#endif /* SPI_MASTER */
|
||||||
|
|
||||||
|
|
||||||
#endif /* SPI_HW_H */
|
#endif /* SPI_ARCH_H */
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void mcu_arch_init(void) {
|
|||||||
|
|
||||||
/* set the interrupt controller to flash */
|
/* set the interrupt controller to flash */
|
||||||
MEMMAP = MEMMAP_FLASH;
|
MEMMAP = MEMMAP_FLASH;
|
||||||
|
|
||||||
/* clear all interrupts */
|
/* clear all interrupts */
|
||||||
VICIntEnClear = 0xFFFFFFFF;
|
VICIntEnClear = 0xFFFFFFFF;
|
||||||
/* clear all FIQ selections */
|
/* clear all FIQ selections */
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
* for now only SPI1 ( aka SSP )
|
* for now only SPI1 ( aka SSP )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SPI_HW_H
|
#ifndef SPI_ARCH_H
|
||||||
#define SPI_HW_H
|
#define SPI_ARCH_H
|
||||||
|
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "LPC21xx.h"
|
#include "LPC21xx.h"
|
||||||
@@ -192,4 +192,4 @@ extern volatile uint8_t spi_rx_idx;
|
|||||||
#define SpiClrCPHA() (SSPCR0 &= ~(_BV(7)))
|
#define SpiClrCPHA() (SSPCR0 &= ~(_BV(7)))
|
||||||
|
|
||||||
|
|
||||||
#endif /* SPI_HW_H */
|
#endif /* SPI_ARCH_H */
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
#define CONFIG_CLASSIX_H
|
#define CONFIG_CLASSIX_H
|
||||||
|
|
||||||
/* Master oscillator freq. */
|
/* Master oscillator freq. */
|
||||||
#define FOSC (12000000)
|
#define FOSC (12000000)
|
||||||
/* PLL multiplier */
|
/* PLL multiplier */
|
||||||
#define PLL_MUL (5)
|
#define PLL_MUL (5)
|
||||||
/* CPU clock freq. */
|
/* CPU clock freq. */
|
||||||
#define CCLK (FOSC * PLL_MUL)
|
#define CCLK (FOSC * PLL_MUL)
|
||||||
/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
|
/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
|
||||||
#define PBSD_BITS 0x00
|
#define PBSD_BITS 0x00
|
||||||
#define PBSD_VAL 4
|
#define PBSD_VAL 4
|
||||||
/* Peripheral bus clock freq. */
|
/* Peripheral bus clock freq. */
|
||||||
#define PCLK (CCLK / PBSD_VAL)
|
#define PCLK (CCLK / PBSD_VAL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "csc_booz2_ins.h"
|
#include "csc_booz2_ins.h"
|
||||||
#include "csc_ap_link.h"
|
#include "csc_ap_link.h"
|
||||||
|
|
||||||
#include "spi_hw.h"
|
#include "mcu_periph/spi_arch.h"
|
||||||
|
|
||||||
#include "csc_baro.h"
|
#include "csc_baro.h"
|
||||||
|
|
||||||
|
|||||||
@@ -169,8 +169,8 @@ void periodic_task_fbw( void ) {
|
|||||||
fbw_downlink_periodic_task();
|
fbw_downlink_periodic_task();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_10Hz) {
|
if (!_10Hz) {
|
||||||
electrical_periodic();
|
electrical_periodic();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ACTUATORS
|
#ifdef ACTUATORS
|
||||||
|
|||||||
@@ -22,18 +22,18 @@ int main( void ) {
|
|||||||
if (vor_adc_sample_available) {
|
if (vor_adc_sample_available) {
|
||||||
int16_t off_sample = vor_adc_sample - 512;
|
int16_t off_sample = vor_adc_sample - 512;
|
||||||
// off_sample *= 2;
|
// off_sample *= 2;
|
||||||
|
|
||||||
vor_int_demod_run (off_sample);
|
vor_int_demod_run (off_sample);
|
||||||
|
|
||||||
if (vid_qdr_available) {
|
if (vid_qdr_available) {
|
||||||
vid_qdr_available = FALSE;
|
vid_qdr_available = FALSE;
|
||||||
main_report();
|
main_report();
|
||||||
}
|
}
|
||||||
|
|
||||||
VorDacSet(vor_adc_sample);
|
VorDacSet(vor_adc_sample);
|
||||||
vor_adc_sample_available = FALSE;
|
vor_adc_sample_available = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@
|
|||||||
void mcu_init(void) {
|
void mcu_init(void) {
|
||||||
|
|
||||||
mcu_arch_init();
|
mcu_arch_init();
|
||||||
|
|
||||||
#ifdef PERIPHERALS_AUTO_INIT
|
#ifdef PERIPHERALS_AUTO_INIT
|
||||||
#ifdef USE_LED
|
#ifdef USE_LED
|
||||||
led_init();
|
led_init();
|
||||||
@@ -99,5 +99,5 @@ void mcu_init(void) {
|
|||||||
spi_init();
|
spi_init();
|
||||||
#endif
|
#endif
|
||||||
#endif /* PERIPHERALS_AUTO_INIT */
|
#endif /* PERIPHERALS_AUTO_INIT */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/** \file atmega_i2c_cam_ctrl.c
|
/** \file atmega_i2c_cam_ctrl.c
|
||||||
* \brief Interface with digital camera though AVR AtMega chip
|
* \brief Interface with digital camera though AVR AtMega chip
|
||||||
*
|
*
|
||||||
* Send Commands over I2C
|
* Send Commands over I2C
|
||||||
*/
|
*/
|
||||||
@@ -55,7 +55,7 @@ static struct i2c_transaction atmega_i2c_cam_ctrl_trans;
|
|||||||
|
|
||||||
uint8_t atmega_i2c_cam_ctrl_just_sent_command = 0;
|
uint8_t atmega_i2c_cam_ctrl_just_sent_command = 0;
|
||||||
|
|
||||||
void atmega_i2c_cam_ctrl_init(void)
|
void atmega_i2c_cam_ctrl_init(void)
|
||||||
{
|
{
|
||||||
atmega_i2c_cam_ctrl_trans.status = I2CTransDone;
|
atmega_i2c_cam_ctrl_trans.status = I2CTransDone;
|
||||||
dc_init();
|
dc_init();
|
||||||
@@ -89,9 +89,9 @@ void atmega_i2c_cam_ctrl_send(uint8_t cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void atmega_i2c_cam_ctrl_event( void )
|
void atmega_i2c_cam_ctrl_event( void )
|
||||||
{
|
{
|
||||||
if (atmega_i2c_cam_ctrl_trans.status == I2CTransSuccess)
|
if (atmega_i2c_cam_ctrl_trans.status == I2CTransSuccess)
|
||||||
{
|
{
|
||||||
unsigned char cam_ret[1];
|
unsigned char cam_ret[1];
|
||||||
cam_ret[0] = atmega_i2c_cam_ctrl_trans.buf[0];
|
cam_ret[0] = atmega_i2c_cam_ctrl_trans.buf[0];
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static inline void dc_send_command(uint8_t cmd);
|
|||||||
/* Auotmatic Digital Camera Photo Triggering */
|
/* Auotmatic Digital Camera Photo Triggering */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DC_AUTOSHOOT_STOP = 0,
|
DC_AUTOSHOOT_STOP = 0,
|
||||||
DC_AUTOSHOOT_PERIODIC = 1,
|
DC_AUTOSHOOT_PERIODIC = 1,
|
||||||
DC_AUTOSHOOT_DISTANCE = 2,
|
DC_AUTOSHOOT_DISTANCE = 2,
|
||||||
DC_AUTOSHOOT_EXT_TRIG = 3
|
DC_AUTOSHOOT_EXT_TRIG = 3
|
||||||
} dc_autoshoot_type;
|
} dc_autoshoot_type;
|
||||||
@@ -89,7 +89,7 @@ extern uint8_t dc_autoshoot_meter_grid;
|
|||||||
/* Send Down the coordinates of where the photo was taken */
|
/* Send Down the coordinates of where the photo was taken */
|
||||||
#ifdef SENSOR_SYNC_SEND
|
#ifdef SENSOR_SYNC_SEND
|
||||||
void dc_send_shot_position(void);
|
void dc_send_shot_position(void);
|
||||||
#else
|
#else
|
||||||
#define dc_send_shot_position() {}
|
#define dc_send_shot_position() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ static inline void dc_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* shoot on grid */
|
/* shoot on grid */
|
||||||
static inline void dc_shot_on_utm_north_close_to_100m_grid( void )
|
static inline void dc_shot_on_utm_north_close_to_100m_grid( void )
|
||||||
{
|
{
|
||||||
uint32_t dist_to_100m_grid = (gps_utm_north / 100) % 100;
|
uint32_t dist_to_100m_grid = (gps_utm_north / 100) % 100;
|
||||||
if (dist_to_100m_grid < dc_autoshoot_meter_grid || 100 - dist_to_100m_grid < dc_autoshoot_meter_grid)
|
if (dist_to_100m_grid < dc_autoshoot_meter_grid || 100 - dist_to_100m_grid < dc_autoshoot_meter_grid)
|
||||||
@@ -119,14 +119,14 @@ static inline void dc_shot_on_utm_north_close_to_100m_grid( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* periodic 4Hz function */
|
/* periodic 4Hz function */
|
||||||
static inline void dc_periodic_4Hz( void )
|
static inline void dc_periodic_4Hz( void )
|
||||||
{
|
{
|
||||||
static uint8_t dc_shutter_timer = 0;
|
static uint8_t dc_shutter_timer = 0;
|
||||||
|
|
||||||
#ifdef DC_AUTOSHOOT_QUARTERSEC_PERIOD
|
#ifdef DC_AUTOSHOOT_QUARTERSEC_PERIOD
|
||||||
if (dc_autoshoot == DC_AUTOSHOOT_PERIODIC)
|
if (dc_autoshoot == DC_AUTOSHOOT_PERIODIC)
|
||||||
{
|
{
|
||||||
if (dc_shutter_timer)
|
if (dc_shutter_timer)
|
||||||
{
|
{
|
||||||
dc_shutter_timer--;
|
dc_shutter_timer--;
|
||||||
} else {
|
} else {
|
||||||
@@ -145,6 +145,6 @@ static inline void dc_periodic_4Hz( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // DC_H
|
#endif // DC_H
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
extern uint8_t dc_timer;
|
extern uint8_t dc_timer;
|
||||||
|
|
||||||
static inline void led_cam_ctrl_init(void)
|
static inline void led_cam_ctrl_init(void)
|
||||||
{
|
{
|
||||||
// Call common DC init
|
// Call common DC init
|
||||||
dc_init();
|
dc_init();
|
||||||
@@ -104,7 +104,7 @@ static inline void dc_send_command(uint8_t cmd)
|
|||||||
|
|
||||||
|
|
||||||
/* 4Hz Periodic */
|
/* 4Hz Periodic */
|
||||||
static inline void led_cam_ctrl_periodic( void )
|
static inline void led_cam_ctrl_periodic( void )
|
||||||
{
|
{
|
||||||
if (dc_timer) {
|
if (dc_timer) {
|
||||||
dc_timer--;
|
dc_timer--;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "estimator.h"
|
#include "estimator.h"
|
||||||
|
|
||||||
|
|
||||||
void atmega_i2c_cam_ctrl_init(void)
|
void atmega_i2c_cam_ctrl_init(void)
|
||||||
{
|
{
|
||||||
dc_init();
|
dc_init();
|
||||||
}
|
}
|
||||||
@@ -75,16 +75,16 @@ void atmega_i2c_cam_ctrl_send(uint8_t cmd)
|
|||||||
else if (cmd == DC_GET_STATUS)
|
else if (cmd == DC_GET_STATUS)
|
||||||
{
|
{
|
||||||
mode++;
|
mode++;
|
||||||
if (mode > 15)
|
if (mode > 15)
|
||||||
mode = 0;
|
mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cam_ret[0] = mode + zoom * 0x20;
|
cam_ret[0] = mode + zoom * 0x20;
|
||||||
RunOnceEvery(6,DOWNLINK_SEND_PAYLOAD(DefaultChannel, 1, cam_ret ));
|
RunOnceEvery(6,DOWNLINK_SEND_PAYLOAD(DefaultChannel, 1, cam_ret ));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void atmega_i2c_cam_ctrl_event( void )
|
void atmega_i2c_cam_ctrl_event( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "mcu_periph/spi_hw.h"
|
#include "mcu_periph/spi_arch.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
|
||||||
/* Pin configuration for max3100 IRQ */
|
/* Pin configuration for max3100 IRQ */
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ static struct {
|
|||||||
struct adc_buf vsupply_adc_buf;
|
struct adc_buf vsupply_adc_buf;
|
||||||
#ifdef ADC_CHANNEL_CURRENT
|
#ifdef ADC_CHANNEL_CURRENT
|
||||||
struct adc_buf current_adc_buf;
|
struct adc_buf current_adc_buf;
|
||||||
#endif
|
#endif
|
||||||
} electrical_priv;
|
} electrical_priv;
|
||||||
|
|
||||||
#ifndef VoltageOfAdc
|
#ifndef VoltageOfAdc
|
||||||
@@ -27,7 +27,7 @@ void electrical_init(void) {
|
|||||||
electrical.vsupply = 0;
|
electrical.vsupply = 0;
|
||||||
electrical.current = 0;
|
electrical.current = 0;
|
||||||
|
|
||||||
adc_buf_channel(ADC_CHANNEL_VSUPPLY, &electrical_priv.vsupply_adc_buf, DEFAULT_AV_NB_SAMPLE);
|
adc_buf_channel(ADC_CHANNEL_VSUPPLY, &electrical_priv.vsupply_adc_buf, DEFAULT_AV_NB_SAMPLE);
|
||||||
#ifdef ADC_CHANNEL_CURRENT
|
#ifdef ADC_CHANNEL_CURRENT
|
||||||
adc_buf_channel(ADC_CHANNEL_CURRENT, &electrical_priv.current_adc_buf, DEFAULT_AV_NB_SAMPLE);
|
adc_buf_channel(ADC_CHANNEL_CURRENT, &electrical_priv.current_adc_buf, DEFAULT_AV_NB_SAMPLE);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#include "std.h"
|
#include "std.h"
|
||||||
|
|
||||||
struct Electrical {
|
struct Electrical {
|
||||||
|
|
||||||
uint8_t vsupply; /* supply in decivolts */
|
uint8_t vsupply; /* supply in decivolts */
|
||||||
int32_t current; /* current in miliamps */
|
int32_t current; /* current in miliamps */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct Electrical electrical;
|
extern struct Electrical electrical;
|
||||||
|
|||||||
@@ -29,17 +29,17 @@
|
|||||||
#include "generated/airframe.h"
|
#include "generated/airframe.h"
|
||||||
|
|
||||||
struct Infrared {
|
struct Infrared {
|
||||||
/* the 3 channels of the sensor
|
/* the 3 channels of the sensor
|
||||||
*/
|
*/
|
||||||
int16_t ir1;
|
int16_t ir1;
|
||||||
int16_t ir2;
|
int16_t ir2;
|
||||||
int16_t ir3;
|
int16_t ir3;
|
||||||
/* neutrals in radians
|
/* neutrals in radians
|
||||||
*/
|
*/
|
||||||
float roll_neutral;
|
float roll_neutral;
|
||||||
float pitch_neutral;
|
float pitch_neutral;
|
||||||
float pitch_vneutral;
|
float pitch_vneutral;
|
||||||
/* roll, pitch, yaw unscaled reading
|
/* roll, pitch, yaw unscaled reading
|
||||||
*/
|
*/
|
||||||
int16_t roll;
|
int16_t roll;
|
||||||
int16_t pitch;
|
int16_t pitch;
|
||||||
@@ -51,8 +51,8 @@ struct Infrared {
|
|||||||
float longitudinal_correction;
|
float longitudinal_correction;
|
||||||
float vertical_correction;
|
float vertical_correction;
|
||||||
/* coefficients used to compensate
|
/* coefficients used to compensate
|
||||||
for masking
|
for masking
|
||||||
*/
|
*/
|
||||||
float correction_left;
|
float correction_left;
|
||||||
float correction_right;
|
float correction_right;
|
||||||
float correction_up;
|
float correction_up;
|
||||||
|
|||||||
Reference in New Issue
Block a user