Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
max11040_hw.h
Go to the documentation of this file.
1 
2 #ifndef MAX11040_HW_H
3 #define MAX11040_HW_H
4 
5 
6 #include "LPC21xx.h"
7 #include "interrupt_hw.h"
8 #include "ssp_hw.h"
9 #include "generated/airframe.h"
10 #include BOARD_CONFIG
11 
12 
13 #define MAXM_DIVISOR_128 2
14 #define MAXM_DIVISOR_256 3
15 #define MAXM_DIVISOR_512 4
16 #define MAXM_DIVISOR_1024 5
17 
18 #define MAXM_DIVISOR MAXM_DIVISOR_512
19 
20 /* ssp input clock 468.75kHz, clock that divided by SCR+1 */
21 #define SSP_CLOCK 468750
22 
23 /* SSPCR0 settings */
24 #define SSP_DDS 0x07 << 0 /* data size : 8 bits */
25 #define SSP_FRF 0x00 << 4 /* frame format : SPI */
26 #define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */
27 #define SSP_CPHA 0x01 << 7 /* clock phase : SCK idles low */
28 #define SSP_SCR 0x00 << 8 /* serial clock rate : divide by 16 */
29 
30 /* SSPCR1 settings */
31 #define SSP_LBM 0x00 << 0 /* loopback mode : disabled */
32 #define SSP_SSE 0x00 << 1 /* SSP enable : disabled */
33 #define SSP_MS 0x00 << 2 /* master slave mode : master */
34 #define SSP_SOD 0x00 << 3 /* slave output disable : don't care when master */
35 
36 #define SSPCR0_VAL (SSP_DDS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR )
37 #define SSPCR1_VAL (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD )
38 
39 #define SSP_PINSEL1_SCK (2<<2)
40 #define SSP_PINSEL1_MISO (2<<4)
41 #define SSP_PINSEL1_MOSI (2<<6)
42 #define SSP_PINSEL1_SSEL (2<<8)
43 
44 #define SSP_Enable() SetBit(SSPCR1, SSE);
45 #define SSP_Disable() ClearBit(SSPCR1, SSE);
46 #define SSP_EnableRxi() SetBit(SSPIMSC, RXIM)
47 #define SSP_DisableRxi() ClearBit(SSPIMSC, RXIM)
48 #define SSP_ClearRxi() SetBit(SSPICR, RXIM);
49 #define SSP_EnableTxi() SetBit(SSPIMSC, TXIM)
50 #define SSP_DisableTxi() ClearBit(SSPIMSC, TXIM)
51 #define SSP_ClearTxi() SetBit(SSPICR, TXIM);
52 #define SSP_EnableRti() SetBit(SSPIMSC, RTIM);
53 #define SSP_DisableRti() ClearBit(SSPIMSC, RTIM);
54 #define SSP_ClearRti() SetBit(SSPICR, RTIC);
55 
56 #define MaxmSelect() SetBit(MAXM_SS_IOCLR, MAXM_SS_PIN)
57 #define MaxmUnselect() SetBit(MAXM_SS_IOSET, MAXM_SS_PIN)
58 
59 
60 void max11040_hw_init( void );
61 
62 #endif /* MAX11040_HW_H */
63 
void max11040_hw_init(void)
Definition: max11040_hw.c:273