|
Simone: a game of visual memory and speed
|
Header for the portable functions to interact with the HW of the RGB light system. The functions must be implemented in the platform-specific code. More...
Macros | |
| #define | PORT_RGB_LIGHT_ID 0 |
Functions | |
| void | port_rgb_light_init (uint8_t rgb_light_id) |
| Configure the HW specifications of a given RGB light. More... | |
| void | port_rgb_light_set_rgb (uint8_t rgb_light_id, rgb_color_t color) |
| Set the Capture/Compare register values for each channel of the RGB LED given a color. More... | |
Header for the portable functions to interact with the HW of the RGB light system. The functions must be implemented in the platform-specific code.
| #define PORT_RGB_LIGHT_ID 0 |
RGB light system identifier of Simone
| void port_rgb_light_init | ( | uint8_t | rgb_light_id | ) |
Configure the HW specifications of a given RGB light.
Assuming we are using an STM32F4-based platform, this function must call the following functions:
TODO alumnos:
✅ 1. Retrieve the RGB light configuration struct calling
_stm32f4_rgb_light_get().
✅ 2. Call functionstm32f4_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 functionstm32f4_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 RGB light.
✅ 5. Call functionport_rgb_light_set_rgb()to set the RGB LED to off.
| rgb_light_id | RGB light ID. This index is used to select the element of the rgb_lights_arr[] array |
| void port_rgb_light_set_rgb | ( | uint8_t | rgb_light_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.
TODO alumnos:
✅ 1. Retrieve the individual RGB values from the
colorparameter and follow the flowchart given in the lab notebook to set the RGB LED color by configuring the PWM signals appropriately.
| rgb_light_id | RGB light system identifier number. |
| color | RGB color to set. |