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