#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "esp_log.h"
#include "shift_register.h"
Go to the source code of this file.
|
| typedef uint32_t | led_matrix_data_t |
| | An integer used as a bitarray to represent the LED matrix data type. More...
|
| |
| typedef bool | led_matrix_data_arr_t[CONFIG_LED_MATRIX_ROWS][CONFIG_LED_MATRIX_COLUMNS] |
| | An array of booleans used to represent the LED matrix data instead of the uint32_t. More...
|
| |
◆ led_matrix_data_arr_t
| typedef bool led_matrix_data_arr_t[CONFIG_LED_MATRIX_ROWS][CONFIG_LED_MATRIX_COLUMNS] |
An array of booleans used to represent the LED matrix data instead of the uint32_t.
- Note
- Valid when the SRA Board is in its upright orientation (text and logo upright).
◆ led_matrix_data_t
An integer used as a bitarray to represent the LED matrix data type.
◆ led_matrix_output_mode_t
Enum used for the output mode of the LED matrix.
| Enumerator |
|---|
| LED_MATRIX_OUTPUT_SEQ | |
| LED_MATRIX_OUTPUT_PAR | |
◆ bool_to_uint32()
Converts a boolean array of size CONFIG_LED_MATRIX_ROWSxCONFIG_LED_MATRIX_COLUMNS to a 32-bit unsigned integer.
- Parameters
-
| input_arr | Boolean input array of dimensions (CONFIG_LED_MATRIX_ROWS, CONFIG_LED_MATRIX_COLUMNS) |
- Returns
- A 32-bit value representing the LED states, where each bit corresponds to one physical LED as defined by led_matrix_map.
◆ led_matrix_cleanup()
Performs cleanup on the LED Matrix contents.
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs |
- Returns
- Returns an error if there is an error while cleaning up the shift register, else returns ESP_OK
◆ led_matrix_display_string()
| esp_err_t led_matrix_display_string |
( |
led_matrix * |
matrix, |
|
|
const char * |
message, |
|
|
double |
wait_ms |
|
) |
| |
Displays the entered string character by character on the LED Matrix with a delay of "wait_ms" ms between characters.
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs. |
| message | The message to be displayed on the screen. |
| wait_ms | The time to wait between two characters (in ms) |
- Returns
- Returns an error if a NULL matrix or message is passed, else returns ESP_OK
◆ led_matrix_init()
Enables and configures the LED Matrix and corresponding shift registers.
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs. |
- Returns
- Returns an error if the could not allocate enough memory or if shift register configuration failed, else returns ESP_OK
◆ led_matrix_set_bit()
| esp_err_t led_matrix_set_bit |
( |
led_matrix * |
matrix, |
|
|
const uint8_t |
led_number, |
|
|
const uint8_t |
led_value |
|
) |
| |
Sets a single bit of the "data" field of the passed in matrix.
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs. |
| led_number | The logical index of the pin (varies from [0, led_matrix_rows * led_matrix_columns - 1]) |
| led_value | The value to set the LED (can be 0 - LOW or 1 - HIGH) |
- Returns
- Returns an error if a NULL matrix is passed or if the led number exceeds (led_matrix_rows * led_matrix_columns - 1), else returns ESP_OK
◆ led_matrix_set_data()
Sets all the bits of the "data" field of the passed in matrix using led_matrix_set_bit().
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs. |
| data | The data to write to the LED matrix. |
- Returns
- Returns an error if a NULL matrix is passed, else returns ESP_OK
◆ led_matrix_set_data_raw()
Sets all the bits of the "data" field.
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs. |
| data | The bitfield used to set the values of the LED matrix. |
- Returns
- Returns an error if a NULL matrix is passed, else returns ESP_OK
◆ led_matrix_write()
Performs the write from the led_matrix structure to the actual LEDs on board.
- Parameters
-
| matrix | The handle to represent and use the matrix of LEDs. |
| mode | The way in which to display the values from the shift register. |
- Returns
- Returns an error if a NULL matrix is passed, else returns ESP_OK