hc32f460: Add support for hc32f460 micro-controllers

Signed-off-by: Steven Gotthardt <gotthardt@gmail.com>
This commit is contained in:
Steven Gotthardt
2022-12-18 15:05:51 -07:00
committed by Kevin O'Connor
parent 94cbf5ff48
commit 72b6bd7efa
11 changed files with 928 additions and 0 deletions

29
src/hc32f460/internal.h Normal file
View File

@@ -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