mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
twinkie: fix CC2 reception in PD injector mode
Properly set the comparator output when using CC2. Also add some basic LED color to display the current power contract when we are a sink : - green : 5V - red : 20V - blue : other voltage Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=plug to Zinger in each plug direction and see green then red LED. type "pd 0 dev 12" and see the blue LED. Change-Id: I4eb4339568eda5871c7f3df75bedebd97238e941 Reviewed-on: https://chromium-review.googlesource.com/226385 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
bd9a53f322
commit
d4f3279db9
@@ -48,9 +48,9 @@ static inline void spi_enable_clock(int port)
|
||||
STM32_RCC_APB2ENR |= STM32_RCC_PB2_SPI1;
|
||||
}
|
||||
|
||||
/* RX is using COMP1 triggering TIM1 CH1 */
|
||||
/* RX is using COMP1 or COMp2 triggering TIM1 CH1 */
|
||||
#define CMP1OUTSEL STM32_COMP_CMP1OUTSEL_TIM1_IC1
|
||||
#define CMP2OUTSEL 0
|
||||
#define CMP2OUTSEL STM32_COMP_CMP2OUTSEL_TIM1_IC1
|
||||
|
||||
#define DMAC_TIM_RX(p) STM32_DMAC_CH2
|
||||
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "console.h"
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "registers.h"
|
||||
#include "task.h"
|
||||
@@ -81,6 +82,12 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo,
|
||||
void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
uint32_t supply_voltage)
|
||||
{
|
||||
int red = supply_voltage == 20000;
|
||||
int green = supply_voltage == 5000;
|
||||
int blue = supply_voltage && !(red || green);
|
||||
gpio_set_level(GPIO_LED_R_L, !red);
|
||||
gpio_set_level(GPIO_LED_G_L, !green);
|
||||
gpio_set_level(GPIO_LED_B_L, !blue);
|
||||
}
|
||||
|
||||
void pd_set_max_voltage(unsigned mv)
|
||||
|
||||
Reference in New Issue
Block a user