Skip to content

Commit 0dc95a8

Browse files
robbederksComma Device
andauthored
Cuatro: changes for new board rev (#2176)
changes for new board rev Co-authored-by: Comma Device <[email protected]>
1 parent b14c47e commit 0dc95a8

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

board/boards/cuatro.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void cuatro_init(void) {
9191
tres_set_ir_power(0U);
9292

9393
// Clock source
94-
clock_source_init();
94+
clock_source_init(true);
9595

9696
// Sound codec
9797
cuatro_set_amp_enabled(false);
@@ -105,8 +105,22 @@ static void cuatro_init(void) {
105105
sound_init();
106106
}
107107

108+
static harness_configuration cuatro_harness_config = {
109+
.has_harness = true,
110+
.GPIO_SBU1 = GPIOC,
111+
.GPIO_SBU2 = GPIOA,
112+
.GPIO_relay_SBU1 = GPIOA,
113+
.GPIO_relay_SBU2 = GPIOA,
114+
.pin_SBU1 = 4,
115+
.pin_SBU2 = 1,
116+
.pin_relay_SBU1 = 9,
117+
.pin_relay_SBU2 = 3,
118+
.adc_channel_SBU1 = 4, // ADC12_INP4
119+
.adc_channel_SBU2 = 17 // ADC1_INP17
120+
};
121+
108122
board board_cuatro = {
109-
.harness_config = &tres_harness_config,
123+
.harness_config = &cuatro_harness_config,
110124
.has_spi = true,
111125
.has_canfd = true,
112126
.fan_max_rpm = 12500U,

board/boards/dos.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void dos_init(void) {
106106
dos_set_bootkick(true);
107107

108108
// Init clock source (camera strobe) using PWM
109-
clock_source_init();
109+
clock_source_init(false);
110110
}
111111

112112
static harness_configuration dos_harness_config = {

board/boards/tres.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void tres_init(void) {
129129
register_set_bits(&(GPIOC->OTYPER), GPIO_OTYPER_OT10 | GPIO_OTYPER_OT11); // open drain
130130

131131
// Clock source
132-
clock_source_init();
132+
clock_source_init(false);
133133
}
134134

135135
static harness_configuration tres_harness_config = {

board/drivers/clock_source.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ void clock_source_set_period(uint8_t period) {
44
register_set(&(TIM1->ARR), ((period*10U) - 1U), 0xFFFFU);
55
}
66

7-
void clock_source_init(void) {
7+
void clock_source_init(bool enable_channel1) {
88
// Setup timer
99
register_set(&(TIM1->PSC), ((APB2_TIMER_FREQ*100U)-1U), 0xFFFFU); // Tick on 0.1 ms
1010
register_set(&(TIM1->ARR), ((CLOCK_SOURCE_PERIOD_MS*10U) - 1U), 0xFFFFU); // Period
@@ -21,11 +21,14 @@ void clock_source_init(void) {
2121
NVIC_DisableIRQ(TIM1_CC_IRQn);
2222

2323
// Set GPIO as timer channels
24+
if (enable_channel1) {
25+
set_gpio_alternate(GPIOA, 8, GPIO_AF1_TIM1);
26+
}
2427
set_gpio_alternate(GPIOB, 14, GPIO_AF1_TIM1);
2528
set_gpio_alternate(GPIOB, 15, GPIO_AF1_TIM1);
2629

2730
// Set PWM mode
28-
register_set(&(TIM1->CCMR1), (0b110UL << TIM_CCMR1_OC2M_Pos), 0xFFFFU);
31+
register_set(&(TIM1->CCMR1), (0b110UL << TIM_CCMR1_OC1M_Pos) | (0b110UL << TIM_CCMR1_OC2M_Pos), 0xFFFFU);
2932
register_set(&(TIM1->CCMR2), (0b110UL << TIM_CCMR2_OC3M_Pos), 0xFFFFU);
3033

3134
// Enable output

board/drivers/clock_source_declarations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
#define CLOCK_SOURCE_PULSE_LEN_MS 2U
55

66
void clock_source_set_period(uint8_t period);
7-
void clock_source_init(void);
7+
void clock_source_init(bool enable_channel1);

0 commit comments

Comments
 (0)