Refactor of keyboard LED

This commit is contained in:
Jeremy Soller 2020-01-30 13:54:52 -07:00
parent 6ee5612a4a
commit 2795491374
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
10 changed files with 22 additions and 38 deletions

View File

@ -1,8 +0,0 @@
#include <board/dac.h>
void dac_init(void) {
// Enable DAC5, used for KBLIGHT_ADJ
DACPDREG &= ~(1 << 5);
// Set DAC5 to 0V
DACDAT5 = 0;
}

View File

@ -1,8 +0,0 @@
#ifndef _BOARD_DAC_H
#define _BOARD_DAC_H
#include <ec/dac.h>
void dac_init(void);
#endif // _BOARD_DAC_H

View File

@ -3,6 +3,7 @@
#include <stdint.h>
void kbled_init(void);
uint8_t kbled_get(void);
void kbled_set(uint8_t level);

View File

@ -1,6 +1,6 @@
#include <board/dac.h>
#include <board/kbled.h>
#include <common/macro.h>
#include <ec/dac.h>
static uint8_t __code levels[] = {
0x00,
@ -11,6 +11,13 @@ static uint8_t __code levels[] = {
0xFF
};
void kbled_init(void) {
// Enable DAC5, used for KBLIGHT_ADJ
DACPDREG &= ~(1 << 5);
// Set DAC5 to 0V
DACDAT5 = 0;
}
uint8_t kbled_get(void) {
uint8_t level;
uint8_t raw = DACDAT5;

View File

@ -4,10 +4,10 @@
#include <arch/delay.h>
#include <board/battery.h>
#include <board/dac.h>
#include <board/gpio.h>
#include <board/gctrl.h>
#include <board/kbc.h>
#include <board/kbled.h>
#include <board/kbscan.h>
#include <board/peci.h>
#include <board/pmc.h>
@ -47,10 +47,10 @@ void timer_2(void) __interrupt(5) {
void init(void) {
gpio_init();
gctrl_init();
dac_init();
pwm_init();
kbc_init();
kbled_init();
kbscan_init();
pmc_init();
peci_init();

View File

@ -1,8 +0,0 @@
#include <board/dac.h>
void dac_init(void) {
// Enable DAC2, used for KBLIGHT_ADJ
DACPDREG &= ~(1 << 2);
// Set DAC2 to 0V
DACDAT2 = 0;
}

View File

@ -1,8 +0,0 @@
#ifndef _BOARD_DAC_H
#define _BOARD_DAC_H
#include <ec/dac.h>
void dac_init(void);
#endif // _BOARD_DAC_H

View File

@ -3,6 +3,7 @@
#include <stdint.h>
void kbled_init(void);
uint8_t kbled_get(void);
void kbled_set(uint8_t level);

View File

@ -1,6 +1,6 @@
#include <board/dac.h>
#include <board/kbled.h>
#include <common/macro.h>
#include <ec/dac.h>
static uint8_t __code levels[] = {
0x00,
@ -11,6 +11,13 @@ static uint8_t __code levels[] = {
0xFF
};
void kbled_init(void) {
// Enable DAC2, used for KBLIGHT_ADJ
DACPDREG &= ~(1 << 2);
// Set DAC2 to 0V
DACDAT2 = 0;
}
uint8_t kbled_get(void) {
uint8_t level;
uint8_t raw = DACDAT2;

View File

@ -4,10 +4,10 @@
#include <arch/delay.h>
#include <board/battery.h>
#include <board/dac.h>
#include <board/gpio.h>
#include <board/gctrl.h>
#include <board/kbc.h>
#include <board/kbled.h>
#include <board/kbscan.h>
#include <board/peci.h>
#include <board/pmc.h>
@ -47,10 +47,10 @@ void timer_2(void) __interrupt(5) {
void init(void) {
gpio_init();
gctrl_init();
dac_init();
pwm_init();
kbc_init();
kbled_init();
kbscan_init();
pmc_init();
peci_init();