forked from mirror/uv-k5-firmware
Added backlight driver.
This commit is contained in:
parent
dcbd538a55
commit
a1d3857479
1
Makefile
1
Makefile
@ -17,6 +17,7 @@ OBJS += $(BLOB_OVERLAY).o
|
||||
|
||||
# Drivers
|
||||
OBJS += driver/adc.o
|
||||
OBJS += driver/backlight.o
|
||||
OBJS += driver/bk1080.o
|
||||
OBJS += driver/bk4819.o
|
||||
OBJS += driver/crc.o
|
||||
|
31
driver/backlight.c
Normal file
31
driver/backlight.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "backlight.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "settings.h"
|
||||
|
||||
uint8_t gBacklightCountdown;
|
||||
|
||||
void BACKLIGHT_TurnOn(void)
|
||||
{
|
||||
if (gEeprom.BACKLIGHT) {
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
gBacklightCountdown = 1 + (gEeprom.BACKLIGHT * 2);
|
||||
}
|
||||
}
|
||||
|
23
driver/backlight.h
Normal file
23
driver/backlight.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DRIVER_BACKLIGHT_H
|
||||
#define DRIVER_BACKLIGHT_H
|
||||
|
||||
void BACKLIGHT_TurnOn(void);
|
||||
|
||||
#endif
|
||||
|
8
main.c
8
main.c
@ -21,9 +21,10 @@
|
||||
#include "bsp/dp32g030/portcon.h"
|
||||
#include "bsp/dp32g030/syscon.h"
|
||||
#include "board.h"
|
||||
#include "driver/crc.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "driver/bk1080.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/crc.h"
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/flash.h"
|
||||
#include "driver/gpio.h"
|
||||
@ -59,11 +60,6 @@ static void FLASHLIGHT_TurnOn(void)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOB_PIN_FLASHLIGHT);
|
||||
}
|
||||
|
||||
static void BACKLIGHT_TurnOn(void)
|
||||
{
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void ProcessKey(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user