Files

150 lines
4.2 KiB
C
Raw Permalink Normal View History

2021-12-14 13:34:31 +08:00
/**
**************************************************************************
* @file at32f415_board.h
2022-04-11 19:32:28 +08:00
* @brief header file for at-start board. set of firmware functions to
2021-12-14 13:34:31 +08:00
* manage leds and push-button. initialize delay function.
**************************************************************************
2025-11-27 18:19:48 +08:00
*
* Copyright (c) 2025, Artery Technology, All rights reserved.
2021-12-14 13:34:31 +08:00
*
2022-04-11 19:32:28 +08:00
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
2021-12-14 13:34:31 +08:00
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#ifndef __AT32F415_BOARD_H
#define __AT32F415_BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
2022-01-21 15:54:53 +08:00
#include "stdio.h"
2021-12-14 13:34:31 +08:00
#include "at32f415.h"
/** @addtogroup AT32F415_board
* @{
*/
/** @addtogroup BOARD
* @{
*/
2022-04-11 19:32:28 +08:00
/** @defgroup BOARD_pins_definition
2021-12-14 13:34:31 +08:00
* @{
*/
/**
* this header include define support list:
* 1. at-start-f415 v1.x board
* if define AT_START_F415_V1, the header file support at-start-f415 v1.x board
*/
#if !defined (AT_START_F415_V1)
#error "please select first the board at-start device used in your application (in at32f415_board.h file)"
#endif
/******************** define led ********************/
typedef enum
{
LED2 = 0,
LED3 = 1,
LED4 = 2
} led_type;
#define LED_NUM 3
#if defined (AT_START_F415_V1)
#define LED2_PIN GPIO_PINS_2
#define LED2_GPIO GPIOC
#define LED2_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
#define LED3_PIN GPIO_PINS_3
#define LED3_GPIO GPIOC
#define LED3_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
#define LED4_PIN GPIO_PINS_5
#define LED4_GPIO GPIOC
#define LED4_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
#endif
2022-01-21 15:54:53 +08:00
/**************** define print uart ******************/
#define PRINT_UART USART1
#define PRINT_UART_CRM_CLK CRM_USART1_PERIPH_CLOCK
#define PRINT_UART_TX_PIN GPIO_PINS_9
#define PRINT_UART_TX_GPIO GPIOA
#define PRINT_UART_TX_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
2021-12-14 13:34:31 +08:00
/******************* define button *******************/
typedef enum
{
USER_BUTTON = 0,
NO_BUTTON = 1
} button_type;
#define USER_BUTTON_PIN GPIO_PINS_0
2022-04-11 19:32:28 +08:00
#define USER_BUTTON_PORT GPIOA
2021-12-14 13:34:31 +08:00
#define USER_BUTTON_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
/**
* @}
*/
/** @defgroup BOARD_exported_functions
* @{
*/
/******************** functions ********************/
void at32_board_init(void);
/* led operation function */
void at32_led_init(led_type led);
void at32_led_on(led_type led);
void at32_led_off(led_type led);
void at32_led_toggle(led_type led);
/* button operation function */
void at32_button_init(void);
button_type at32_button_press(void);
uint8_t at32_button_state(void);
/* delay function */
void delay_init(void);
void delay_us(uint32_t nus);
void delay_ms(uint16_t nms);
void delay_sec(uint16_t sec);
2022-01-21 15:54:53 +08:00
/* printf uart init function */
void uart_print_init(uint32_t baudrate);
2021-12-14 13:34:31 +08:00
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif