Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pico-displayTemperature
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
abp1g20
pico-displayTemperature
Commits
14f81193
Commit
14f81193
authored
3 years ago
by
abp1g20
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
d7b09aab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/DEV_Config.c
+122
-0
122 additions, 0 deletions
lib/DEV_Config.c
with
122 additions
and
0 deletions
lib/DEV_Config.c
0 → 100644
+
122
−
0
View file @
14f81193
/*****************************************************************************
* | 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"
/**
* GPIO
**/
int
EPD_RST_PIN
=
7
;
int
EPD_DC_PIN
=
9
;
int
EPD_CS_PIN
=
13
;
int
EPD_CLK_PIN
=
10
;
int
EPD_MOSI_PIN
=
11
;
uint
slice_num
;
/**
* 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
)
{
DEV_GPIO_Mode
(
EPD_RST_PIN
,
1
);
DEV_GPIO_Mode
(
EPD_DC_PIN
,
1
);
DEV_GPIO_Mode
(
EPD_CS_PIN
,
1
);
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
)
{
spi_init
(
SPI_PORT
,
12000
*
1000
);
gpio_set_function
(
EPD_CLK_PIN
,
GPIO_FUNC_SPI
);
gpio_set_function
(
EPD_MOSI_PIN
,
GPIO_FUNC_SPI
);
// GPIO Config
DEV_GPIO_Init
();
printf
(
"DEV_Module_Init OK
\r\n
"
);
return
0
;
}
/******************************************************************************
function: Module exits, closes SPI and BCM2835 library
parameter:
Info:
******************************************************************************/
void
DEV_Module_Exit
(
void
)
{
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment