ssp1.h
Go to the documentation of this file.
1 /*
2  * SocialLedge.com - Copyright (C) 2013
3  *
4  * This file is part of free software framework for embedded processors.
5  * You can use it and/or distribute it as long as this copyright header
6  * remains unmodified. The code is free for personal use and requires
7  * permission to use in a commercial product.
8  *
9  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
10  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
12  * I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
13  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
14  *
15  * You can reach the author of this software at :
16  * p r e e t . w i k i @ g m a i l . c o m
17  */
18 
23 #ifndef SPI1_H_
24 #define SPI1_H_
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "LPC17xx.h"
30 #include "base/ssp_prv.h"
31 
32 
33 
38 static inline void ssp1_init(void)
39 {
40  lpc_pconp(pconp_ssp1, true);
42 
43  ssp_init(LPC_SSP1);
44 
45  void ssp1_dma_init();
46  ssp1_dma_init();
47 }
48 
54 static inline void ssp1_set_max_clock(unsigned int max_clock_mhz)
55 {
56  ssp_set_max_clock(LPC_SSP1, max_clock_mhz);
57 }
58 
64 static inline char ssp1_exchange_byte(char out)
65 {
66  return ssp_exchange_byte(LPC_SSP1, out);
67 }
68 
73 static inline void ssp1_exchange_data(void* data, int len)
74 {
75  ssp_exchange_data(LPC_SSP1, data, len);
76 }
77 
93 unsigned ssp1_dma_transfer_block(unsigned char* pBuffer, uint32_t num_bytes, char is_write_op);
94 
95 
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 #endif /* SPI1_H_ */
unsigned ssp1_dma_transfer_block(unsigned char *pBuffer, uint32_t num_bytes, char is_write_op)
Definition: spi_dma.c:54
void lpc_pclk(lpc_pclk_t peripheral, clkdiv_t divider)
Definition: lpc_peripherals.c:42
void ssp1_dma_init()
Definition: spi_dma.c:46
unsigned int unsigned int len
Definition: startup.cpp:197
Definition: lpc_peripherals.h:109
#define LPC_SSP1
Definition: LPC17xx.h:1030
CMSIS Cortex-M3 Core Peripheral Access Layer Header File for NXP LPC17xx Device Series.
Definition: lpc_peripherals.h:82
Definition: lpc_peripherals.h:46
void lpc_pconp(lpc_pconp_t peripheral, bool on)
Definition: lpc_peripherals.c:30