Urbanite: Parking aid system
port_display.h File Reference

Header for the portable functions to interact with the HW of the display system. The functions must be implemented in the platform-specific code. More...

#include <stdint.h>

Data Structures

struct  rgb_color_t
 Structure to define an RGB color. More...
 

Macros

#define PORT_REAR_PARKING_DISPLAY_ID   0
 
#define PORT_DISPLAY_RGB_MAX_VALUE
 
#define COLOR_RED
 
#define COLOR_GREEN
 
#define COLOR_BLUE
 
#define COLOR_YELLOW
 
#define COLOR_TURQUOISE
 
#define COLOR_OFF   (rgb_color_t){0, 0, 0}
 

Functions

void port_display_init (uint32_t display_id)
 Configure the HW specifications of a given display. More...
 
void port_display_set_rgb (uint32_t display_id, rgb_color_t color)
 Set the Capture/Compare register values for each channel of the RGB LED given a color. More...
 

Detailed Description

Header for the portable functions to interact with the HW of the display system. The functions must be implemented in the platform-specific code.

Author
Sistemas Digitales II
Date
2025-01-01

Macro Definition Documentation

◆ COLOR_BLUE

#define COLOR_BLUE

Blue color

◆ COLOR_GREEN

#define COLOR_GREEN

Green color

◆ COLOR_OFF

#define COLOR_OFF   (rgb_color_t){0, 0, 0}

Off color

◆ COLOR_RED

#define COLOR_RED

Red color

◆ COLOR_TURQUOISE

#define COLOR_TURQUOISE

Turquoise color

◆ COLOR_YELLOW

#define COLOR_YELLOW

Yellow color

◆ PORT_DISPLAY_RGB_MAX_VALUE

#define PORT_DISPLAY_RGB_MAX_VALUE

Maximum value for the RGB LED

◆ PORT_REAR_PARKING_DISPLAY_ID

#define PORT_REAR_PARKING_DISPLAY_ID   0

Display system identifier for the rear parking sensor

Function Documentation

◆ port_display_init()

void port_display_init ( uint32_t  display_id)

Configure the HW specifications of a given display.

Assuming we are using an STM32F4-based platform, this function must call the following functions:

TODO alumnos:

✅ 1. Retrieve the display configuration struct calling _stm32f4_display_get().
✅ 2. Call function stm32f4_system_gpio_config() with the right arguments to configure each RGB LED as in alternate mode and no pull up neither pull down connection.
✅ 3. Call function stm32f4_system_gpio_config_alternate() with the right arguments to configure the alternate function of the each RGB LED.
✅ 4. Call function _timer_pwm_config() to configure the timer and the PWM signal of the display.
✅ 5. Call function port_display_set_rgb() to set the RGB LED to off.

Parameters
display_idDisplay ID. This index is used to select the element of the displays_arr[] array

◆ port_display_set_rgb()

void port_display_set_rgb ( uint32_t  display_id,
rgb_color_t  color 
)

Set the Capture/Compare register values for each channel of the RGB LED given a color.

This function disables the timer associated to the RGB LEDs, sets the Capture/Compare register values for each channel of the RGB LED, and enables the timer.

Warning
This function is valid for any given RGB LED, however, each RGB LED has its own timer. Write the code in a conditional statement to check the display_id.

TODO alumnos:

✅ 1. Retrieve the individual RGB values from the color parameter and follow the flowchart to set the RGB LED color by configuring the PWM signals appropriately:

Parameters
display_idDisplay system identifier number.
colorRGB color to set.