*** empty log message ***

This commit is contained in:
Antoine Drouin
2006-01-01 20:44:49 +00:00
parent be13cd9522
commit 04e2f9baa9
13 changed files with 160 additions and 46 deletions
+4 -4
View File
@@ -184,10 +184,10 @@ endif
#LPC21ISP = lpc21isp
LPC21ISP = lpc21isp
LPC21ISP_PORT = /dev/ttyS0
#LPC21ISP_BAUD = 115200
#LPC21ISP_XTAL = 14746
LPC21ISP_BAUD = 38400
LPC21ISP_XTAL = 12000
LPC21ISP_BAUD = 115200
LPC21ISP_XTAL = 14746
#LPC21ISP_BAUD = 38400
#LPC21ISP_XTAL = 12000
LPC21ISP_FLASHFILE = $(TARGET).hex
# verbose output:
#LPC21ISP_DEBUG = -debug
+5
View File
@@ -0,0 +1,5 @@
<airframe name="Microjet4">
<makefile>
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
</makefile>
</airframe>
+5
View File
@@ -0,0 +1,5 @@
<airframe name="Twinjet1">
<makefile>
include $(PAPARAZZI_SRC)/conf/autopilot/robostix.makefile
</makefile>
</airframe>
+24
View File
@@ -0,0 +1,24 @@
#ifndef CONFIG_TINY_H
#define CONFIG_TINY_H
#include "types.h"
#include "LPC21xx.h"
/* Master oscillator freq. */
#define FOSC (14745600)
/* PLL multiplier */
#define PLL_MUL (4)
/* CPU clock freq. */
#define CCLK (FOSC * PLL_MUL)
/* Peripheral bus speed divider */
#define PBSD 2
/* Peripheral bus clock freq. */
#define PCLK (CCLK / PBSD)
#define LED_1_BANK 1
#define LED_1_PIN 28
#define LED_2_BANK 1
#define LED_2_PIN 19
#endif /* CONFIG_TINY_H */
View File
+35
View File
@@ -0,0 +1,35 @@
#ifndef LED_HW_H
#define LED_HW_H
#include CONFIG
#include "LPC21xx.h"
#include "std.h"
#define __LED_DIR(i) IO ## i ## DIR
#define _LED_DIR(i) __LED_DIR(i)
#define __LED_CLR(i) IO ## i ## CLR
#define _LED_CLR(i) __LED_CLR(i)
#define __LED_SET(i) IO ## i ## SET
#define _LED_SET(i) __LED_SET(i)
#define __LED_PIN_REG(i) IO ## i ## PIN
#define _LED_PIN_REG(i) __LED_PIN_REG(i)
#define LED_DIR(i) _LED_DIR(LED_ ## i ## _BANK)
#define LED_CLR(i) _LED_CLR(LED_ ## i ## _BANK)
#define LED_SET(i) _LED_SET(LED_ ## i ## _BANK)
#define LED_PIN_REG(i) _LED_PIN_REG(LED_ ## i ## _BANK)
#define LED_PIN(i) LED_ ## i ## _PIN
/* set pin as output */
#define LED_INIT(i) LED_DIR(i) |= _BV(LED_PIN(i))
#define LED_ON(i) LED_CLR(i) = _BV(LED_PIN(i))
#define LED_OFF(i) LED_SET(i) = _BV(LED_PIN(i))
#define LED_TOGGLE(i) { \
if (LED_PIN_REG(i) & _BV(LED_PIN(i))) \
LED_ON(i); \
else \
LED_OFF(i); \
}
#endif /* LED_HW_H */
+8 -11
View File
@@ -24,15 +24,21 @@
/*
*\brief ARM7 low level hardware initialisation
* PLL, IOPORT, MAM, VIC
* PLL, MAM, VIC
*
*/
#ifndef LOW_LEVEL_HW_H
#define LOW_LEVEL_HW_H
#include CONFIG
#include "LPC21xx.h"
#include "config.h"
/* declare functions and values from crt0.S & the linker control file */
extern void reset(void);
/* extern void exit(void); */
extern void abort(void);
static inline void low_level_init(void) {
/* set PLL multiplier & divisor. */
@@ -44,15 +50,6 @@ static inline void low_level_init(void) {
PLLFEED = 0xAA;
PLLFEED = 0x55;
/* setup port pins */
IO0CLR = PIO0_ZERO_BITS; // clear the ZEROs output
IO0SET = PIO0_ONE_BITS; // set the ONEs output
IO0DIR = PIO0_OUTPUT_BITS; // set the output bit direction
IO1CLR = PIO1_ZERO_BITS; // clear the ZEROs output
IO1SET = PIO1_ONE_BITS; // set the ONEs output
IO1DIR = PIO1_OUTPUT_BITS; // set the output bit direction
/* wait for PLL lock */
while (!(PLLSTAT & PLLSTAT_LOCK))
continue;
+1 -6
View File
@@ -32,7 +32,7 @@
#include "std.h"
#include "LPC21xx.h"
#include "config.h" /* PCLK */
#include CONFIG
static uint32_t last_periodic_event;
@@ -53,7 +53,6 @@ static inline void sys_time_init( void ) {
T0EMR = 0;
/* enable timer 0 */
T0TCR = TCR_ENABLE;
// sysTICs = 0;
}
#define SysTicsOfSec(s) (uint32_t)(s * PCLK / T0_PCLK_DIV + 0.5)
@@ -66,10 +65,6 @@ static inline bool_t sys_time_periodic( void ) {
uint32_t now = T0TC;
if (now - last_periodic_event >= PERIODIC_TASK_PERIOD) {
last_periodic_event += PERIODIC_TASK_PERIOD;
if (IO1PIN & LED_1_BIT)
IO1CLR = LED_1_BIT;
else
IO1SET = LED_1_BIT;
return TRUE;
}
return FALSE;
+11 -23
View File
@@ -4,32 +4,20 @@
#include CONFIG
#include <avr/io.h>
#define _LED_PORT(p) PORT ## p
#define LED_PORT(p) _LED_PORT(p)
#define _LED_DDR(p) DDR ## p
#define LED_DDR(p) _LED_DDR(p)
#define __LED_PORT(p) PORT ## p
#define _LED_PORT(p) __LED_PORT(p)
#define __LED_DDR(p) DDR ## p
#define _LED_DDR(p) __LED_DDR(p)
#define LED_X_DDR(x) LED_DDR(LED_ ## x ## _BANK)
#define LED_X_PORT(x) LED_PORT(LED_ ## x ## _BANK)
#define LED_X_PIN(x) LED_ ## x ## _PIN
#define LED_DDR(x) _LED_DDR(LED_ ## x ## _BANK)
#define LED_PORT(x) _LED_PORT(LED_ ## x ## _BANK)
#define LED_PIN(x) LED_ ## x ## _PIN
/* set pin as output */
#define LED_X_INIT(i) LED_X_DDR(i) |= _BV(LED_X_PIN(i))
#define LED_INIT(i) LED_DDR(i) |= _BV(LED_PIN(i))
static inline void led_init ( void ) {
#ifdef LED_1_BANK
LED_X_INIT(1);
#endif /* LED_1_BANK */
#ifdef LED_2_BANK
LED_X_INIT(2);
#endif /* LED_2_BANK */
#ifdef LED_3_BANK
LED_X_INIT(3);
#endif /* LED_3_BANK */
}
#define LED_ON(i) LED_X_PORT(i) &= ~_BV(LED_X_PIN(i))
#define LED_OFF(i) LED_X_PORT(i) |= _BV(LED_X_PIN(i))
#define LED_TOGGLE(i) LED_X_PORT(i) ^= _BV(LED_X_PIN(i))
#define LED_ON(i) LED_PORT(i) &= ~_BV(LED_PIN(i))
#define LED_OFF(i) LED_PORT(i) |= _BV(LED_PIN(i))
#define LED_TOGGLE(i) LED_PORT(i) ^= _BV(LED_PIN(i))
#endif /* LED_HW_H */
+21
View File
@@ -0,0 +1,21 @@
#ifndef LED_H
#define LED_H
#include "led_hw.h"
static inline void led_init ( void ) {
#ifdef LED_1_BANK
LED_INIT(1);
#endif /* LED_1_BANK */
#ifdef LED_2_BANK
LED_INIT(2);
#endif /* LED_2_BANK */
#ifdef LED_3_BANK
LED_INIT(3);
#endif /* LED_3_BANK */
#ifdef LED_4_BANK
LED_INIT(4);
#endif /* LED_4_BANK */
}
#endif /* LED_H */
+13
View File
@@ -0,0 +1,13 @@
#include "main_ap.h"
void init_ap( void ) {
}
void periodic_task_ap( void ) {
}
void event_task_ap( void ) {
}
+29
View File
@@ -0,0 +1,29 @@
#include "main_fbw.h"
#include "low_level_hw.h"
#include "sys_time_hw.h"
#ifdef LED
#include "led.h"
#endif
void init_fbw( void ) {
low_level_init();
sys_time_init();
#ifdef LED
led_init();
#endif /* LED */
#ifndef AP /* if FBW is running in a separate MCU */
#endif /* AP */
}
void periodic_task_fbw( void ) {
LED_TOGGLE(1);
LED_TOGGLE(2);
// LED_TOGGLE(3);
}
void event_task_fbw( void ) {
}
+4 -2
View File
@@ -1,5 +1,3 @@
#ifndef STD_H
#define STD_H
/*
* $Id$
*
@@ -27,6 +25,9 @@
*
*/
#ifndef STD_H
#define STD_H
#include <inttypes.h>
#include <math.h>
@@ -51,6 +52,7 @@ typedef uint8_t bool_t;
#endif
#define NormRadAngle(x) { \
while (x > M_PI) x -= 2 * M_PI; \
while (x < -M_PI) x += 2 * M_PI; \