apa102 1.0
apa102 driver library
Loading...
Searching...
No Matches
apa102.h
Go to the documentation of this file.
1
18
19#ifndef APA102_H_
20#define APA102_H_
21
22 #ifndef APA102_HAL_PLATFORM
32 #define APA102_HAL_PLATFORM avr0
33 #endif
34
35 #ifndef APA102_NUMBER_OF_LEDS
45 #define APA102_NUMBER_OF_LEDS 1
46 #endif
47
48 #ifndef APA102_FRAME_SIZE
58 #define APA102_FRAME_SIZE 4
59 #endif
60
61 #ifndef APA102_START_FLAG
69 #define APA102_START_FLAG 0xE0
70 #endif
71
72 #ifndef APA102_SOF_VALUE
80 #define APA102_SOF_VALUE 0x00
81 #endif
82
83 #ifndef APA102_EOF_VALUE
91 #define APA102_EOF_VALUE 0xFF
92 #endif
93
94 #ifndef APA102_MIN_INTENSITY
102 #define APA102_MIN_INTENSITY 0x01
103 #endif
104
105 #ifndef APA102_MAX_INTENSITY
113 #define APA102_MAX_INTENSITY 0x1F
114 #endif
115
116 #ifndef APA102_POWER_SAVING_AVAILABLE
124 //#define APA102_POWER_SAVING_AVAILABLE
125
126 #ifdef _DOXYGEN_ // Used for documentation, can be ignored
127 #define APA102_POWER_SAVING_AVAILABLE
128 #endif
129
130 #ifndef APA102_ENABLE_FLAG
138 #define APA102_ENABLE_FLAG 0xE0
139 #endif
140
141 #ifndef APA102_SLEEP_FLAG
149 #define APA102_SLEEP_FLAG 0xA0
150 #endif
151 #endif
152
155
156 #include _STR(../../../hal/APA102_HAL_PLATFORM/spi/spi.h)
157
170
175
183 #define APA102_SOF() { apa102_xof(APA102_Transmission_SOF); }
184
192 #define APA102_EOF() { apa102_xof(APA102_Transmission_EOF); }
193
194 void apa102_init(void);
196 void apa102_led(const GFX_RGBA_Color *color);
197 void apa102_leds(const GFX_RGBA_Color *color);
198 void apa102_led_off(void);
199 void apa102_leds_off(void);
200
201#endif /* APA102_H_ */
void apa102_leds_off(void)
Disable all LEDs by sending sleep commands (if supported) and turning off the SPI peripheral.
Definition apa102.c:154
#define APA102_SOF_VALUE
Defines the start-of-frame marker value for LED data transmission.
Definition apa102.h:80
#define APA102_EOF_VALUE
Defines the end-of-frame marker value for LED data transmission.
Definition apa102.h:91
void apa102_xof(APA102_Transmission type)
Transmit a specified value repeatedly over SPI to form a data frame.
Definition apa102.c:63
void apa102_init(void)
Initialize the LED control interface and hardware.
Definition apa102.c:42
void apa102_led_off(void)
Send an LED data frame to a single LED to turn it off.
Definition apa102.c:135
APA102_Transmission_t
Enumerates possible LED frame types for APA102 LED strips.
Definition apa102.h:166
@ APA102_Transmission_SOF
Definition apa102.h:167
@ APA102_Transmission_EOF
Definition apa102.h:168
enum APA102_Transmission_t APA102_Transmission
Alias for enum APA102_Transmission_t representing possible APA102 transmission types.
Definition apa102.h:174
void apa102_leds(const GFX_RGBA_Color *color)
Send an LED data frame to all LEDs with specified color and intensity.
Definition apa102.c:108
void apa102_led(const GFX_RGBA_Color *color)
Send an LED data frame with specified color and intensity.
Definition apa102.c:87
Header file defining basic structures for color and intensity data.
struct GFX_RGBA_Color_t GFX_RGBA_Color
Definition color.h:59
Helper macros for stringification in C preprocessor.