官方提供了很多的参考例程,每个历程分别配置了不同的外设,这里挨个尝试解读一下。
RGB红灯绿灯交替闪烁。
示例文件所在目录:
该示例使用PCC和PORT模块交替切换两个LED。
S32DS自带引脚配置器:pin_mux,就和stm32的cubmux一样,只不过直接集成到这个软件里面了。
当然也可以在这里直接配置时钟:
等等,这一切配置完之后,点生成代码按钮:
生成之后的代码会在这个文件夹下:
很直观的你也可以看到你配置的东西,已经转化成了代码。
很简单:
1、引用生成的代码头文件
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "clockMan1.h"
#include "pin_mux.h"
#if CPU_INIT_CONFIG
#include "Init_Config.h"
#endif
volatile int exit_code = 0;
/* User includes (#include below this line is not maintained by Processor Expert) */
#include <stdint.h>
#include <stdbool.h>
2、根据不同的硬件,条件编译一些define
/* This example is setup to work by default with EVB. To use it with other boards
please comment the following line
*/
#define EVB
#ifdef EVB
#define LED_PORT PORTD
#define GPIO_PORT PTD
#define PCC_CLOCK PCC_PORTD_CLOCK
#define LED1 15U
#define LED2 16U
#else
#define LED_PORT PORTC
#define GPIO_PORT PTC
#define PCC_CLOCK PCC_PORTC_CLOCK
#define LED1 0U
#define LED2 1U
#endif
3、主函数
配置好时钟:
/* Write your code here */
/* Initialize and configure clocks
* - see clock manager component for details
*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
对引脚进行初始化:
/* Initialize pins
* - See PinSettings component for more info
*/
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
/* Output direction for LED0 & LED1 */
PINS_DRV_SetPinsDirection(GPIO_PORT, ((1 << LED1) | (1 << LED2)));
/* Set Output value LED0 & LED1 */
PINS_DRV_SetPins(GPIO_PORT, 1 << LED1);
PINS_DRV_ClearPins(GPIO_PORT, 1 << LED2);
然后进入无限的for循环(这里是和以前while不一样的地方)。
for (;;)
{
/* Insert a small delay to make the blinking visible */
delay(720000);
/* Toggle output value LED0 & LED1 */
PINS_DRV_TogglePins(GPIO_PORT, ((1 << LED1) | (1 << LED2)));
}
/*
* Copyright (c) 2015 - 2016 , Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "clockMan1.h"
#include "pin_mux.h"
#if CPU_INIT_CONFIG
#include "Init_Config.h"
#endif
volatile int exit_code = 0;
/* User includes (#include below this line is not maintained by Processor Expert) */
#include <stdint.h>
#include <stdbool.h>
/* This example is setup to work by default with EVB. To use it with other boards
please comment the following line
*/
#define EVB
#ifdef EVB
#define LED_PORT PORTD
#define GPIO_PORT PTD
#define PCC_CLOCK PCC_PORTD_CLOCK
#define LED1 15U
#define LED2 16U
#else
#define LED_PORT PORTC
#define GPIO_PORT PTC
#define PCC_CLOCK PCC_PORTC_CLOCK
#define LED1 0U
#define LED2 1U
#endif
void delay(volatile int cycles)
{
/* Delay function - do nothing for a number of cycles */
while(cycles--);
}
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - __start (startup asm routine)
* - __init_hardware()
* - main()
* - PE_low_level_init()
* - Common_Init()
* - Peripherals_Init()
*/
int main(void)
{
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* Initialize and configure clocks
* - see clock manager component for details
*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* Initialize pins
* - See PinSettings component for more info
*/
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
/* Output direction for LED0 & LED1 */
PINS_DRV_SetPinsDirection(GPIO_PORT, ((1 << LED1) | (1 << LED2)));
/* Set Output value LED0 & LED1 */
PINS_DRV_SetPins(GPIO_PORT, 1 << LED1);
PINS_DRV_ClearPins(GPIO_PORT, 1 << LED2);
for (;;)
{
/* Insert a small delay to make the blinking visible */
delay(720000);
/* Toggle output value LED0 & LED1 */
PINS_DRV_TogglePins(GPIO_PORT, ((1 << LED1) | (1 << LED2)));
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.1 [05.21]
** for the Freescale S32K series of microcontrollers.
**
** ###################################################################
*/
文章浏览阅读8.7k次,点赞5次,收藏4次。Matlab R2014a使用mcc编译lib文件时出错,Error: Could not check out a Compiler license: SIGN= keyword required but missing from the license certificate. This is probably because the license is older than _2014a mcc license
文章浏览阅读1.1k次。我也是醉了,在各种环境下对PBRT-V3进行了编译和调试。 参考:Q113:PBRT-V3分别在Linux和Mac下的编译与调试(汇总)不过,小编对CodeBlocks“情有独钟”,所以,必须在CodeBlocks下完成这个事情。(注意是Linux系统)一、用cmake生成CodeBlocks的工程文件二、编译三、调试_添加 pbrt vs
文章浏览阅读3.4k次。碰到很多人问Linux版本的Qt怎么不能输入中文。今天解答一下,在我们的ubuntu系统一般大家都是安装的搜狗输入法。而搜狗输入法只能在浏览器或者其他地方能输入中文。在Qtcreator中无法输入中文。解决的方法就是安装其他输入法。以下是具体操作首先看是否已添加中文输入,点你的设置图标进入设置菜单中的语言支持进入语言支持看你的是否已经有汉语(中国),没有则选择下面的添加或删除语言选项,添加汉语简体。然后点击应用到整个系统。接下来Ctrl+Alt+T 调出 Terminal.._qt里怎么弄不出拼音
文章浏览阅读587次。首先解释一下cli_opt_t的这个_t代表结构体可能是type的意思。同时还有很多i_ b_等作为前缀的变量,其中的i_表示int类型的变量,b_表示bool类型的。依次类推。正式进入主题。(A)typedef struct { int b_progress; int i_seek; hnd_t hin; hnd_t hout; FILE_param->rc.f_vbv_buffer_init
文章浏览阅读2.3k次。org.apache.ibatis.exceptions.PersistenceException:### Error querying database. Cause: java.util.ConcurrentModificationException### The error may exist in com/mybatis/mapper/UserMapper.xml### The ..._error querying database. cause: java.util.concurrentmodificationexception
文章浏览阅读450次。本文转自CSDN:https://blog.csdn.net/deiki/article/details/73252942,因为我在为树莓派安装2.4G无线键鼠的时候,鼠标反应很慢,卡顿严重(换成有线鼠标就好了,而且这个无线鼠标在win10上面是正常的),最终按着这位兄弟的办法,解决了,为了记住这个解决方法,特此转到我的博客。 之前在树莓派上试了几款鼠标..._树莓派2.4g鼠标速度如何调节
文章浏览阅读7.3k次。第一. 要向android项目libs文件夹里添加gson-2.2.2.jar文件。 Txt文件中的json字符串:[{"ID":1,"LineColor":-16776961,"FillColor":-16776961,"LineSpan":10,"LineWidth":1,"Display":true,"Selected":true}, {"ID":2,"LineColor_android12 sdcard文件中的字符串
文章浏览阅读629次。唉 ,好久没有写博客了,今天弄一个简单的工具类脚本吧,在我们开发中经常会出现频繁打包测试的功能,对于不懂Unity的一些测试和策划人员来说,他们不会啊,老是麻烦程序也不太好对吧,干脆直接来个工具吧,傻瓜式打包APP吧!哈哈哈~直接上代码~/**************************************************** 文件:BuildApp.cs 作者:LYZY..._一键打包app工具
文章浏览阅读296次。什么是二叉平衡树,如何插入节点,删除节点,说出关键步骤。_什么是二叉平衡树,如何插入节点,删除节点,说出关键步骤。
文章浏览阅读1.9k次。超文本标记语言(HyperText MarkUp Language,HTML)HTML是用来制作网页的标记语言,HTML不需要编译,直接由浏览器解析;HTML文件是一个文本文件,包含了一些HTML元素, 标签等;HTML文件必须使用html或htm为文件名后缀;HTML是大小写不敏感的,HTML与html是一样的。HTML超文本标记语言,通过使用标记来描述文档结构和表现形式的一种语言,由浏览器进行..._java超文本标记语言转义
文章浏览阅读975次。说明LNK1104: 无法打开文件“uiAccess='false' /MANIFESTDEPENDENCY:ty 对于此类型问题现实可能各种原因导致,我目前提供的并不能解决每一位所产生的问题,勿怪。平台:vs2015 - qt5.7.1将通过 qmake -tp vc xxx.pro 产生xxx.vcxproj 通过vs2019打开 并选择对应的工具集编译时,出现LNK1104: 无法打开文件“uiAccess=‘false’ /MANIFESTDEPENDENCY:ty解决方案打开_无法打开文件“uiaccess='false
文章浏览阅读869次。大家装SODBASE CEP Server的时候会发现,它本身就是一个分布式系统,可以非常方便的快速建立分布式运算模型。1. 启用集群方法只要修改sodbase-cep-server-webservice-1.0.1/configuration/configuration/db.properties即可。所有的计算服务器共享了一个状态服务器State Server,也就是db.proper_哪个分布式计算框架支持cep操作