Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Upstream WS24
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microcontroller
Upstream WS24
Commits
2587af11
Commit
2587af11
authored
8 months ago
by
Valentini, Matteo
Browse files
Options
Downloads
Patches
Plain Diff
improved documentation, added stdio_init_all()
parent
f5dd7b55
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/A1/gpio.c
+5
-3
5 additions, 3 deletions
src/A1/gpio.c
src/A1/gpio.h
+3
-3
3 additions, 3 deletions
src/A1/gpio.h
src/A1/main.c
+2
-0
2 additions, 0 deletions
src/A1/main.c
src/A1/vault.c
+1
-0
1 addition, 0 deletions
src/A1/vault.c
with
11 additions
and
6 deletions
src/A1/gpio.c
+
5
−
3
View file @
2587af11
...
...
@@ -10,12 +10,13 @@ volatile uint32_t* sio_base = (uint32_t *)0xd0000000;
/** Configures the pin to be in the given mode using IO_BANK0
* @param pin id of the gpio pin, make sure that it is between 0 and 31
* @param function function of the pin. Functions are predefined as GPIO_FUNC_...
* @param function function of the pin
, make sure it is between 0 and 31
. Functions are predefined as GPIO_FUNC_...
*/
void
set_gpio_function
(
const
int
pin
,
const
int
function
)
{
// TODO student:
// - ensure that the pin is between 0 and 29, otherwise return
// - ensure that the function is between 0 and 31, otherwise return
// - configure the pin to use the given function by modifying the IO_BANK0 registers
// ======================================================================
...
...
@@ -26,7 +27,7 @@ void set_gpio_function(const int pin, const int function)
// TODO end ==============================================================
}
/** Sets the input/output mode of the given pin using the SIO.
/** Sets the input/output mode of the given pin using the SIO.
Furthermore, the input enable bit in the corresponding PADS_BANK0 register is set.
* @param pin id of the gpio pin, make sure that it is between 0 and 31
* @param mode input/output mode, GPIO_IN for input, GPIO_OUT for output
*/
...
...
@@ -35,7 +36,8 @@ void set_gpio_mode(const int pin, const int mode)
// TODO student:
// - ensure that the pin is between 0 and 29, otherwise return
// - ensure that a valid mode is given, otherwise return
// - configure weather the pin is an input or output by modifying the SIO registers
// - configure the pin as either an input or output by modifying the SIO registers
// - set the input enable bit in the corresponding PADS_BANK0 register
// Hint: have a look at the OE registers
// ======================================================================
...
...
This diff is collapsed.
Click to expand it.
src/A1/gpio.h
+
3
−
3
View file @
2587af11
#pragma once
#include
<stdint.h>
// GPIO functions
, see table 279 in the RP2040 datasheet
// GPIO functions
/** Pin is used for SPI */
#define FUNC_SPI 1
/** Pin is used for UART */
...
...
@@ -35,11 +35,11 @@
/** Configures the pin to be in the given mode using IO_BANK0.
* @param pin id of the gpio pin, make sure that it is between 0 and 29
* @param function function of the pin. Functions are predefined as GPIO_FUNC_...
* @param function function of the pin
, make sure it is between 0 and 31
. Functions are predefined as GPIO_FUNC_...
*/
void
set_gpio_function
(
int
pin
,
int
function
);
/** Sets the input/output mode of the given pin using the SIO.
/** Sets the input/output mode of the given pin using the SIO.
Furthermore, the input enable bit in the corresponding PADS_BANK0 register is set.
* @param pin id of the gpio pin, make sure that it is between 0 and 29
* @param mode input/output mode, GPIO_IN for input, GPIO_OUT for output
*/
...
...
This diff is collapsed.
Click to expand it.
src/A1/main.c
+
2
−
0
View file @
2587af11
#include
"vault.h"
#include
<stdio.h>
#include
<pico/stdio.h>
// You can modify this file for local testing, but it will be overridden by the testsystem
int
main
()
{
stdio_init_all
();
vault_logic
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/A1/vault.c
+
1
−
0
View file @
2587af11
...
...
@@ -11,6 +11,7 @@ void vault_logic()
//TODO student:
// - implement the vault logic as described in the assignment
// - use your functions defined in gpio.c and adc.c
// - set the ZERO_OFFSET define in vault.h to the correct value for your board
// Do not use the gpio functions from the RPI Pico SDK.
// ======================================================================
...
...
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