aboutsummaryrefslogtreecommitdiffstats
path: root/src/hc32f460/internal.h
blob: dd02f9f3c9d2fdf7d9a5de343ac69fcefa47ad87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef __HC32F460_INTERNAL_H
#define __HC32F460_INTERNAL_H


// Local definitions for Huada HC32F460

#include "autoconf.h"
#include "hc32f460.h"

// The HC32F460 library uses a port address and a shifted pin bit
//  eg en_result_t PORT_Toggle(en_port_t enPort, uint16_t u16Pin);
//  see hc32f460_gpio.h


// encode and decode gpio ports and pins
#define GPIO(PORT, NUM) (((PORT)-'A') * 16 + (NUM))
#define GPIO2PORT(GPIO) ((GPIO) / 16)
#define GPIO2BIT(GPIO) (1<<((GPIO) % 16))
#define GPIO2PIN(GPIO) ((GPIO) % 16)

#define GPIO_INPUT  0
#define GPIO_OUTPUT 1

void gpio_peripheral(uint32_t pin, int func, int pull_up);

// from local interrupts.c - helper
void IrqRegistration(en_int_src_t irqSrc, IRQn_Type irqType);

#endif // internal.h