mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-31 12:23:23 +08:00
*** empty log message ***
This commit is contained in:
@@ -138,7 +138,7 @@ deb :
|
||||
dpkg-buildpackage -rfakeroot
|
||||
|
||||
clean:
|
||||
find . -name Makefile -mindepth 2 -exec sh -c '$(MAKE) -C `dirname {}` $@' \;
|
||||
find . -mindepth 2 -name Makefile -exec sh -c '$(MAKE) -C `dirname {}` $@' \;
|
||||
find . -name '*~' -exec rm -f {} \;
|
||||
|
||||
dist_clean : clean
|
||||
|
||||
+35
-23
@@ -2,37 +2,49 @@
|
||||
#include "LPC21xx.h"
|
||||
#include "armVIC.h"
|
||||
|
||||
volatile uint16_t adc_val = 000;
|
||||
volatile uint16_t adc0_val[ADC_NB_CHAN] = {0, 0, 0, 0, 0, 0};
|
||||
volatile uint16_t adc1_val[ADC_NB_CHAN] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
void adcInit ( void ) {
|
||||
PINSEL1 |= 0x01 << 22 ; /* P0.27 is AD0.0 */
|
||||
AD0CR = 0x01 | 0x03 << 8 | 0 << 16 | 0x01 << 21 ; /* AD0.0 - PCLK/4 - BURST OFF */
|
||||
/* AD0.0 to AD0.3 as ADC */
|
||||
// PINSEL1 |= 1 << 22 | 1 << 24 | 1 << 26 | 1 << 28;
|
||||
PINSEL1 |= 1 << 12 | 1 << 22 | 1 << 24 | 1 << 26 | 1 << 28;
|
||||
/* AD0.0 to AD0.3 - PCLK/4 - BURST ON */
|
||||
AD0CR = 0x0F | 0x03 << 8 | 1 << 16 | 0x01 << 21 ;
|
||||
|
||||
//#if 0
|
||||
VICIntSelect &= ~VIC_BIT(VIC_AD0); // AD0 selected as IRQ
|
||||
VICIntEnable = VIC_BIT(VIC_AD0); // AD0 interrupt enabled
|
||||
VICIntSelect &= ~VIC_BIT(VIC_AD0); // AD0 selected as IRQ
|
||||
VICIntEnable = VIC_BIT(VIC_AD0); // AD0 interrupt enabled
|
||||
VICVectCntl2 = VIC_ENABLE | VIC_AD0;
|
||||
VICVectAddr2 = (uint32_t)adcISR; // address of the ISR
|
||||
//#endif
|
||||
AD0CR |= 0x01 << 24;
|
||||
VICVectAddr2 = (uint32_t)adcISR0; // address of the ISR
|
||||
|
||||
/* AD1.0 to AD1.3 as ADC */
|
||||
//PINSEL0 |= 3 << 12 ;//| 3 << 16 | 3 << 20 | 3 << 24;
|
||||
// PINSEL1 |= 1 << 12 ;
|
||||
/* AD1.0 to AD1.3 - PCLK/4 - BURST ON */
|
||||
// AD1CR = 0x80 | 0x03 << 8 | 1 << 16 | 0x01 << 21 ;
|
||||
|
||||
// VICIntSelect &= ~VIC_BIT(VIC_AD1); // AD1 selected as IRQ
|
||||
// VICIntEnable = VIC_BIT(VIC_AD1); // AD1 interrupt enabled
|
||||
// VICVectCntl3 = VIC_ENABLE | VIC_AD1;
|
||||
// VICVectAddr3 = (uint32_t)adcISR1; // address of the ISR
|
||||
}
|
||||
|
||||
void adcISR ( void ) {
|
||||
void adcISR0 ( void ) {
|
||||
// perform proper ISR entry so thumb-interwork works properly
|
||||
ISR_ENTRY();
|
||||
adc_val = (uint16_t)(AD0DR >> 6) & 0x03FF;
|
||||
// adc_val = 500;
|
||||
AD0CR |= 0x01 << 24; /* Start A/D Conversion */
|
||||
VICVectAddr = 0x00000000; // clear this interrupt from the VIC
|
||||
ISR_EXIT(); // recover registers and return
|
||||
uint32_t tmp = AD0DR;
|
||||
uint8_t channel = (uint8_t)(tmp >> 24) & 0x07;
|
||||
adc0_val[channel] = (uint16_t)(tmp >> 6) & 0x03FF;
|
||||
VICVectAddr = 0x00000000; // clear this interrupt from the VIC
|
||||
ISR_EXIT(); // recover registers and return
|
||||
}
|
||||
|
||||
uint16_t adcPoll (void) {
|
||||
uint32_t tmp;
|
||||
AD0CR |= 0x01 << 24; /* Start A/D Conversion */
|
||||
do {
|
||||
tmp = AD0DR; /* Read A/D Data Register */
|
||||
} while ((tmp & (0x1 << 31)) == 0); /* Wait for end of A/D Conversion */
|
||||
return (tmp >> 6) & 0x03FF; /* Extract AIN0 Value */
|
||||
void adcISR1 ( void ) {
|
||||
// perform proper ISR entry so thumb-interwork works properly
|
||||
ISR_ENTRY();
|
||||
uint32_t tmp = AD1DR;
|
||||
uint8_t channel = (uint8_t)(tmp >> 24) & 0x07;
|
||||
adc1_val[channel] = (uint16_t)(tmp >> 6) & 0x03FF;
|
||||
VICVectAddr = 0x00000000; // clear this interrupt from the VIC
|
||||
ISR_EXIT(); // recover registers and return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,15 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern volatile uint16_t adc_val;
|
||||
|
||||
void adcInit ( void );
|
||||
uint16_t adcPoll ( void );
|
||||
void adcISR ( void ) __attribute__((naked));
|
||||
void adcISR0 ( void ) __attribute__((naked));
|
||||
void adcISR1 ( void ) __attribute__((naked));
|
||||
|
||||
#define ADC_NB_CHAN 6
|
||||
extern volatile uint16_t adc0_val[ADC_NB_CHAN];
|
||||
extern volatile uint16_t adc1_val[ADC_NB_CHAN];
|
||||
|
||||
|
||||
#endif /* ADC_H */
|
||||
|
||||
@@ -82,9 +82,11 @@ extern void abort(void);
|
||||
#define P0_04_UNUSED_BIT BIT(4) // P0.04 unused - low output
|
||||
#define P0_05_UNUSED_BIT BIT(5) // P0.05 unused - low output
|
||||
#define P0_06_UNUSED_BIT BIT(6) // P0.06 unused - low output
|
||||
#define P0_07_UNUSED_BIT BIT(7) // P0.06 unused - low output
|
||||
#define TXD1_BIT BIT(8) // used by UART1
|
||||
#define RXD1_BIT BIT(9) // used by UART1
|
||||
#define P0_07_UNUSED_BIT BIT(7) // P0.07 unused - low output
|
||||
//#define TXD1_BIT BIT(8) // used by UART1
|
||||
//#define RXD1_BIT BIT(9) // used by UART1
|
||||
#define P0_08_UNUSED_BIT BIT(8) // P0.08 unused - low output
|
||||
#define P0_09_UNUSED_BIT BIT(9) // P0.09 unused - low output
|
||||
#define P0_10_UNUSED_BIT BIT(10) // P0.10 unused - low output
|
||||
#define P0_11_UNUSED_BIT BIT(11) // P0.11 unused - low output
|
||||
#define LED1_BIT BIT(12) // P0.12 LED1 low active
|
||||
@@ -156,7 +158,9 @@ extern void abort(void);
|
||||
P0_05_UNUSED_BIT | \
|
||||
P0_06_UNUSED_BIT | \
|
||||
P0_07_UNUSED_BIT | \
|
||||
P0_10_UNUSED_BIT | \
|
||||
P0_08_UNUSED_BIT | \
|
||||
P0_09_UNUSED_BIT | \
|
||||
P0_10_UNUSED_BIT | \
|
||||
P0_11_UNUSED_BIT | \
|
||||
LED1_BIT | \
|
||||
LED2_BIT | \
|
||||
|
||||
+33
-11
@@ -114,7 +114,7 @@ static void sysInit(void)
|
||||
initSysTime(); // initialize the system timer
|
||||
|
||||
uart0Init(UART_BAUD(HOST_BAUD), UART_8N1, UART_FIFO_8); // setup the UART
|
||||
uart1Init(UART_BAUD(HOST_BAUD), UART_8N1, UART_FIFO_8); // setup the UART
|
||||
// uart1Init(UART_BAUD(HOST_BAUD), UART_8N1, UART_FIFO_8); // setup the UART
|
||||
adcInit();
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ int main(void)
|
||||
uart0Puts("\r\nHello World! (UART0)\r\n");
|
||||
uart0Puts("A WinARM Demo-Application by Martin Thomas\r\n");
|
||||
uart0Puts("based on code from Bill Knight\r\n\r\n");
|
||||
uart1Puts("\r\nHello World! (UART1)\r\n");
|
||||
// uart1Puts("\r\nHello World! (UART1)\r\n");
|
||||
|
||||
for (;;) {
|
||||
do {
|
||||
@@ -227,19 +227,20 @@ int main(void)
|
||||
uart0Putch(ch);
|
||||
uart0Puts("> key has been pressed on UART0\r\n");
|
||||
}
|
||||
if ((ch = uart1Getch()) >= 0) {
|
||||
uart1Puts("the <");
|
||||
uart1Putch(ch);
|
||||
uart1Puts("> key has been pressed on UART1\r\n");
|
||||
}
|
||||
|
||||
|
||||
// if ((ch = uart1Getch()) >= 0) {
|
||||
// uart1Puts("the <");
|
||||
// uart1Putch(ch);
|
||||
// uart1Puts("> key has been pressed on UART1\r\n");
|
||||
// }
|
||||
|
||||
// send button-pressed string only once if hit
|
||||
if (button_state()==0) lock=FALSE; // release lock if button is released
|
||||
|
||||
if ( ((bt=button_state()) > 0 ) && !lock ) {
|
||||
if ( bt & 0x01 ) {
|
||||
uart0Puts("\r\nButton 1 Pressed!\r\n");
|
||||
uart1Puts("\r\nButton 1 Pressed!\r\n");
|
||||
// uart1Puts("\r\nButton 1 Pressed!\r\n");
|
||||
lock=TRUE;
|
||||
}
|
||||
}
|
||||
@@ -254,8 +255,29 @@ int main(void)
|
||||
IO0CLR = LED2_BIT;
|
||||
}
|
||||
uart0Puts("\r\ntick!\r\n");
|
||||
// uint16_t foo = adcPoll();
|
||||
uart0_print_hex_16(adc_val);
|
||||
uart0_print_hex_16(adc0_val[0]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc0_val[1]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc0_val[2]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc0_val[3]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc0_val[4]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc0_val[5]);
|
||||
uart0Puts("\r\n");
|
||||
uart0_print_hex_16(adc1_val[0]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc1_val[1]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc1_val[2]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc1_val[3]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc1_val[4]);
|
||||
uart0Puts(", ");
|
||||
uart0_print_hex_16(adc1_val[5]);
|
||||
uart0Puts("\r\n");
|
||||
startTime += HALF_SEC;
|
||||
} // for
|
||||
|
||||
@@ -84,3 +84,9 @@ modem.cmo : modem.cmi
|
||||
|
||||
%.cmi : %.mli
|
||||
$(OCAMLC) $(INCLUDES) $<
|
||||
|
||||
|
||||
|
||||
wavecard_c : wavecard_c.c wavecard_utils_c.c wavecard_foo_c.c
|
||||
gcc -Wall -o $@ $^ `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user