ssp0.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 SPI0_H__
24 #define SPI0_H__
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "LPC17xx.h"
30 #include "sys_config.h"
31 #include "base/ssp_prv.h"
32 
33 
34 
39 static inline void ssp0_init(unsigned int max_clock_mhz)
40 {
41  // @note Pins are initialized by bio.h
42  lpc_pconp(pconp_ssp0, true);
44  ssp_init(LPC_SSP0);
45 }
46 
53 static inline void ssp0_set_max_clock(unsigned int max_clock_mhz)
54 {
55  ssp_set_max_clock(LPC_SSP0, max_clock_mhz);
56 }
57 
58 
64 static inline char ssp0_exchange_byte(char out)
65 {
66  return ssp_exchange_byte(LPC_SSP0, out);
67 }
68 
72 static inline void ssp0_exchange_data(void *data, int len)
73 {
74  ssp_exchange_data(LPC_SSP0, data, len);
75 }
76 
77 
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 #endif /* SPI0_H__ */
void lpc_pclk(lpc_pclk_t peripheral, clkdiv_t divider)
Definition: lpc_peripherals.c:42
unsigned int unsigned int len
Definition: startup.cpp:197
Definition: lpc_peripherals.h:94
Definition: lpc_peripherals.h:109
This file provides the configurable parameters for your project.
CMSIS Cortex-M3 Core Peripheral Access Layer Header File for NXP LPC17xx Device Series.
Definition: lpc_peripherals.h:58
#define LPC_SSP0
Definition: LPC17xx.h:1029
void lpc_pconp(lpc_pconp_t peripheral, bool on)
Definition: lpc_peripherals.c:30