Skip to content
Snippets Groups Projects
Commit 8e86c1eb authored by Valentini, Matteo's avatar Valentini, Matteo
Browse files

Merge branch 'dev' into 'main'

improved documentation, added stdio_init_all()

See merge request microcontroller/upstream-ws24!1
parents f5dd7b55 2587af11
No related branches found
No related tags found
No related merge requests found
......@@ -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
// ======================================================================
......
#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
*/
......
#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
......@@ -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.
// ======================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment