Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Nicolò Caruso
Skyward Boardcore
Commits
3bcd135a
Commit
3bcd135a
authored
1 year ago
by
Adriano Longo
Browse files
Options
Downloads
Patches
Plain Diff
[VL53L7CXA] Created test
parent
bb19aecc
Branches
vl53l7cxa-dev
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+3
-0
3 additions, 0 deletions
CMakeLists.txt
src/tests/sensors/test-vl53l7cxa-i2c.cpp
+82
-0
82 additions, 0 deletions
src/tests/sensors/test-vl53l7cxa-i2c.cpp
with
85 additions
and
0 deletions
CMakeLists.txt
+
3
−
0
View file @
3bcd135a
...
...
@@ -416,6 +416,9 @@ sbs_target(test-lis2mdl stm32f429zi_stm32f4discovery)
add_executable
(
test-h3lis331dl src/tests/sensors/test-h3lis331dl.cpp
)
sbs_target
(
test-h3lis331dl stm32f407vg_stm32f4discovery
)
add_executable
(
test-vl53l7cxa src/tests/sensors/test-vl53l7cxa-i2c.cpp
)
sbs_target
(
test-vl53l7cxa stm32f429zi_stm32f4discovery
)
#-----------------------------------------------------------------------------#
# Tests - Utils #
#-----------------------------------------------------------------------------#
...
...
This diff is collapsed.
Click to expand it.
src/tests/sensors/test-vl53l7cxa-i2c.cpp
0 → 100644
+
82
−
0
View file @
3bcd135a
/* Copyright (c) 2023 Skyward Experimental Rocketry
* Author: Adriano Longo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation 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
* furnished 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 FOR 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
<iostream>
#include
"drivers/i2c/I2C.h"
#include
"miosix.h"
#include
"string"
#include
"string.h"
#include
"thread"
using
namespace
std
;
using
namespace
miosix
;
using
namespace
Boardcore
;
// I2C
typedef
Gpio
<
GPIOB_BASE
,
8
>
i1scl
;
typedef
Gpio
<
GPIOB_BASE
,
9
>
i1sda
;
typedef
Gpio
<
GPIOB_BASE
,
0
>
i1rst
;
typedef
Gpio
<
GPIOD_BASE
,
3
>
pwren
;
typedef
Gpio
<
GPIOD_BASE
,
5
>
lpn
;
uint8_t
address
=
0x52
/
2
;
uint16_t
readResult
=
0x00
;
I2CDriver
::
I2CSlaveConfig
cfg
{
address
,
I2CDriver
::
Addressing
::
BIT7
,
I2CDriver
::
Speed
::
MAX_SPEED
};
void
sampleContinuousMode
(
I2C
&
i2c
)
{
i1rst
::
getPin
().
high
();
delayMs
(
10
);
i1rst
::
getPin
().
low
();
delayMs
(
10
);
if
(
i2c
.
probe
(
cfg
))
printf
(
"Non sono morto (ancora)
\n
"
);
else
printf
(
"F
\n
"
);
}
int
main
()
{
I2C
i2c
(
I2C1
,
i1scl
::
getPin
(),
i1sda
::
getPin
());
pwren
::
getPin
().
mode
(
Mode
::
OUTPUT
);
pwren
::
getPin
().
high
();
i1rst
::
getPin
().
mode
(
Mode
::
OUTPUT
);
i1rst
::
getPin
().
low
();
lpn
::
getPin
().
mode
(
Mode
::
OUTPUT
);
lpn
::
getPin
().
high
();
for
(;;)
{
sampleContinuousMode
(
i2c
);
}
return
0
;
}
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