Flipklok
 
Loading...
Searching...
No Matches
led.c File Reference

Control the brightness of the LED's. More...

#include "led.h"
#include "timer.h"

Go to the source code of this file.

Functions

void changeLedBrightness (volatile unsigned int adcReading)
 change the brightness od the LED's based on the LDR ADC reading, gets called from ADC10_ISR(void)
 

Variables

unsigned int pwmOnCycles = 0
 

Detailed Description

Control the brightness of the LED's.

Definition in file led.c.

Function Documentation

◆ changeLedBrightness()

void changeLedBrightness ( volatile unsigned int adcReading)

change the brightness od the LED's based on the LDR ADC reading, gets called from ADC10_ISR(void)

Parameters
[in]adcReadingThe reading from the adc of the LDR

Definition at line 22 of file led.c.

23{
24 adcReading = adcReading / 32; // scale from 0-1023 to 0-31
25 adcReading = 33 - adcReading; // Invert so 32 = 0 and 0 = 32, added one to avoid pwmOnCycles = 0
26 pwmOnCycles = adcReading;
27}
unsigned int pwmOnCycles
Definition led.c:15

References pwmOnCycles.

Variable Documentation

◆ pwmOnCycles

unsigned int pwmOnCycles = 0

Definition at line 15 of file led.c.

Referenced by changeLedBrightness(), changeLedBrightness(), and ISR_TA0().