libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
hal_map.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_HAL_MAP_H
3#define DSY_HAL_MAP_H
4#include "stm32h7xx_hal.h"
5#include "daisy_core.h"
6
10#ifdef __cplusplus
11namespace daisy
12{
14{
15 return (1 << p.pin);
16}
18{
19 switch(p.port)
20 {
21 case PORTA: return GPIOA;
22 case PORTB: return GPIOB;
23 case PORTC: return GPIOC;
24 case PORTD: return GPIOD;
25 case PORTE: return GPIOE;
26 case PORTF: return GPIOF;
27 case PORTG: return GPIOG;
28 case PORTH: return GPIOH;
29 case PORTI: return GPIOI;
30 case PORTJ: return GPIOJ;
31 case PORTK: return GPIOK;
32 default: return NULL;
33 }
34}
35inline void GPIOClockEnable(Pin p)
36{
37 switch(p.port)
38 {
39 case PORTA: __HAL_RCC_GPIOA_CLK_ENABLE(); return;
40 case PORTB: __HAL_RCC_GPIOB_CLK_ENABLE(); return;
41 case PORTC: __HAL_RCC_GPIOC_CLK_ENABLE(); return;
42 case PORTD: __HAL_RCC_GPIOD_CLK_ENABLE(); return;
43 case PORTE: __HAL_RCC_GPIOE_CLK_ENABLE(); return;
44 case PORTF: __HAL_RCC_GPIOF_CLK_ENABLE(); return;
45 case PORTG: __HAL_RCC_GPIOG_CLK_ENABLE(); return;
46 case PORTH: __HAL_RCC_GPIOH_CLK_ENABLE(); return;
47 case PORTI: __HAL_RCC_GPIOI_CLK_ENABLE(); return;
48 case PORTJ: __HAL_RCC_GPIOJ_CLK_ENABLE(); return;
49 case PORTK: __HAL_RCC_GPIOK_CLK_ENABLE(); return;
50 default: return;
51 }
52}
53} // namespace daisy
54
55#endif
56#endif
Definition leddriver.h:33
Hardware defines and helpers for daisy field platform.
Definition index.h:2
constexpr uint32_t GetHALPin(Pin p)
Definition hal_map.h:13
constexpr GPIO_TypeDef * GetHALPort(Pin p)
Definition hal_map.h:17
@ PORTH
Definition daisy_core.h:184
@ PORTE
Definition daisy_core.h:181
@ PORTJ
Definition daisy_core.h:186
@ PORTK
Definition daisy_core.h:187
@ PORTA
Definition daisy_core.h:177
@ PORTF
Definition daisy_core.h:182
@ PORTB
Definition daisy_core.h:178
@ PORTI
Definition daisy_core.h:185
@ PORTC
Definition daisy_core.h:179
@ PORTD
Definition daisy_core.h:180
@ PORTG
Definition daisy_core.h:183
void GPIOClockEnable(Pin p)
Definition hal_map.h:35
representation of hardware port/pin combination
Definition daisy_core.h:193