mini.h
1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Copyright (C) 2016 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_calliope-mini
* @{
*
* @file
* @brief Calliope mini specific LED handling
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef MINI_H
#define MINI_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Number of rows of the LED matrix
*/
#define MINI_MATRIX_ROWS (5U)
/**
* @brief Number of columns of the LED matrix
*/
#define MINI_MATRIX_COLS (5U)
/**
* @brief Initialize the Calliope mini's LED matrix
*/
void mini_matrix_init(void);
/**
* @brief Turn on a single LED in the LED matrix
*
* @param[in] row row of the LED
* @param[in] col column of the LED
*/
void mini_matrix_on(uint8_t row, uint8_t col);
/**
* @brief Turn off a single LED in the LED matrix
*
* @param[in] row row of the LED
* @param[in] col column of the LED
*/
void mini_matrix_off(uint8_t row, uint8_t col);
/**
* @brief Write the given 'image' to the LED matrix
*
* In the given buffer, each byte represents one LED in the matrix, hence the
* buffer MUST be at least 25 byte wide. A byte value of `0` turns an LED off,
* while any other value turns it on.
*
* @param[in] buf new data to display, MUST be at least 25 byte
*/
void mini_matrix_set_raw(const uint8_t *buf);
/**
* @brief Write the given character to the matrix, using the Mineplex font
*
* @param[in] c character to display
*/
void mini_matrix_set_char(char c);
/**
* @brief Shift the given string through the LED matrix
*
* @param[in] str string do display
* @param[in] delay delay between each step [in us]
*/
void mini_matrix_shift_str(const char *str, uint32_t delay);
#ifdef __cplusplus
}
#endif
#endif /* MINI_H */
/** @} */