included e-Paper library
cmake still not links but sees includes
This commit is contained in:
7
libs/epaper/Config/CMakeLists.txt
Normal file
7
libs/epaper/Config/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
# Find all source files in a single current directory
|
||||
# Save the name to DIR_Config_SRCS
|
||||
aux_source_directory(. DIR_Config_SRCS)
|
||||
|
||||
# Generate the link library
|
||||
add_library(Config ${DIR_Config_SRCS})
|
||||
target_link_libraries(Config PUBLIC pico_stdlib hardware_spi)
|
||||
137
libs/epaper/Config/DEV_Config.c
Normal file
137
libs/epaper/Config/DEV_Config.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/*****************************************************************************
|
||||
* | File : DEV_Config.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-07-31
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation 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 theex Software, and to permit persons to whom the Software is
|
||||
# furished 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 OR 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 "DEV_Config.h"
|
||||
|
||||
#define SPI_PORT spi1
|
||||
|
||||
/**
|
||||
* GPIO
|
||||
**/
|
||||
int EPD_RST_PIN;
|
||||
int EPD_DC_PIN;
|
||||
int EPD_CS_PIN;
|
||||
int EPD_BUSY_PIN;
|
||||
int EPD_CLK_PIN;
|
||||
int EPD_MOSI_PIN;
|
||||
|
||||
/**
|
||||
* GPIO read and write
|
||||
**/
|
||||
void DEV_Digital_Write(UWORD Pin, UBYTE Value)
|
||||
{
|
||||
gpio_put(Pin, Value);
|
||||
}
|
||||
|
||||
UBYTE DEV_Digital_Read(UWORD Pin)
|
||||
{
|
||||
return gpio_get(Pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* SPI
|
||||
**/
|
||||
void DEV_SPI_WriteByte(uint8_t Value)
|
||||
{
|
||||
spi_write_blocking(SPI_PORT, &Value, 1);
|
||||
}
|
||||
|
||||
void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len)
|
||||
{
|
||||
spi_write_blocking(SPI_PORT, pData, Len);
|
||||
}
|
||||
|
||||
/**
|
||||
* GPIO Mode
|
||||
**/
|
||||
void DEV_GPIO_Mode(UWORD Pin, UWORD Mode)
|
||||
{
|
||||
gpio_init(Pin);
|
||||
if(Mode == 0 || Mode == GPIO_IN) {
|
||||
gpio_set_dir(Pin, GPIO_IN);
|
||||
} else {
|
||||
gpio_set_dir(Pin, GPIO_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delay x ms
|
||||
**/
|
||||
void DEV_Delay_ms(UDOUBLE xms)
|
||||
{
|
||||
sleep_ms(xms);
|
||||
}
|
||||
|
||||
void DEV_GPIO_Init(void)
|
||||
{
|
||||
|
||||
EPD_RST_PIN = 12;
|
||||
EPD_DC_PIN = 8;
|
||||
EPD_BUSY_PIN = 13;
|
||||
|
||||
EPD_CS_PIN = 9;
|
||||
EPD_CLK_PIN = 10;
|
||||
EPD_MOSI_PIN = 11;
|
||||
|
||||
DEV_GPIO_Mode(EPD_RST_PIN, 1);
|
||||
DEV_GPIO_Mode(EPD_DC_PIN, 1);
|
||||
DEV_GPIO_Mode(EPD_CS_PIN, 1);
|
||||
DEV_GPIO_Mode(EPD_BUSY_PIN, 0);
|
||||
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
/******************************************************************************
|
||||
function: Module Initialize, the library and initialize the pins, SPI protocol
|
||||
parameter:
|
||||
Info:
|
||||
******************************************************************************/
|
||||
UBYTE DEV_Module_Init(void)
|
||||
{
|
||||
stdio_init_all();
|
||||
|
||||
// GPIO Config
|
||||
DEV_GPIO_Init();
|
||||
|
||||
spi_init(SPI_PORT, 4000 * 1000);
|
||||
gpio_set_function(EPD_CLK_PIN, GPIO_FUNC_SPI);
|
||||
gpio_set_function(EPD_MOSI_PIN, GPIO_FUNC_SPI);
|
||||
|
||||
printf("DEV_Module_Init OK \r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Module exits, closes SPI and BCM2835 library
|
||||
parameter:
|
||||
Info:
|
||||
******************************************************************************/
|
||||
void DEV_Module_Exit(void)
|
||||
{
|
||||
|
||||
}
|
||||
84
libs/epaper/Config/DEV_Config.h
Normal file
84
libs/epaper/Config/DEV_Config.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*****************************************************************************
|
||||
* | File : DEV_Config.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
* Used to shield the underlying layers of each master
|
||||
* and enhance portability
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-10-30
|
||||
* | Info :
|
||||
* 1.add:
|
||||
* UBYTE\UWORD\UDOUBLE
|
||||
* 2.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
* 3.Remote:
|
||||
* EPD_RST_1\EPD_RST_0
|
||||
* EPD_DC_1\EPD_DC_0
|
||||
* EPD_CS_1\EPD_CS_0
|
||||
* EPD_BUSY_1\EPD_BUSY_0
|
||||
* 3.add:
|
||||
* #define DEV_Digital_Write(_pin, _value) bcm2835_GPIOI_write(_pin, _value)
|
||||
* #define DEV_Digital_Read(_pin) bcm2835_GPIOI_lev(_pin)
|
||||
* #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value)
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation 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
|
||||
# furished 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 OR 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef _DEV_CONFIG_H_
|
||||
#define _DEV_CONFIG_H_
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/spi.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/**
|
||||
* data
|
||||
**/
|
||||
#define UBYTE uint8_t
|
||||
#define UWORD uint16_t
|
||||
#define UDOUBLE uint32_t
|
||||
|
||||
/**
|
||||
* GPIOI config
|
||||
**/
|
||||
extern int EPD_RST_PIN;
|
||||
extern int EPD_DC_PIN;
|
||||
extern int EPD_CS_PIN;
|
||||
extern int EPD_BUSY_PIN;
|
||||
extern int EPD_CLK_PIN;
|
||||
extern int EPD_MOSI_PIN;
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------*/
|
||||
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
|
||||
UBYTE DEV_Digital_Read(UWORD Pin);
|
||||
|
||||
void DEV_SPI_WriteByte(UBYTE Value);
|
||||
void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len);
|
||||
void DEV_Delay_ms(UDOUBLE xms);
|
||||
|
||||
UBYTE DEV_Module_Init(void);
|
||||
void DEV_Module_Exit(void);
|
||||
|
||||
|
||||
#endif
|
||||
47
libs/epaper/Config/Debug.h
Normal file
47
libs/epaper/Config/Debug.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*****************************************************************************
|
||||
* | File : Debug.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : debug with printf
|
||||
* | Info :
|
||||
* Image scanning
|
||||
* Please use progressive scanning to generate images or fonts
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-10-30
|
||||
* | Info :
|
||||
* 1.USE_DEBUG -> DEBUG, If you need to see the debug information,
|
||||
* clear the execution: make DEBUG=-DDEBUG
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation 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
|
||||
# furished 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 OR 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.
|
||||
#
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef __DEBUG_H
|
||||
#define __DEBUG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if DEBUG
|
||||
#define Debug(__info,...) printf("Debug: " __info,##__VA_ARGS__)
|
||||
#else
|
||||
#define Debug(__info,...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user