diff options
author | Steven Gotthardt <gotthardt@gmail.com> | 2022-12-18 15:05:51 -0700 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2023-02-13 12:12:27 -0500 |
commit | 72b6bd7efa1ae282220b4bdcfb789075807ebfd2 (patch) | |
tree | d420a1b2f33e41868662ec4d5f9cc6b9e794ebe4 /src/hc32f460/internal.h | |
parent | 94cbf5ff48199f4652450fbb8de682f662a2cc5a (diff) | |
download | kutter-72b6bd7efa1ae282220b4bdcfb789075807ebfd2.tar.gz kutter-72b6bd7efa1ae282220b4bdcfb789075807ebfd2.tar.xz kutter-72b6bd7efa1ae282220b4bdcfb789075807ebfd2.zip |
hc32f460: Add support for hc32f460 micro-controllers
Signed-off-by: Steven Gotthardt <gotthardt@gmail.com>
Diffstat (limited to 'src/hc32f460/internal.h')
-rw-r--r-- | src/hc32f460/internal.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/hc32f460/internal.h b/src/hc32f460/internal.h new file mode 100644 index 00000000..dd02f9f3 --- /dev/null +++ b/src/hc32f460/internal.h @@ -0,0 +1,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 |