Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
L2HBAT_pico
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
L2HBAT_pico
Commits
7da62ae3
Commit
7da62ae3
authored
1 year ago
by
Paulus Kruger
Browse files
Options
Downloads
Patches
Plain Diff
added binary
parent
23a8061c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
build/test.uf2
+0
-0
0 additions, 0 deletions
build/test.uf2
test.c
+18
-11
18 additions, 11 deletions
test.c
with
18 additions
and
11 deletions
build/test.uf2
0 → 100644
+
0
−
0
View file @
7da62ae3
File added
This diff is collapsed.
Click to expand it.
test.c
+
18
−
11
View file @
7da62ae3
...
...
@@ -8,14 +8,14 @@
#include
"hba_tx.pio.h"
#include
"hba_rx.pio.h"
//
#define TX_RAW_TIME //This will give the raw time between edges instead of decoding it
#define SIMULATE_HBAT //Reply on request
#define TX_RAW_TIME //This will give the raw time between edges instead of decoding it
//
#define SIMULATE_HBAT //Reply on request
const
uint
TX_PIN
=
1
4
;
//25=LED to test
const
uint
RX_PIN
=
1
4
;
const
uint
TX_PIN
=
1
7
;
//25=LED to test
const
uint
RX_PIN
=
1
7
;
///
#define TXtimeout 0x1000
#define TXtimeout 0x80
#define TXtimeout 0x1000
//
#define TXtimeout 0x80
//Need to change norm delay constants if time is changed!! This can be done using TX_RAW_TIME and python scripts.
inline
uint16_t
NormDelay
(
uint16_t
x
){
return
(
TXtimeout
-
x
+
19
)
/
20
;
}
...
...
@@ -25,7 +25,7 @@ char buffer1[BUFFERSIZE];
uint16_t
buffer2
[
BUFFERSIZE
];
uint8_t
bcnt1
=
0
,
bcnt2
=
0
;
uint8_t
bcnt3
=
0
,
bcnt4
=
0
;
uint
16
_t
dummy
;
uint
32
_t
dummy
;
void
core1_entry
()
{
while
(
1
)
{
// printf("3");
...
...
@@ -45,10 +45,17 @@ while (1) {
else
{
int
x
=
getchar_timeout_us
(
0
);
if
(
x
!=
PICO_ERROR_TIMEOUT
){
if
(
x
==
0
)
{
// gpio_set_dir(TX_PIN, GPIO_OUT);
// gpio_put(TX_PIN,0);
gpio_set_pulls
(
TX_PIN
,
false
,
true
);
}
else
{
gpio_set_pulls
(
TX_PIN
,
true
,
false
);
buffer1
[
bcnt1
]
=
x
;
bcnt1
++
;
bcnt1
%=
BUFFERSIZE
;
}
}
}
}};
int
main
()
{
...
...
@@ -70,7 +77,7 @@ int main() {
printf
(
"Init
\n
"
);
// gpio_init(LED_PIN);
// gpio_set_dir(LED_PIN, GPIO_OUT);
//
gpio_set_pulls(TX_PIN,true,false);
gpio_set_pulls
(
TX_PIN
,
true
,
false
);
// gpio_set_pulls(RX_PIN,true,false);
pio_sm_put_blocking
(
pio_tx
,
sm
,
12500
);
//Bitrate = 150e6 / val. e.g. 15k = 10kHz
pio_sm_put_blocking
(
pio_rx
,
sm1
,
TXtimeout
);
//Timeout
...
...
@@ -85,7 +92,7 @@ int main() {
}
else
if
((
pio_sm_get_tx_fifo_level
(
pio_tx
,
sm
)
<
4
)
&&
(
bcnt1
!=
bcnt2
))
{
//Second priority: Keep TX FIFO full
pio_sm_put_blocking
(
pio_tx
,
sm
,
buffer1
[
bcnt2
]);
bcnt2
++
;
bcnt2
%=
BUFFERSIZE
;
}
else
if
(
dummy
++==
0
)
printf
(
"
.
"
);
}
else
if
(
dummy
++==
0
)
printf
(
"
\n
"
);
}
#endif //TX_RAW_TIME
...
...
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