AD-APARD32690-SL Support and Cleanup

- Added BSP for AD-APARD32690-SL board (apard32690)
 - Ran clang-formatting on previously committed code
 - Removed LOG messages from dcd_max32.c
This commit is contained in:
Brent Kowal
2024-07-01 16:31:17 -04:00
parent 0f288326cc
commit 0b82af61f3
6 changed files with 240 additions and 213 deletions

View File

@@ -0,0 +1 @@
# Nothing to be done at the board level

View File

@@ -0,0 +1,56 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2024, Brent Kowal (Analog Devices, Inc)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the TinyUSB stack.
*/
#ifndef BOARD_H_
#define BOARD_H_
#include "gpio.h"
#include "mxc_sys.h"
#ifdef __cplusplus
extern "C" {
#endif
// LED
#define LED_PORT MXC_GPIO2
#define LED_PIN MXC_GPIO_PIN_1
#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
#define LED_STATE_ON 1
// Button
#define BUTTON_PORT MXC_GPIO1
#define BUTTON_PIN MXC_GPIO_PIN_27
#define BUTTON_PULL MXC_GPIO_PAD_NONE
#define BUTTON_STATE_ACTIVE 1
// UART Enable for UART on ARM SWD Connector
#define UART_NUM 0
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */

View File

@@ -0,0 +1 @@
# No specific build requirements for the board.

View File

@@ -31,26 +31,26 @@
#include "mxc_sys.h"
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
// LED
#define LED_PORT MXC_GPIO0
#define LED_PIN MXC_GPIO_PIN_14
#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
#define LED_STATE_ON 0
#define LED_PORT MXC_GPIO0
#define LED_PIN MXC_GPIO_PIN_14
#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
#define LED_STATE_ON 0
// Button
#define BUTTON_PORT MXC_GPIO4
#define BUTTON_PIN MXC_GPIO_PIN_0
#define BUTTON_PULL MXC_GPIO_PAD_PULL_UP
#define BUTTON_STATE_ACTIVE 0
#define BUTTON_PORT MXC_GPIO4
#define BUTTON_PIN MXC_GPIO_PIN_0
#define BUTTON_PULL MXC_GPIO_PAD_PULL_UP
#define BUTTON_STATE_ACTIVE 0
// UART Enable for EvKit's Integrated FTDI Adapter. Pin Mux handled by the HAL
#define UART_NUM 2
#define UART_NUM 2
#ifdef __cplusplus
}
}
#endif
#endif /* BOARD_H_ */

View File

@@ -24,12 +24,12 @@
* This file is part of the TinyUSB stack.
*/
#include "bsp/board_api.h"
#include "board.h"
#include "mxc_device.h"
#include "mcr_regs.h"
#include "uart.h"
#include "bsp/board_api.h"
#include "gpio.h"
#include "mcr_regs.h"
#include "mxc_device.h"
#include "uart.h"
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler
@@ -49,7 +49,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
mxc_gpio_cfg_t gpioConfig;
@@ -87,10 +87,10 @@ void board_init(void) {
//--------------------------------------------------------------------+
void board_led_write(bool state) {
#if LED_STATE_ON
state = !state;
#endif
if(state) {
#if LED_STATE_ON
state = !state;
#endif
if (state) {
MXC_GPIO_OutClr(LED_PORT, LED_PIN);
} else {
MXC_GPIO_OutSet(LED_PORT, LED_PIN);
@@ -103,9 +103,9 @@ uint32_t board_button_read(void) {
}
size_t board_get_unique_id(uint8_t id[], size_t max_len) {
uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN]; //USN Buffer
/* All other 2nd parameter is optional checkum buffer */
MXC_SYS_GetUSN(hw_id, NULL);
uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN];//USN Buffer
/* All other 2nd parameter is optional checkum buffer */
MXC_SYS_GetUSN(hw_id, NULL);
size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
memcpy(id, hw_id, act_len);
@@ -116,11 +116,11 @@ int board_uart_read(uint8_t *buf, int len) {
int uart_val;
int act_len = 0;
while( act_len < len ) {
if((uart_val = MXC_UART_ReadCharacterRaw(ConsoleUart)) == E_UNDERFLOW) {
while (act_len < len) {
if ((uart_val = MXC_UART_ReadCharacterRaw(ConsoleUart)) == E_UNDERFLOW) {
break;
} else {
*buf++ = (uint8_t)uart_val;
*buf++ = (uint8_t) uart_val;
act_len++;
}
}
@@ -129,8 +129,8 @@ int board_uart_read(uint8_t *buf, int len) {
int board_uart_write(void const *buf, int len) {
int act_len = 0;
const uint8_t* ch_ptr = (const uint8_t*)buf;
while(act_len < len){
const uint8_t *ch_ptr = (const uint8_t *) buf;
while (act_len < len) {
MXC_UART_WriteCharacter(ConsoleUart, *ch_ptr++);
act_len++;
}