资源简介
esp8266的HSPI主机例子,工程是基于RTOS的,不过复制到非RTOS也是很简单的。
![](http://www.nz998.com/pic/32011.jpg)
代码片段和文件信息
/*
* ESPRSSIF MIT License
*
* Copyright (c) 2015
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only in which case
* it is free of charge to any person obtaining a copy of this software and associated
* documentation files (the “Software“) to deal in the Software without restriction including
* without limitation the rights to use copy modify merge publish distribute sublicense
* and/or sell copies of the Software and to permit persons to whom the Software is furnished
* to do so subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
* IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER
* IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include “espressif/esp_common.h“
#include “freertos/portmacro.h“
#include “gpio.h“
void gpio_config(GPIO_ConfigTypeDef *pGPIOConfig)
{
uint16 gpio_pin_mask = pGPIOConfig->GPIO_Pin;
uint32 io_reg;
uint8 io_num = 0;
uint32 pin_reg;
if (pGPIOConfig->GPIO_Mode == GPIO_Mode_Input) {
GPIO_AS_INPUT(gpio_pin_mask);
} else if (pGPIOConfig->GPIO_Mode == GPIO_Mode_Output) {
GPIO_AS_OUTPUT(gpio_pin_mask);
}
do {
if ((gpio_pin_mask >> io_num) & 0x1) {
io_reg = GPIO_PIN_REG(io_num);
if ((0x1 << io_num) & (GPIO_Pin_0 | GPIO_Pin_2 | GPIO_Pin_4 | GPIO_Pin_5)) {
PIN_FUNC_SELECT(io_reg 0);
} else {
PIN_FUNC_SELECT(io_reg 3);
}
if (pGPIOConfig->GPIO_Pullup) {
PIN_PULLUP_EN(io_reg);
} else {
PIN_PULLUP_DIS(io_reg);
}
if (pGPIOConfig->GPIO_Mode == GPIO_Mode_Out_OD) {
portENTER_CRITICAL();
pin_reg = GPIO_REG_READ(GPIO_PIN_ADDR(io_num));
pin_reg &= (~GPIO_PIN_DRIVER_MASK);
pin_reg |= (GPIO_PAD_DRIVER_ENABLE << GPIO_PIN_DRIVER_LSB);
GPIO_REG_WRITE(GPIO_PIN_ADDR(io_num) pin_reg);
portEXIT_CRITICAL();
} else if (pGPIOConfig->GPIO_Mode == GPIO_Mode_Sigma_Delta) {
portENTER_CRITICAL();
pin_reg = GPIO_REG_READ(GPIO_PIN_ADDR(io_num));
pin_reg &= (~GPIO_PIN_SOURCE_MASK);
pin_reg |= (0x1 << GPIO_PIN_SOURCE_LSB);
GPIO_REG_WRITE(GPIO_PIN_ADDR(io_num) pin_reg);
GPIO_REG_WRITE(GPIO_SIGMA_DELTA_ADDRESS SIGMA_DELTA_ENABLE);
port
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-07-10 16:14 HSPI_Master\
文件 2947 2018-06-13 16:05 HSPI_Master\Makefile
文件 1815 2018-06-13 16:05 HSPI_Master\README.md
文件 3760 2018-06-13 16:05 HSPI_Master\clean.sh
目录 0 2018-07-10 16:14 HSPI_Master\driver\
文件 1428 2018-06-13 16:05 HSPI_Master\driver\Makefile
文件 7328 2018-06-13 16:05 HSPI_Master\driver\gpio.c
文件 3522 2018-06-13 16:05 HSPI_Master\driver\hw_timer.c
文件 9613 2018-06-13 16:05 HSPI_Master\driver\i2c_master.c
文件 16970 2018-06-13 16:05 HSPI_Master\driver\spi_interface.c
文件 15212 2018-06-13 16:05 HSPI_Master\driver\uart.c
文件 3573 2018-06-13 16:05 HSPI_Master\gen_misc.bat
文件 3791 2018-06-13 16:05 HSPI_Master\gen_misc.sh
目录 0 2018-07-10 16:14 HSPI_Master\include\
目录 0 2018-07-10 16:14 HSPI_Master\include\driver\
文件 9789 2018-06-13 16:05 HSPI_Master\include\driver\gpio.h
文件 9604 2018-06-13 16:05 HSPI_Master\include\driver\gpio.h~
文件 2350 2018-06-13 16:05 HSPI_Master\include\driver\hw_timer.h
文件 3712 2018-06-13 16:05 HSPI_Master\include\driver\i2c_master.h
文件 3708 2018-06-13 16:05 HSPI_Master\include\driver\i2c_master.h~
文件 7745 2018-06-13 16:05 HSPI_Master\include\driver\spi_interface.h
文件 7065 2018-06-13 16:05 HSPI_Master\include\driver\spi_register.h
文件 7834 2018-06-13 16:05 HSPI_Master\include\driver\uart.h
文件 1297 2018-06-13 16:05 HSPI_Master\include\user_config.h
目录 0 2018-07-10 16:14 HSPI_Master\user\
文件 1444 2018-06-13 16:05 HSPI_Master\user\Makefile
文件 4766 2018-06-13 16:05 HSPI_Master\user\user_main.c
- 上一篇:dcraw 1.477
- 下一篇:linux 配置文件读写C
相关资源
- Spire API文档
- The direction of synaptic plasticity mediated
- 飞思卡尔单片机MC9S12XS12G128驱动(硬件
- 51模拟SPI读写SD卡(包括Fat和Fat32文件
- 28335写的用spi读取传感器数据并用CA
- STM32F103 CC2500完整驱动(模拟SPI)
- 手机短信api接口(源代码)
- cs5530的SPI程序
- 9s12单片机SPI功能代码
- stm32 用SPI 方式读写 SDHC
- SPI Master 的Verilog源代码
- Spire.Doc 破解版
- Spin-1目标的广义parton分布的多项式和
- 介子和S波氘核的四极矩以及对spin-1系
- 基于SPCE061A和PTR8000的模拟SPI总线通信
- 用8位spi实现16位spi
- linux SPI设备注册和驱动小结
- 用Verilog语言写的CPLD和MCU通讯的SPI接口
- Spirent iTest用户手册详细介绍iTest的各
- 精确结果为3d N $$ \\ mathcal {N} $$ = 2 S
- 从Poincaré代数的闭合中得
- Temperature dependence of electron-spin cohere
- QCD中三个循环处的Spin-2形状因子
- STM32分别以串口硬件SPI模拟并口驱动
- stm32利用spi驱动tm1803
- 戴尔Inspiron笔记本 摄像头工具webcam
- 戴尔DELL Inspiron 14R N4010网卡驱动 最新
- dell inspiron n4010摄像头驱动 官方最新版
- 戴尔DELL灵越Inspiron N4120快捷键驱动程
- 戴尔DELL灵越Inspiron 14R 5420热键驱动程
评论
共有 条评论