Revision 244, 0.9 kB
(checked in by phil, 4 years ago)
|
added initial Tail Source Package
|
Line | |
---|
1 |
// File: LEDs.c |
---|
2 |
//------------------------------------------------------------------------------ |
---|
3 |
// Author: Giovanni de Sanctis |
---|
4 |
// Email: info@lateral-technologies.com |
---|
5 |
//------------------------------------------------------------------------------ |
---|
6 |
// Date: Dec 2018 |
---|
7 |
// Controls the LED strip |
---|
8 |
//------------------------------------------------------------------------------ |
---|
9 |
|
---|
10 |
#include "LEDs.h" |
---|
11 |
|
---|
12 |
void stopLEDs() |
---|
13 |
{ |
---|
14 |
PWM3_Stop(); |
---|
15 |
} |
---|
16 |
|
---|
17 |
void startLEDs() |
---|
18 |
{ |
---|
19 |
PWM3_Start(); |
---|
20 |
} |
---|
21 |
|
---|
22 |
void setLEDsBrightness(uint8_t level) |
---|
23 |
{ |
---|
24 |
uint16_t value; |
---|
25 |
if (level>95) value=PWM3_MAX_PERIOD_COUNT; |
---|
26 |
else value=(uint16_t)level*PWM3_PERC_FACTOR; |
---|
27 |
|
---|
28 |
PWM3_DutyCycleSet(value); |
---|
29 |
PWM3_LoadBufferSet(); |
---|
30 |
} |
---|
31 |
|
---|
32 |
void setLEDsBrightness2(int16_t level) |
---|
33 |
{ |
---|
34 |
if (level>PWM3_MAX_PERIOD_COUNT) level=PWM3_MAX_PERIOD_COUNT; |
---|
35 |
|
---|
36 |
PWM3_DutyCycleSet((uint16_t)level); |
---|
37 |
PWM3_LoadBufferSet(); |
---|
38 |
} |
---|