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
e5ba5f6b
Commit
e5ba5f6b
authored
9 months ago
by
Paulus Kruger
Browse files
Options
Downloads
Patches
Plain Diff
add GPIO pin control
parent
7da62ae3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.c
+35
-5
35 additions, 5 deletions
test.c
with
35 additions
and
5 deletions
test.c
+
35
−
5
View file @
e5ba5f6b
...
@@ -11,8 +11,15 @@
...
@@ -11,8 +11,15 @@
#define TX_RAW_TIME //This will give the raw time between edges instead of decoding it
#define TX_RAW_TIME //This will give the raw time between edges instead of decoding it
//#define SIMULATE_HBAT //Reply on request
//#define SIMULATE_HBAT //Reply on request
const
uint
TX_PIN
=
17
;
//25=LED to test
#define PIN0 18
const
uint
RX_PIN
=
17
;
#define PIN1 17
#define PIN2 16
#define PIN3 20
#define PIN4 19
#define PIN5 25 //LED for test
const
uint
TX_PIN
=
22
;
//25=LED to test
const
uint
RX_PIN
=
21
;
#define TXtimeout 0x1000
#define TXtimeout 0x1000
//#define TXtimeout 0x80
//#define TXtimeout 0x80
...
@@ -26,6 +33,18 @@ uint16_t buffer2[BUFFERSIZE];
...
@@ -26,6 +33,18 @@ uint16_t buffer2[BUFFERSIZE];
uint8_t
bcnt1
=
0
,
bcnt2
=
0
;
uint8_t
bcnt1
=
0
,
bcnt2
=
0
;
uint8_t
bcnt3
=
0
,
bcnt4
=
0
;
uint8_t
bcnt3
=
0
,
bcnt4
=
0
;
uint32_t
dummy
;
uint32_t
dummy
;
void
set_pins
(){
int
x
=
getchar_timeout_us
(
1000
);
if
(
x
==
PICO_ERROR_TIMEOUT
)
return
;
// printf("set pin %i\n",x);
gpio_put
(
PIN0
,
x
&
1
);
gpio_put
(
PIN1
,
x
&
2
);
gpio_put
(
PIN2
,
x
&
4
);
gpio_put
(
PIN3
,
x
&
8
);
gpio_put
(
PIN4
,
x
&
16
);
gpio_put
(
PIN5
,
x
&
32
);
}
void
core1_entry
()
{
void
core1_entry
()
{
while
(
1
)
{
while
(
1
)
{
// printf("3");
// printf("3");
...
@@ -49,6 +68,7 @@ while (1) {
...
@@ -49,6 +68,7 @@ while (1) {
// gpio_set_dir(TX_PIN, GPIO_OUT);
// gpio_set_dir(TX_PIN, GPIO_OUT);
// gpio_put(TX_PIN,0);
// gpio_put(TX_PIN,0);
gpio_set_pulls
(
TX_PIN
,
false
,
true
);
gpio_set_pulls
(
TX_PIN
,
false
,
true
);
set_pins
();
}
else
{
}
else
{
gpio_set_pulls
(
TX_PIN
,
true
,
false
);
gpio_set_pulls
(
TX_PIN
,
true
,
false
);
buffer1
[
bcnt1
]
=
x
;
buffer1
[
bcnt1
]
=
x
;
...
@@ -75,9 +95,19 @@ int main() {
...
@@ -75,9 +95,19 @@ int main() {
printf
(
"Init
\n
"
);
printf
(
"Init
\n
"
);
// gpio_init(LED_PIN);
gpio_init
(
PIN0
);
// gpio_set_dir(LED_PIN, GPIO_OUT);
gpio_init
(
PIN1
);
gpio_set_pulls
(
TX_PIN
,
true
,
false
);
gpio_init
(
PIN2
);
gpio_init
(
PIN3
);
gpio_init
(
PIN4
);
gpio_init
(
PIN5
);
gpio_set_dir
(
PIN0
,
GPIO_OUT
);
gpio_set_dir
(
PIN1
,
GPIO_OUT
);
gpio_set_dir
(
PIN2
,
GPIO_OUT
);
gpio_set_dir
(
PIN3
,
GPIO_OUT
);
gpio_set_dir
(
PIN4
,
GPIO_OUT
);
gpio_set_dir
(
PIN5
,
GPIO_OUT
);
//gpio_set_pulls(TX_PIN,true,false);
// gpio_set_pulls(RX_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_tx
,
sm
,
12500
);
//Bitrate = 150e6 / val. e.g. 15k = 10kHz
pio_sm_put_blocking
(
pio_rx
,
sm1
,
TXtimeout
);
//Timeout
pio_sm_put_blocking
(
pio_rx
,
sm1
,
TXtimeout
);
//Timeout
...
...
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