DEV_Config.h (3244B)
1 /***************************************************************************** 2 * | File : DEV_Config.h 3 * | Author : Waveshare team 4 * | Function : Hardware underlying interface 5 * | Info : 6 * Used to shield the underlying layers of each master 7 * and enhance portability 8 *---------------- 9 * | This version: V2.0 10 * | Date : 2018-10-30 11 * | Info : 12 * 1.add: 13 * UBYTE\UWORD\UDOUBLE 14 * 2.Change: 15 * EPD_RST -> EPD_RST_PIN 16 * EPD_DC -> EPD_DC_PIN 17 * EPD_CS -> EPD_CS_PIN 18 * EPD_BUSY -> EPD_BUSY_PIN 19 * 3.Remote: 20 * EPD_RST_1\EPD_RST_0 21 * EPD_DC_1\EPD_DC_0 22 * EPD_CS_1\EPD_CS_0 23 * EPD_BUSY_1\EPD_BUSY_0 24 * 3.add: 25 * #define DEV_Digital_Write(_pin, _value) bcm2835_GPIOI_write(_pin, _value) 26 * #define DEV_Digital_Read(_pin) bcm2835_GPIOI_lev(_pin) 27 * #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value) 28 # 29 # Permission is hereby granted, free of charge, to any person obtaining a copy 30 # of this software and associated documnetation files (the "Software"), to deal 31 # in the Software without restriction, including without limitation the rights 32 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 33 # copies of the Software, and to permit persons to whom the Software is 34 # furished to do so, subject to the following conditions: 35 # 36 # The above copyright notice and this permission notice shall be included in 37 # all copies or substantial portions of the Software. 38 # 39 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 40 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 41 # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 42 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 43 # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 44 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 45 # THE SOFTWARE. 46 # 47 ******************************************************************************/ 48 #ifndef _DEV_CONFIG_H_ 49 #define _DEV_CONFIG_H_ 50 51 #include <stdint.h> 52 #include <stdio.h> 53 #include <unistd.h> 54 #include <errno.h> 55 #include <stdio.h> 56 #include <string.h> 57 #include "Debug.h" 58 59 #ifdef RPI 60 #ifdef USE_BCM2835_LIB 61 #include <bcm2835.h> 62 #elif USE_WIRINGPI_LIB 63 #include <wiringPi.h> 64 #include <wiringPiSPI.h> 65 #elif USE_DEV_LIB 66 #include "RPI_sysfs_gpio.h" 67 #include "dev_hardware_SPI.h" 68 #endif 69 #endif 70 71 #ifdef JETSON 72 #ifdef USE_DEV_LIB 73 #include "sysfs_gpio.h" 74 #include "sysfs_software_spi.h" 75 #elif USE_HARDWARE_LIB 76 77 #endif 78 79 #endif 80 81 /** 82 * data 83 **/ 84 #define UBYTE uint8_t 85 #define UWORD uint16_t 86 #define UDOUBLE uint32_t 87 88 /** 89 * GPIOI config 90 **/ 91 extern int EPD_RST_PIN; 92 extern int EPD_DC_PIN; 93 extern int EPD_CS_PIN; 94 extern int EPD_BUSY_PIN; 95 96 /*------------------------------------------------------------------------------------------------------*/ 97 void DEV_Digital_Write(UWORD Pin, UBYTE Value); 98 UBYTE DEV_Digital_Read(UWORD Pin); 99 100 void DEV_SPI_WriteByte(UBYTE Value); 101 void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len); 102 void DEV_Delay_ms(UDOUBLE xms); 103 104 UBYTE DEV_Module_Init(void); 105 void DEV_Module_Exit(void); 106 107 108 #endif