ISSDK  1.8
IoT Sensing Software Development Kit
lpc55s16.c
Go to the documentation of this file.
1 /*
2  * Copyright 2019 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /**
9  * @file lpc55s16.c
10  * @brief The lpc55s16.c file defines GPIO pins and I2C CMSIS utilities for LPCXpresso55s16 board.
11  */
12 
13 #include "lpc55s16.h"
14 
15 // I2C4 Pin Handles
16 /* [PIO1_21] (coords: 30) configured as FC4_RXD_SDA_MOSI */
18  .pinNumber = 21,
19  .mask = 1 << (21),
20  .clockName = kCLOCK_Gpio1,
21  .portNumber = kGINT_Port1};
22 /* [PIO1_20] (coords: 4) configured as FC4_TXD_SCL_MISO */
24  .pinNumber = 20,
25  .mask = 1 << (20),
26  .clockName = kCLOCK_Gpio1,
27  .portNumber = kGINT_Port1};
28 
29 // SPI7 Handle
30 /* [PIO0_20] (coords: 74) configured as SPI master-out/slave-in (MOSI) data */
32  .pinNumber = 20,
33  .mask = 1 << (20),
34  .clockName = kCLOCK_Gpio0,
35  .portNumber = kGINT_Port0};
36 /* [PIO0_19] (coords: 90) is configured as SPI master-in/slave-out (MISO) data */
38  .pinNumber = 19,
39  .mask = 1 << (19),
40  .clockName = kCLOCK_Gpio0,
41  .portNumber = kGINT_Port0};
42 /* [PIO0_21] (coords: 76) configured as SPI SCK */
44  .pinNumber = 21,
45  .mask = 1 << (21),
46  .clockName = kCLOCK_Gpio0,
47  .portNumber = kGINT_Port0};
48 
49 // UART0 Handle
50 /* [PIO0_29] (coords: 92) configured as USART RXD */
52  .pinNumber = 29,
53  .mask = 1 << (29),
54  .clockName = kCLOCK_Gpio0,
55  .portNumber = kGINT_Port0};
56 /* [PIO0_30] (coords: 94) configured as USART TXD */
58  .pinNumber = 30,
59  .mask = 1 << (30),
60  .clockName = kCLOCK_Gpio0,
61  .portNumber = kGINT_Port0};
62 
63 // LPCXpresso55s69 Internal Peripheral Pin Definitions
65  .pinNumber = 4,
66  .mask = 1 << (4),
67  .clockName = kCLOCK_Gpio1,
68  .portNumber = kGINT_Port1};
70  .pinNumber = 7,
71  .mask = 1 << (7),
72  .clockName = kCLOCK_Gpio1,
73  .portNumber = kGINT_Port1};
75  .pinNumber = 6,
76  .mask = 1 << (6),
77  .clockName = kCLOCK_Gpio1,
78  .portNumber = kGINT_Port1};
79 
80 /*!
81  * @brief Kinetis style Wrapper API for handling all Clock related configurations.
82  *
83  * @param void
84  * @return void
85  */
87 {
88  /* attach 12 MHz clock to FLEXCOMM0 (debug/UART0) */
89  CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
90  /* attach 12 MHz clock to FLEXCOMM4 (I2C4) */
91  CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
92  /* attach 12 MHz clock to FLEXCOMM4 (SPI7) */
93  CLOCK_AttachClk(kFRO12M_to_FLEXCOMM7);
94  /* Configure FROHF96M Clock */
95  BOARD_BootClockPLL150M();
96 }
97 
98 /*!
99  * @brief Configures the system to WAIT power mode.
100  * API name used from Kinetis family to maintain compatibility.
101  *
102  * @param Power peripheral base address (dummy).
103  * @return Configuration error code.
104  */
105 status_t SMC_SetPowerModeWait(void *arg)
106 {
107  //POWER_EnterSleep();
108 
109  return kStatus_Success;
110 }
111 
112 /*!
113  * @brief Configures the system to VLPR power mode.
114  * API name used from Kinetis family to maintain compatibility.
115  *
116  * @param Power peripheral base address (dummy).
117  * @return Configuration error code.
118  */
119 status_t SMC_SetPowerModeVlpr(void *arg)
120 {
121  POWER_EnterSleep();
122 
123  return kStatus_Success;
124 }
125 
126 /*! @brief Determines the Clock Frequency feature.
127  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
128  * @param[in] void
129  * @Constraints None
130  * @Reentrant Yes
131  * @return uint32_t Returns the clock frequency .
132  */
133 uint32_t USART0_GetFreq(void)
134 {
135  return CLOCK_GetFlexCommClkFreq(0U);
136 }
137 
138 /*! @brief Determines the Clock Frequency feature.
139  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
140  * @param[in] void
141  * @Constraints None
142  * @Reentrant Yes
143  * @return uint32_t Returns the clock frequency .
144  */
145 uint32_t I2C4_GetFreq(void)
146 {
147  return CLOCK_GetFlexCommClkFreq(4U);
148 }
149 
150 /*! @brief Determines the Clock Frequency feature.
151  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
152  * @param[in] void
153  * @Constraints None
154  * @Reentrant Yes
155  * @return uint32_t Returns the clock frequency .
156  */
157 uint32_t SPI7_GetFreq(void)
158 {
159  return CLOCK_GetFlexCommClkFreq(7U);
160 }
uint32_t SPI7_GetFreq(void)
Determines the Clock Frequency feature.
Definition: lpc55s16.c:157
gpioHandleKSDK_t D1
Definition: lpc55s16.c:57
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
Definition: lpc55s16.c:119
The lpc55s16.h file defines GPIO pin mappings for LPCXpresso55S16 board.
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
Definition: lpc55s16.c:105
gpioHandleKSDK_t D13
Definition: lpc55s16.c:43
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:49
gpioHandleKSDK_t D15
Definition: lpc55s16.c:23
gpioHandleKSDK_t D14
Definition: lpc55s16.c:17
gpioHandleKSDK_t D0
Definition: lpc55s16.c:51
GPIO_Type * base
Definition: gpio_driver.h:51
gpioHandleKSDK_t RED_LED
Definition: lpc55s16.c:64
uint32_t USART0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: lpc55s16.c:133
uint32_t I2C4_GetFreq(void)
Determines the Clock Frequency feature.
Definition: lpc55s16.c:145
gpioHandleKSDK_t D11
Definition: lpc55s16.c:31
void BOARD_BootClockRUN(void)
Kinetis style Wrapper API for handling all Clock related configurations.
Definition: lpc55s16.c:86
gpioHandleKSDK_t D12
Definition: lpc55s16.c:37
gpioHandleKSDK_t GREEN_LED
Definition: lpc55s16.c:69
gpioHandleKSDK_t BLUE_LED
Definition: lpc55s16.c:74