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
|
||||
*/
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPI_HW_H
|
||||
#define SPI_HW_H
|
||||
#ifndef SPI_ARCH_H
|
||||
#define SPI_ARCH_H
|
||||
|
||||
/** Index in SPI buffers: one is enough for full duplex communication */
|
||||
extern volatile uint8_t spi_idx_buf;
|
||||
@@ -83,4 +83,4 @@ extern volatile uint8_t spi_idx_buf;
|
||||
#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 */
|
||||
MEMMAP = MEMMAP_FLASH;
|
||||
|
||||
|
||||
/* clear all interrupts */
|
||||
VICIntEnClear = 0xFFFFFFFF;
|
||||
/* clear all FIQ selections */
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* for now only SPI1 ( aka SSP )
|
||||
*/
|
||||
|
||||
#ifndef SPI_HW_H
|
||||
#define SPI_HW_H
|
||||
#ifndef SPI_ARCH_H
|
||||
#define SPI_ARCH_H
|
||||
|
||||
#include "std.h"
|
||||
#include "LPC21xx.h"
|
||||
@@ -192,4 +192,4 @@ extern volatile uint8_t spi_rx_idx;
|
||||
#define SpiClrCPHA() (SSPCR0 &= ~(_BV(7)))
|
||||
|
||||
|
||||
#endif /* SPI_HW_H */
|
||||
#endif /* SPI_ARCH_H */
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
#define CONFIG_CLASSIX_H
|
||||
|
||||
/* Master oscillator freq. */
|
||||
#define FOSC (12000000)
|
||||
#define FOSC (12000000)
|
||||
/* PLL multiplier */
|
||||
#define PLL_MUL (5)
|
||||
#define PLL_MUL (5)
|
||||
/* CPU clock freq. */
|
||||
#define CCLK (FOSC * PLL_MUL)
|
||||
#define CCLK (FOSC * PLL_MUL)
|
||||
/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
|
||||
#define PBSD_BITS 0x00
|
||||
#define PBSD_BITS 0x00
|
||||
#define PBSD_VAL 4
|
||||
/* 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_ap_link.h"
|
||||
|
||||
#include "spi_hw.h"
|
||||
#include "mcu_periph/spi_arch.h"
|
||||
|
||||
#include "csc_baro.h"
|
||||
|
||||
|
||||
@@ -169,8 +169,8 @@ void periodic_task_fbw( void ) {
|
||||
fbw_downlink_periodic_task();
|
||||
#endif
|
||||
|
||||
if (!_10Hz) {
|
||||
electrical_periodic();
|
||||
if (!_10Hz) {
|
||||
electrical_periodic();
|
||||
}
|
||||
|
||||
#ifdef ACTUATORS
|
||||
|
||||
@@ -22,18 +22,18 @@ int main( void ) {
|
||||
if (vor_adc_sample_available) {
|
||||
int16_t off_sample = vor_adc_sample - 512;
|
||||
// off_sample *= 2;
|
||||
|
||||
|
||||
vor_int_demod_run (off_sample);
|
||||
|
||||
|
||||
if (vid_qdr_available) {
|
||||
vid_qdr_available = FALSE;
|
||||
main_report();
|
||||
}
|
||||
|
||||
|
||||
VorDacSet(vor_adc_sample);
|
||||
vor_adc_sample_available = FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@
|
||||
void mcu_init(void) {
|
||||
|
||||
mcu_arch_init();
|
||||
|
||||
|
||||
#ifdef PERIPHERALS_AUTO_INIT
|
||||
#ifdef USE_LED
|
||||
led_init();
|
||||
@@ -99,5 +99,5 @@ void mcu_init(void) {
|
||||
spi_init();
|
||||
#endif
|
||||
#endif /* PERIPHERALS_AUTO_INIT */
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
/** \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
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ static struct i2c_transaction atmega_i2c_cam_ctrl_trans;
|
||||
|
||||
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;
|
||||
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];
|
||||
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 */
|
||||
typedef enum {
|
||||
DC_AUTOSHOOT_STOP = 0,
|
||||
DC_AUTOSHOOT_PERIODIC = 1,
|
||||
DC_AUTOSHOOT_PERIODIC = 1,
|
||||
DC_AUTOSHOOT_DISTANCE = 2,
|
||||
DC_AUTOSHOOT_EXT_TRIG = 3
|
||||
} dc_autoshoot_type;
|
||||
@@ -89,7 +89,7 @@ extern uint8_t dc_autoshoot_meter_grid;
|
||||
/* Send Down the coordinates of where the photo was taken */
|
||||
#ifdef SENSOR_SYNC_SEND
|
||||
void dc_send_shot_position(void);
|
||||
#else
|
||||
#else
|
||||
#define dc_send_shot_position() {}
|
||||
#endif
|
||||
|
||||
@@ -109,7 +109,7 @@ static inline void dc_init(void)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
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 */
|
||||
static inline void dc_periodic_4Hz( void )
|
||||
static inline void dc_periodic_4Hz( void )
|
||||
{
|
||||
static uint8_t dc_shutter_timer = 0;
|
||||
|
||||
#ifdef DC_AUTOSHOOT_QUARTERSEC_PERIOD
|
||||
if (dc_autoshoot == DC_AUTOSHOOT_PERIODIC)
|
||||
{
|
||||
if (dc_shutter_timer)
|
||||
if (dc_shutter_timer)
|
||||
{
|
||||
dc_shutter_timer--;
|
||||
} else {
|
||||
@@ -145,6 +145,6 @@ static inline void dc_periodic_4Hz( void )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // DC_H
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
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
|
||||
dc_init();
|
||||
@@ -104,7 +104,7 @@ static inline void dc_send_command(uint8_t cmd)
|
||||
|
||||
|
||||
/* 4Hz Periodic */
|
||||
static inline void led_cam_ctrl_periodic( void )
|
||||
static inline void led_cam_ctrl_periodic( void )
|
||||
{
|
||||
if (dc_timer) {
|
||||
dc_timer--;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "estimator.h"
|
||||
|
||||
|
||||
void atmega_i2c_cam_ctrl_init(void)
|
||||
void atmega_i2c_cam_ctrl_init(void)
|
||||
{
|
||||
dc_init();
|
||||
}
|
||||
@@ -75,16 +75,16 @@ void atmega_i2c_cam_ctrl_send(uint8_t cmd)
|
||||
else if (cmd == DC_GET_STATUS)
|
||||
{
|
||||
mode++;
|
||||
if (mode > 15)
|
||||
if (mode > 15)
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
|
||||
cam_ret[0] = mode + zoom * 0x20;
|
||||
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 "std.h"
|
||||
#include "mcu_periph/spi_hw.h"
|
||||
#include "mcu_periph/spi_arch.h"
|
||||
#include "led.h"
|
||||
|
||||
/* Pin configuration for max3100 IRQ */
|
||||
|
||||
@@ -12,7 +12,7 @@ static struct {
|
||||
struct adc_buf vsupply_adc_buf;
|
||||
#ifdef ADC_CHANNEL_CURRENT
|
||||
struct adc_buf current_adc_buf;
|
||||
#endif
|
||||
#endif
|
||||
} electrical_priv;
|
||||
|
||||
#ifndef VoltageOfAdc
|
||||
@@ -27,7 +27,7 @@ void electrical_init(void) {
|
||||
electrical.vsupply = 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
|
||||
adc_buf_channel(ADC_CHANNEL_CURRENT, &electrical_priv.current_adc_buf, DEFAULT_AV_NB_SAMPLE);
|
||||
#endif
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include "std.h"
|
||||
|
||||
struct Electrical {
|
||||
|
||||
|
||||
uint8_t vsupply; /* supply in decivolts */
|
||||
int32_t current; /* current in miliamps */
|
||||
|
||||
|
||||
};
|
||||
|
||||
extern struct Electrical electrical;
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
#include "generated/airframe.h"
|
||||
|
||||
struct Infrared {
|
||||
/* the 3 channels of the sensor
|
||||
/* the 3 channels of the sensor
|
||||
*/
|
||||
int16_t ir1;
|
||||
int16_t ir2;
|
||||
int16_t ir3;
|
||||
/* neutrals in radians
|
||||
/* neutrals in radians
|
||||
*/
|
||||
float roll_neutral;
|
||||
float pitch_neutral;
|
||||
float pitch_vneutral;
|
||||
/* roll, pitch, yaw unscaled reading
|
||||
/* roll, pitch, yaw unscaled reading
|
||||
*/
|
||||
int16_t roll;
|
||||
int16_t pitch;
|
||||
@@ -51,8 +51,8 @@ struct Infrared {
|
||||
float longitudinal_correction;
|
||||
float vertical_correction;
|
||||
/* coefficients used to compensate
|
||||
for masking
|
||||
*/
|
||||
for masking
|
||||
*/
|
||||
float correction_left;
|
||||
float correction_right;
|
||||
float correction_up;
|
||||
|
||||
Reference in New Issue
Block a user