Compare commits
2 Commits
9fc7fc2242
...
0620b5daa2
Author | SHA1 | Date |
---|---|---|
Kilian Bracher | 0620b5daa2 | |
Kilian Bracher | 37924c719e |
|
@ -3,3 +3,4 @@
|
|||
/.cache/
|
||||
.clangd
|
||||
TouchGFX/build
|
||||
compile_commands.json
|
||||
|
|
|
@ -248,7 +248,7 @@ static void MX_FDCAN1_Init(void)
|
|||
hfdcan1.Init.DataTimeSeg1 = 1;
|
||||
hfdcan1.Init.DataTimeSeg2 = 1;
|
||||
hfdcan1.Init.MessageRAMOffset = 0;
|
||||
hfdcan1.Init.StdFiltersNbr = 0;
|
||||
hfdcan1.Init.StdFiltersNbr = 20;
|
||||
hfdcan1.Init.ExtFiltersNbr = 0;
|
||||
hfdcan1.Init.RxFifo0ElmtsNbr = 0;
|
||||
hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
#include "status_led.h"
|
||||
#include "main.h"
|
||||
#include "stm32h7xx_hal_gpio.h"
|
||||
#include "ts_state_machine.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define STATUS_LED_GPIO_PORT GPIOA //TODO: change to correct values for the board
|
||||
|
||||
#define STATUS_LED_1_RED_PIN GPIO_PIN_10 //TODO: change to correct values for the board
|
||||
#define STATUS_LED_1_GREEN_PIN GPIO_PIN_11
|
||||
#define STATUS_LED_1_BLUE_PIN GPIO_PIN_12
|
||||
|
||||
#define STATUS_LED_2_RED_PIN GPIO_PIN_13 //TODO: change to correct values for the board
|
||||
#define STATUS_LED_2_GREEN_PIN GPIO_PIN_14
|
||||
#define STATUS_LED_2_BLUE_PIN GPIO_PIN_15
|
||||
|
||||
//TODO: change to correct values for the board
|
||||
#warning "GPIO pins for status LEDs are not set correctly"
|
||||
#warning enable the second LED
|
||||
|
||||
typedef struct {
|
||||
uint8_t red : 1;
|
||||
|
@ -27,17 +17,6 @@ typedef enum {
|
|||
LED_2
|
||||
} LedId;
|
||||
|
||||
void status_led_init() {
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
GPIO_InitStruct.Pin = STATUS_LED_1_RED_PIN | STATUS_LED_1_GREEN_PIN | STATUS_LED_1_BLUE_PIN | STATUS_LED_2_RED_PIN | STATUS_LED_2_GREEN_PIN | STATUS_LED_2_BLUE_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
||||
HAL_GPIO_Init(STATUS_LED_GPIO_PORT, &GPIO_InitStruct);
|
||||
}
|
||||
|
||||
static void set_led_color(LedId id, LedColor color) {
|
||||
GPIO_PinState red = color.red ? GPIO_PIN_SET : GPIO_PIN_RESET;
|
||||
GPIO_PinState green = color.green ? GPIO_PIN_SET : GPIO_PIN_RESET;
|
||||
|
@ -45,14 +24,14 @@ static void set_led_color(LedId id, LedColor color) {
|
|||
|
||||
switch (id) {
|
||||
case LED_1:
|
||||
HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_1_RED_PIN, red);
|
||||
HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_1_GREEN_PIN, green);
|
||||
HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_1_BLUE_PIN, blue);
|
||||
HAL_GPIO_WritePin(STATUS_LED_R_GPIO_Port, STATUS_LED_R_Pin, red);
|
||||
HAL_GPIO_WritePin(STATUS_LED_G_GPIO_Port, STATUS_LED_G_Pin, green);
|
||||
HAL_GPIO_WritePin(STATUS_LED_B_GPIO_Port, STATUS_LED_B_Pin, blue);
|
||||
break;
|
||||
case LED_2:
|
||||
HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_2_RED_PIN, red);
|
||||
HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_2_GREEN_PIN, green);
|
||||
HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_2_BLUE_PIN, blue);
|
||||
//HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_2_RED_PIN, red);
|
||||
//HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_2_GREEN_PIN, green);
|
||||
//HAL_GPIO_WritePin(STATUS_LED_GPIO_PORT, STATUS_LED_2_BLUE_PIN, blue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [4.2.0-B44] date: [Tue Apr 23 16:43:14 CEST 2024]
|
||||
# File automatically-generated by tool: [projectgenerator] version: [4.2.0-B44] date: [Tue Apr 23 17:43:11 CEST 2024]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
|
|
|
@ -5,7 +5,8 @@ CAD.provider=
|
|||
FDCAN1.CalculateBaudRateNominal=533333
|
||||
FDCAN1.CalculateTimeBitNominal=1875
|
||||
FDCAN1.CalculateTimeQuantumNominal=375.0
|
||||
FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal
|
||||
FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,StdFiltersNbr
|
||||
FDCAN1.StdFiltersNbr=20
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
I2C1.IPParameters=Timing
|
||||
|
|
Loading…
Reference in New Issue