amiro-lld / include / alld_tlc5947.h @ 5e2f673b
History | View | Annotate | Download (3.18 KB)
1 | d6728c5b | Thomas Schöpping | /*
|
---|---|---|---|
2 | AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
|
||
3 | Copyright (C) 2016..2018 Thomas Schöpping et al.
|
||
4 | |||
5 | This program is free software: you can redistribute it and/or modify
|
||
6 | f0ca400f | Thomas Schöpping | it under the terms of the GNU Lesser General Public License as published by
|
7 | d6728c5b | Thomas Schöpping | the Free Software Foundation, either version 3 of the License, or
|
8 | (at your option) any later version.
|
||
9 | |||
10 | This program is distributed in the hope that it will be useful,
|
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | f0ca400f | Thomas Schöpping | GNU Lesser General Public License for more details.
|
14 | d6728c5b | Thomas Schöpping | |
15 | f0ca400f | Thomas Schöpping | You should have received a copy of the GNU Lesser General Public License
|
16 | d6728c5b | Thomas Schöpping | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 | */
|
||
18 | |||
19 | 5e2f673b | Marc Rothmann | /**
|
20 | * @file alld_tlc5947.h
|
||
21 | * @brief LED Driver macros and structures.
|
||
22 | *
|
||
23 | * @addtogroup lld_leddriver
|
||
24 | * @{
|
||
25 | */
|
||
26 | |||
27 | d6728c5b | Thomas Schöpping | #ifndef _AMIROLLD_TLC5947_H_
|
28 | #define _AMIROLLD_TLC5947_H_
|
||
29 | |||
30 | #include <amiro-lld.h> |
||
31 | |||
32 | #if defined(AMIROLLD_CFG_USE_TLC5947) || defined(__DOXYGEN__)
|
||
33 | |||
34 | /**
|
||
35 | * @brief Active state of the BLANK signal.
|
||
36 | */
|
||
37 | #define TLC5947_LLD_BLANK_ACTIVE_STATE APAL_GPIO_ACTIVE_HIGH
|
||
38 | |||
39 | /**
|
||
40 | * @brief Active state of the XLAT signal.
|
||
41 | */
|
||
42 | #define TLC5947_LLD_XLAT_ACTIVE_STATE APAL_GPIO_ACTIVE_HIGH
|
||
43 | |||
44 | /**
|
||
45 | * @brief Number of PWM channels.
|
||
46 | */
|
||
47 | #define TLC5947_LLD_NUM_CHANNELS 24 |
||
48 | |||
49 | /**
|
||
50 | * @brief Resulotion of the PWM channels in bits.
|
||
51 | */
|
||
52 | #define TLC5947_LLD_PWM_RESOLUTION_BITS 12 |
||
53 | |||
54 | /**
|
||
55 | * @brief Size of the TLC grayscale buffer in bytes.
|
||
56 | */
|
||
57 | #define TLC5947_LLD_BUFFER_SIZE (TLC5947_LLD_NUM_CHANNELS * TLC5947_LLD_PWM_RESOLUTION_BITS / 8) |
||
58 | |||
59 | /**
|
||
60 | * @brief The TLC5947Driver struct
|
||
61 | */
|
||
62 | typedef struct { |
||
63 | apalSPIDriver_t* spi_driver; /**< @brief The SPI Driver. */
|
||
64 | apalControlGpio_t blank_gpio; /**< @brief The identifier of the BLANK signal GPIO. */
|
||
65 | apalControlGpio_t xlat_gpio; /**< @brief The identifier of the XLAT signal GPIO. */
|
||
66 | } TLC5947Driver; |
||
67 | |||
68 | /**
|
||
69 | * @brief The blank state of the TLC5947 driver.
|
||
70 | */
|
||
71 | typedef enum { |
||
72 | TLC5947_LLD_BLANK_ENABLE = 0, /**< 'blank on' state of the TLC5947 driver. */ |
||
73 | TLC5947_LLD_BLANK_DISABLE = 1, /**< 'blank off' state of the TLC5947 driver. */ |
||
74 | } tlc5947_lld_blank_t; |
||
75 | |||
76 | |||
77 | /**
|
||
78 | * @brief TLC5947 buffer struct.
|
||
79 | */
|
||
80 | typedef struct { |
||
81 | uint8_t data[TLC5947_LLD_BUFFER_SIZE]; /**< The raw buffer data. */
|
||
82 | } tlc5947_lld_buffer_t; |
||
83 | |||
84 | #ifdef __cplusplus
|
||
85 | extern "C" { |
||
86 | #endif
|
||
87 | apalExitStatus_t tlc5947_lld_setBlank(const TLC5947Driver* const tlc5947, const tlc5947_lld_blank_t blank); |
||
88 | apalExitStatus_t tlc5947_lld_getBlank(const TLC5947Driver* const tlc5947, tlc5947_lld_blank_t* const blank); |
||
89 | apalExitStatus_t tlc5947_lld_update(const TLC5947Driver* const tlc5947); |
||
90 | apalExitStatus_t tlc5947_lld_write(const TLC5947Driver* const tlc5947, const tlc5947_lld_buffer_t* const buffer); |
||
91 | void tlc5947_lld_setBuffer(tlc5947_lld_buffer_t* const buffer, const uint8_t channel, const uint16_t value); |
||
92 | uint16_t tlc5947_lld_getBuffer(const tlc5947_lld_buffer_t* const buffer, const uint8_t channel); |
||
93 | #ifdef __cplusplus
|
||
94 | } |
||
95 | #endif
|
||
96 | |||
97 | #endif /* defined(AMIROLLD_CFG_USE_TLC5947) */ |
||
98 | |||
99 | #endif /* _AMIROLLD_TLC5947_H_ */ |
||
100 | 5e2f673b | Marc Rothmann | |
101 | /** @} */ |