Blame view

RIOT/boards/microbit/include/microbit.h 1.98 KB
a752c7ab   elopes   add first test an...
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_microbit
   * @{
   *
   * @file
   * @brief       BBC micro:bit specific LED handling
   *
   * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
   */
  
  #ifndef MICROBIT_H
  #define MICROBIT_H
  
  #include <stdint.h>
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @brief   Number of rows of the LED matrix
   */
  #define MICROBIT_MATRIX_ROWS    (5U)
  
  /**
   * @brief   Number of columns of the LED matrix
   */
  #define MICROBIT_MATRIX_COLS    (5U)
  
  /**
   * @brief   Initialize the micro:bit's LED matrix
   */
  void microbit_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 microbit_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 microbit_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 microbit_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 microbit_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 microbit_matrix_shift_str(const char *str, uint32_t delay);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* MICROBIT_H */
  /** @} */