资源简介
orangpi zero的gpio接口wiringOP_zero,亲测点亮LED成功,香橙派的gpio资料太少了,靠大家一起分享。
代码片段和文件信息
/*
* ds1302.c:
* Real Time clock
*
* Copyright (c) 2013 Gordon Henderson.
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation either version 3 of the License or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not see .
***********************************************************************
*/
#include
#include
#include
#include
#include
#include “ds1302.h“
// Register defines
#define RTC_SECS 0
#define RTC_MINS 1
#define RTC_HOURS 2
#define RTC_DATE 3
#define RTC_MONTH 4
#define RTC_DAY 5
#define RTC_YEAR 6
#define RTC_WP 7
#define RTC_TC 8
#define RTC_BM 31
// Locals
static int dPin cPin sPin ;
/*
* dsShiftIn:
* Shift a number in from the chip LSB first. Note that the data is
* sampled on the trailing edge of the last clock so it‘s valid immediately.
*********************************************************************************
*/
static unsigned int dsShiftIn (void)
{
uint8_t value = 0 ;
int i ;
pinMode (dPin INPUT) ; delayMicroseconds (1) ;
for (i = 0 ; i < 8 ; ++i)
{
value |= (digitalRead (dPin) << i) ;
digitalWrite (cPin HIGH) ; delayMicroseconds (1) ;
digitalWrite (cPin LOW) ; delayMicroseconds (1) ;
}
return value;
}
/*
* dsShiftOut:
* A normal LSB-first shift-out just slowed down a bit - the Pi is
* a bit faster than the chip can handle.
*********************************************************************************
*/
static void dsShiftOut (unsigned int data)
{
int i ;
pinMode (dPin OUTPUT) ;
for (i = 0 ; i < 8 ; ++i)
{
digitalWrite (dPin data & (1 << i)) ; delayMicroseconds (1) ;
digitalWrite (cPin HIGH) ; delayMicroseconds (1) ;
digitalWrite (cPin LOW) ; delayMicroseconds (1) ;
}
}
/*
* ds1302regRead: ds1302regWrite:
* Read/Write a value to an RTC Register or RAM location on the chip
*********************************************************************************
*/
static unsigned int ds1302regRead (const int reg)
{
unsigned int data ;
digitalWrite (sPin HIGH) ; delayMicroseconds (1) ;
dsShiftOut (reg) ;
data = dsShiftIn () ;
digitalWrite (sPin LOW) ; delayMicroseconds (1) ;
return data ;
}
static void ds1302regWrite (const int reg const unsign
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-01-17 14:46 WiringOP-zero\
文件 52 2017-01-04 10:11 WiringOP-zero\.gitignore
文件 2136 2017-01-04 10:11 WiringOP-zero\build
文件 7651 2017-01-04 10:11 WiringOP-zero\COPYING.LESSER
目录 0 2017-01-04 10:11 WiringOP-zero\debian\
文件 154 2017-01-04 10:11 WiringOP-zero\debian\changelog
文件 2 2017-01-04 10:11 WiringOP-zero\debian\compat
文件 2457 2017-01-04 10:11 WiringOP-zero\debian\control
文件 1405 2017-01-04 10:11 WiringOP-zero\debian\copyright
文件 10 2017-01-04 10:11 WiringOP-zero\debian\docs
文件 20 2017-01-04 10:11 WiringOP-zero\debian\gpio.install
文件 12 2017-01-04 10:11 WiringOP-zero\debian\libwiringop-dev.dirs
文件 14 2017-01-04 10:11 WiringOP-zero\debian\libwiringop-dev.install
文件 8 2017-01-04 10:11 WiringOP-zero\debian\libwiringop2.dirs
文件 52 2017-01-04 10:11 WiringOP-zero\debian\libwiringop2.install
文件 3968 2017-01-04 10:11 WiringOP-zero\debian\libwiringop2.symbols
文件 58 2017-01-04 10:11 WiringOP-zero\debian\libwiringopdev2.install
文件 1046 2017-01-04 10:11 WiringOP-zero\debian\rules
目录 0 2017-01-04 10:11 WiringOP-zero\debian\source\
文件 13 2017-01-04 10:11 WiringOP-zero\debian\source\format
目录 0 2017-01-04 10:11 WiringOP-zero\devLib\
文件 5866 2017-01-04 10:11 WiringOP-zero\devLib\ds1302.c
文件 1673 2017-01-04 10:11 WiringOP-zero\devLib\ds1302.h
文件 2568 2017-01-04 10:11 WiringOP-zero\devLib\ds1302.o
文件 55558 2017-01-04 10:11 WiringOP-zero\devLib\font.h
文件 4119 2017-01-04 10:11 WiringOP-zero\devLib\gertboard.c
文件 1484 2017-01-04 10:11 WiringOP-zero\devLib\gertboard.h
文件 1440 2017-01-04 10:11 WiringOP-zero\devLib\gertboard.o
文件 11549 2017-01-04 10:11 WiringOP-zero\devLib\lcd.c
文件 2095 2017-01-04 10:11 WiringOP-zero\devLib\lcd.h
文件 3884 2017-01-04 10:11 WiringOP-zero\devLib\lcd.o
............此处省略199个文件信息
- 上一篇:MSP430简单计算器的实现
- 下一篇:存储器读写程序代码及实验要求
相关资源
- 树莓派3B+ 网页控制GPIOWebOPirpi3-webiop
- gpioDemo.rar
- 嵌入式Linux用户态操作GPIO接口代码和
- AR9331在OpenWRT下的GPIO驱动及应用开发新
- STM32F103+VL53L0源代码.zip
- stm32 gpio模拟i2c_slave
- FRDM_KL26 VLPR模式GPIO唤醒
- SFF-8485 串行GPIOSGPIO总线规范-中文版
- GPIO模拟MIPI RFFE
- DSP2812用GPIO口模拟I2C协议
- DSP6678GPIO中断程序
- Linux驱动开发 用IO内存操作GPIO控制L
- IMX6_GPIOS
- 适用于海思3516a的gpio驱动
- stm32电调gpio
- 电子-gpio.h
- wiringPi_v2.3.1.rar
- RDA5807驱动(包含用GPIO模拟I2C的程序)
- 海思hi3536的GPIO驱动
- 基于EP9315核心板GPIO驱动
- GPIO驱动程序
- GPIO输出实验-流水灯实验 ARM
- 海思GPIO模拟I2C底层驱动,适应海思所
- 基于linux的GPIO子系统,使用poll函数监
- 树莓派-通过Web控制GPIO针脚输出高低电
评论
共有 条评论