Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
itii-mac-tp-etu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikaël BRIDAY
itii-mac-tp-etu
Commits
50c0f9bd
Commit
50c0f9bd
authored
Oct 23, 2020
by
Mikaël BRIDAY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add lab7
parent
59a7f274
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
lab7/CMakeLists.txt
lab7/CMakeLists.txt
+18
-0
lab7/lab7.pdf
lab7/lab7.pdf
+0
-0
lab7/main.cpp
lab7/main.cpp
+39
-0
No files found.
lab7/CMakeLists.txt
0 → 100644
View file @
50c0f9bd
#to compile the project:
# mkdir _build
# cd _build
# cmake -D CMAKE_TOOLCHAIN_FILE=../../sys/cmake/arm-none-eabi.cmake ..
# make
# make flash
cmake_minimum_required
(
VERSION 3.5
)
#project name
project
(
lab7
)
#application sources
set
(
SRCS
${
CMAKE_SOURCE_DIR
}
/main.cpp
)
option
(
WITH_TFT
"add compilation rules for the TFT support"
ON
)
include
(
"../sys/cmake/coroLabs.cmake"
)
lab7/lab7.pdf
0 → 100644
View file @
50c0f9bd
File added
lab7/main.cpp
0 → 100644
View file @
50c0f9bd
#include "stm32f3xx.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ST7735.h"
#include "adc.h"
#include "tft.h"
void
setup
()
{
Tft
.
setup
();
Tft
.
setTextCursor
(
4
,
1
);
//col,line
Tft
.
print
(
"Hello World! "
);
ADCInit
();
}
//this is a simple application that uses the TFT display.
// => it first write a string in the top of the screen (in setup)
// => it writes the ADC value of the potentiometer in green, and
// refreshes it each time the value differs more than 5.
int
main
()
{
static
int
prevPot
=
-
1
;
setup
();
while
(
1
)
{
//potentiometer
int
pot
=
ADCRead
();
//12 bits -> 4096 -> 4 digits
//update only we value changes significantly
if
(
abs
(
prevPot
-
pot
)
>
5
)
{
//set cursor centered on line 4.
Tft
.
setTextCursor
(
Tft
.
getTextWidth
()
/
2
-
2
,
4
);
Tft
.
eraseText
(
4
);
//remove previous value (4 digits)
Tft
.
print
(
pot
);
prevPot
=
pot
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment