Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ms2100_arch.c
Go to the documentation of this file.
1 /* PNI ms2100 connected on SPI1 */
2 /*
3  IMU b2
4  SS on P1.28
5  RESET on P1.19
6  DRDY on P0.30 ( EINT3)
7 */
8 
9 #include "peripherals/ms2100.h"
10 
12 
13 static void EXTINT_ISR(void) __attribute__((naked));
14 
15 void ms2100_arch_init( void ) {
16 
17  ms2100_cur_axe = 0;
18 
19  /* configure SS pin */
20  Ms2100Unselect(); /* pin idles high */
21  SetBit(MS2100_SS_IODIR, MS2100_SS_PIN); /* pin is output */
22 
23  /* configure RESET pin */
24  Ms2100Reset(); /* pin idles low */
25  SetBit(MS2100_RESET_IODIR, MS2100_RESET_PIN); /* pin is output */
26 
27  /* configure DRDY pin */
28  /* connected pin to EXINT */
30  SetBit(EXTMODE, MS2100_DRDY_EINT); /* EINT is edge trigered */
31  SetBit(EXTPOLAR,MS2100_DRDY_EINT); /* EINT is trigered on rising edge */
32  SetBit(EXTINT,MS2100_DRDY_EINT); /* clear pending EINT */
33 
34  /* initialize interrupt vector */
35  VICIntSelect &= ~VIC_BIT( MS2100_DRDY_VIC_IT ); /* select EINT as IRQ source */
36  VICIntEnable = VIC_BIT( MS2100_DRDY_VIC_IT ); /* enable it */
37  _VIC_CNTL(MS2100_DRDY_VIC_SLOT) = VIC_ENABLE | MS2100_DRDY_VIC_IT;
38  _VIC_ADDR(MS2100_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; // address of the ISR
39 
40 }
41 
42 void EXTINT_ISR(void) {
43  ISR_ENTRY();
44  /* no, we won't do anything asynchronously, so just notify */
46  /* clear EINT */
47  EXTINT = (1<<MS2100_DRDY_EINT);
48  VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */
49  ISR_EXIT();
50 }
#define VICIntSelect
Definition: LPC21xx.h:398
#define MS2100_DRDY_PINSEL_VAL
Definition: booz_1.0.h:146
#define MS2100_DRDY_EINT
Definition: booz_1.0.h:147
#define _VIC_CNTL(idx)
Definition: armVIC.h:19
#define EXTMODE
Definition: LPC21xx.h:387
#define Ms2100Unselect()
Definition: ms2100_arch.h:20
#define MS2100_SS_IODIR
Definition: booz_1.0.h:134
#define _VIC_ADDR(idx)
Definition: armVIC.h:20
#define MS2100_GOT_EOC
Definition: ms2100.h:39
#define EXTPOLAR
Definition: LPC21xx.h:388
#define EXTINT
Definition: LPC21xx.h:385
#define MS2100_RESET_PIN
Definition: booz_1.0.h:138
#define MS2100_DRDY_VIC_IT
Definition: booz_1.0.h:148
#define VICVectAddr
Definition: LPC21xx.h:404
unsigned long uint32_t
Definition: types.h:18
volatile uint8_t ms2100_status
Definition: ms2100.c:26
#define VIC_BIT(chan)
Definition: lpcVIC.h:105
#define MS2100_SS_PIN
Definition: booz_1.0.h:133
volatile uint8_t ms2100_cur_axe
Definition: ms2100_arch.c:11
static void EXTINT_ISR(void)
Definition: ms2100_arch.c:13
unsigned char uint8_t
Definition: types.h:14
#define ISR_EXIT()
Definition: armVIC.h:61
#define VICIntEnable
Definition: LPC21xx.h:399
void ms2100_arch_init(void)
Definition: ms2100_arch.c:39
#define Ms2100Reset()
Definition: ms2100_arch.h:22
#define MS2100_DRDY_PINSEL_BIT
Definition: booz_1.0.h:145
__attribute__((always_inline))
Definition: i2c_arch.c:35
#define MS2100_RESET_IODIR
Definition: booz_1.0.h:139
#define MS2100_DRDY_PINSEL
Definition: booz_1.0.h:144
#define ISR_ENTRY()
Definition: armVIC.h:40
#define VIC_ENABLE
Definition: lpcVIC.h:102