led define

This commit is contained in:
Rene Hopf
2017-09-12 20:03:02 +02:00
parent 2fc90f9d3c
commit 487436ed0c
3 changed files with 12 additions and 13 deletions

View File

@@ -169,9 +169,9 @@ int main(void) {
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_SET);
HAL_Delay(50);
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_RESET);
HAL_Delay(50);
}
/* USER CODE END 3 */
@@ -273,14 +273,14 @@ static void MX_GPIO_Init(void) {
__HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_RESET);
/*Configure GPIO pin : LED_Pin */
GPIO_InitStruct.Pin = LED_Pin;
/*Configure GPIO pin : LED_PIN */
GPIO_InitStruct.Pin = LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct);
}
/* USER CODE BEGIN 4 */

View File

@@ -4,6 +4,8 @@
#define HV_EN_PORT GPIOA
#define HV_FAULT_PIN GPIO_PIN_7
#define HV_FAULT_PORT GPIOB
#define LED_PIN GPIO_PIN_8
#define LED_PORT GPIOA
#define VDIVUP 249000.0 * 2.0 //HV div pullup R1,R12
#define VDIVDOWN 3900.0 //HV div pulldown R2,R9
@@ -11,9 +13,6 @@
#define SHUNT_PULLUP 15000.0
#define SHUNT_SERIE 470.0
#define LED_Pin GPIO_PIN_8
#define LED_GPIO_Port GPIOA
#define PWM_U TIM8->CCR3
#define PWM_V TIM8->CCR2
#define PWM_W TIM8->CCR1

View File

@@ -76,12 +76,12 @@ static void nrt_init(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
// struct io_ctx_t * ctx = (struct io_ctx_t *)ctx_ptr;
// struct io_pin_ctx_t * pins = (struct io_pin_ctx_t *)pin_ptr;
GPIO_InitTypeDef GPIO_InitStruct;
//PA8 LED
GPIO_InitStruct.Pin = GPIO_PIN_8;
//LED
GPIO_InitStruct.Pin = LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct);
DMA1_Channel1->CCR &= (uint16_t)(~DMA_CCR_EN);
DMA1_Channel1->CPAR = (uint32_t) & (ADC12_COMMON->CDR);
@@ -136,7 +136,7 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
PIN(hv_temp) = r2temp(HV_R(ADC(adc_34_buf[0] >> 16))) * 0.01 + PIN(hv_temp) * 0.99; // 5.5u
PIN(mot_temp) = MOT_R(MOT_REF(ADC(adc_34_buf[3] >> 16))); // 1.4u
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, PIN(led) > 0 ? GPIO_PIN_SET : GPIO_PIN_RESET); // 0.1u
HAL_GPIO_WritePin(LED_PORT, LED_PIN, PIN(led) > 0 ? GPIO_PIN_SET : GPIO_PIN_RESET); // 0.1u
}
hal_comp_t io_comp_struct = {