28 #include <stm32mp1xx_hal.h>
47 #if defined(YGGDRASIL_PERIPHERAL_DEFS)
53 extern I2C_HandleTypeDef hi2c1;
54 extern I2C_HandleTypeDef hi2c2;
55 extern I2C_HandleTypeDef hi2c5;
57 extern SPI_HandleTypeDef hspi2;
58 extern SPI_HandleTypeDef hspi4;
59 extern SPI_HandleTypeDef hspi5;
61 extern TIM_HandleTypeDef htim1;
62 extern TIM_HandleTypeDef htim2;
63 extern TIM_HandleTypeDef htim3;
64 extern TIM_HandleTypeDef htim4;
65 extern TIM_HandleTypeDef htim5;
66 extern TIM_HandleTypeDef htim6;
67 extern TIM_HandleTypeDef htim12;
68 extern TIM_HandleTypeDef htim16;
70 extern ADC_HandleTypeDef hadc1;
71 extern ADC_HandleTypeDef hadc2;
73 extern DAC_HandleTypeDef hdac1;
75 extern FDCAN_HandleTypeDef hfdcan1;
76 extern FDCAN_HandleTypeDef hfdcan2;
102 static constexpr
auto& LD1 = GPIOPortJ::Pin<0>;
103 static constexpr
auto& LDA = LD1;
104 static constexpr
auto& LedBlue = LD1;
105 static constexpr
auto& LD2 = GPIOPortJ::Pin<1>;
106 static constexpr
auto& LDB = LD2;
107 static constexpr
auto& LedRed = LD2;
108 static constexpr
auto& LD3 = GPIOPortJ::Pin<2>;
109 static constexpr
auto& LDC = LD3;
110 static constexpr
auto& LedYellow = LD3;
111 static constexpr
auto& LD4 = GPIOPortJ::Pin<3>;
112 static constexpr
auto& LDD = LD4;
113 static constexpr
auto& LedGreen = LD4;
115 static constexpr
auto& Heartbeat = GPIOPortD::Pin<11>;
117 static constexpr
auto& EncoderButton = GPIOPortK::Pin<3, drv::Active::Low>;
119 static constexpr
auto& LeftJoyStickButton = GPIOPortE::Pin<9, drv::Active::Low>;
120 static constexpr
auto& ButtonJoystickA = LeftJoyStickButton;
121 static constexpr
auto& RightJoyStickButton = GPIOPortE::Pin<7, drv::Active::Low>;
122 static constexpr
auto& ButtonJoystickB = RightJoyStickButton;
124 static constexpr
auto& ButtonA = GPIOPortJ::Pin<4, drv::Active::Low>;
125 static constexpr
auto& ButtonB = GPIOPortJ::Pin<5, drv::Active::Low>;
126 static constexpr
auto& ButtonC = GPIOPortJ::Pin<6, drv::Active::Low>;
127 static constexpr
auto& ButtonD = GPIOPortJ::Pin<7, drv::Active::Low>;
129 static constexpr
auto& DriverA = GPIOPortB::Pin<3>;
130 static constexpr
auto& LD5 = DriverA;
131 static constexpr
auto& LDE = DriverA;
132 static constexpr
auto& DriverB = GPIOPortB::Pin<4>;
133 static constexpr
auto& LD6 = DriverB;
134 static constexpr
auto& LDF = DriverB;
135 static constexpr
auto& DriverC = GPIOPortB::Pin<14>;
136 static constexpr
auto& LD7 = DriverC;
137 static constexpr
auto& LDG = DriverC;
138 static constexpr
auto& DriverD = GPIOPortB::Pin<15>;
139 static constexpr
auto& LD8 = DriverD;
140 static constexpr
auto& LDH = DriverD;
155 static constexpr
auto& ADCA = ADConverter1::Channel<0>;
156 static constexpr
auto& ADCB = ADConverter1::Channel<1>;
157 static constexpr
auto& ADCC = ADConverter1::Channel<2>;
158 static constexpr
auto& ADCD = ADConverter1::Channel<6>;
159 static constexpr
auto& ADCPotentiometer = ADConverter1::Channel<15>;
160 static constexpr
auto& ADCTemperature = ADConverter2::Channel<12>;
174 static constexpr
auto& DACA = DAConverter1::Channel<1>;
175 static constexpr
auto& DACB = DAConverter1::Channel<2>;
182 namespace seven_segment {
184 static constexpr
auto& A = GPIOPortK::Pin<0>;
185 static constexpr
auto& B = GPIOPortK::Pin<1>;
186 static constexpr
auto& C = GPIOPortK::Pin<2>;
187 static constexpr
auto& D = GPIOPortK::Pin<3>;
188 static constexpr
auto& E = GPIOPortK::Pin<4>;
189 static constexpr
auto& F = GPIOPortK::Pin<5>;
190 static constexpr
auto& G = GPIOPortK::Pin<6>;
191 static constexpr
auto& DP = GPIOPortK::Pin<7>;
193 static constexpr
auto& All = GPIOPortK::Out<0,7>;
195 static constexpr
auto& Select0 = GPIOPortJ::Pin<12>;
196 static constexpr
auto& Select1 = GPIOPortJ::Pin<13>;
197 static constexpr
auto& Select2 = GPIOPortJ::Pin<14>;
198 static constexpr
auto& Select3 = GPIOPortJ::Pin<15>;
200 static constexpr
auto& SelectAll = GPIOPortJ::Out<12,15>;
222 static constexpr
auto& SPIACE = GPIOPortI::Pin<0, drv::Active::Low>;
223 static constexpr
auto& SK9822_EN = GPIOPortE::Pin<10>;
224 static constexpr
auto& SPIBCE = GPIOPortF::Pin<5, drv::Active::Low>;
225 static constexpr
auto& SPICCE = GPIOPortH::Pin<5, drv::Active::Low>;
235 using UARTST = UARTC;
258 using SinkDriverTimerA = TimerA;
259 using SinkDriverTimerB = TimerE;
260 using SinkDriverTimerC = TimerD;
261 using SinkDriverTimerD = TimerD;
268 static constexpr
auto& TimerACHA = TimerA::Channel<3>;
270 static constexpr
auto& TimerBCHA = TimerB::Channel<1>;
271 static constexpr
auto& TimerBCHB = TimerB::Channel<2>;
272 static constexpr
auto& TimerBCHC = TimerB::Channel<3>;
273 static constexpr
auto& TimerBCHD = TimerB::Channel<4>;
275 static constexpr
auto& TimerCCHA = TimerC::Channel<1>;
277 static constexpr
auto& SinkDriverTimerCHA = SinkDriverTimerA::Channel<2>;
278 static constexpr
auto& SinkDriverTimerCHB = SinkDriverTimerB::Channel<1>;
279 static constexpr
auto& SinkDriverTimerCHC = SinkDriverTimerC::Channel<1>;
280 static constexpr
auto& SinkDriverTimerCHD = SinkDriverTimerD::Channel<2>;
282 static constexpr
auto& Encoder = TimerF::Encoder;
284 static constexpr
auto& ProfileCounter = TimerG::ProfileCounter;
291 static constexpr
auto& TC78Mode = GPIOPortF::Pin<3>;
292 static constexpr
auto& TC78Err = GPIOPortG::Pin<9, drv::Active::Low>;
293 static constexpr
auto& TC78Stby = GPIOPortI::Pin<10, drv::Active::Low>;